为什么 WindowPriceOnDrop() 函数不在我的代码中用作价格存储?
Why doesn't the WindowPriceOnDrop() function serve as a store of price in my code?
我使用网格订单进行交易已有一段时间了,但刚刚意识到我想加入一个 WindowPriceOnDropped()
功能。
我的标准下单是这样写的。以下是 5 个订单的示例代码,间隔 5 个点,都是微型手,有 50 个点的止损点和 100 个点的获利点。第一个订单出现接近市场,仅下跌 1 个点,其余订单如下:
int start()
{
int ticket;
double point;
//----
point=MarketInfo(Symbol(),MODE_POINT);
//----
ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.01,Ask-100*point,0,Ask-600*point,Ask+900*point,"[5] 1k, 1 pip down");
ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.01,Ask-150*point,0,Ask-650*point,Ask+850*point,"[5] 1k, 1 pip down");
ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.01,Ask-200*point,0,Ask-700*point,Ask+800*point,"[5] 1k, 1 pip down");
ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.01,Ask-250*point,0,Ask-750*point,Ask+750*point,"[5] 1k, 1 pip down");
ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.01,Ask-300*point,0,Ask-800*point,Ask+700*point,"[5] 1k, 1 pip down");
//----
return(0);
}
//+------------------------------------------------------------------+
我正在测试 WindowPriceOnDropped()
,像这样:
#include <stdlib.mqh>
#include <WinUser32.mqh>
int start()
{
int ticket;
double point;
double Price = WindowPriceOnDropped();
//----
point=MarketInfo(Symbol(),MODE_POINT);
//----
ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.01,Price*point,0,Price-500*point,Price+1000*point, "[5] 1k test");
//----
return(0);
}
//+------------------------------------------------------------------+
但是,订单根本没有出现。我错过了什么吗?我唯一改变的是 "Price",由于 WindowPriceOnDropped()
函数,它应该在下降时存储点值,而不是询问负点值。如果逻辑保持不变,为什么我不能简单地用变量替换 "Ask"?
谢谢。
WindowPriceOnDropped()
returns 价格的标准化值,您可以用 NormalizeDouble(double, _Digits)
再次标准化。因此,不要 Price*point
使用 Price
或其标准化值。
我使用网格订单进行交易已有一段时间了,但刚刚意识到我想加入一个 WindowPriceOnDropped()
功能。
我的标准下单是这样写的。以下是 5 个订单的示例代码,间隔 5 个点,都是微型手,有 50 个点的止损点和 100 个点的获利点。第一个订单出现接近市场,仅下跌 1 个点,其余订单如下:
int start()
{
int ticket;
double point;
//----
point=MarketInfo(Symbol(),MODE_POINT);
//----
ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.01,Ask-100*point,0,Ask-600*point,Ask+900*point,"[5] 1k, 1 pip down");
ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.01,Ask-150*point,0,Ask-650*point,Ask+850*point,"[5] 1k, 1 pip down");
ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.01,Ask-200*point,0,Ask-700*point,Ask+800*point,"[5] 1k, 1 pip down");
ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.01,Ask-250*point,0,Ask-750*point,Ask+750*point,"[5] 1k, 1 pip down");
ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.01,Ask-300*point,0,Ask-800*point,Ask+700*point,"[5] 1k, 1 pip down");
//----
return(0);
}
//+------------------------------------------------------------------+
我正在测试 WindowPriceOnDropped()
,像这样:
#include <stdlib.mqh>
#include <WinUser32.mqh>
int start()
{
int ticket;
double point;
double Price = WindowPriceOnDropped();
//----
point=MarketInfo(Symbol(),MODE_POINT);
//----
ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.01,Price*point,0,Price-500*point,Price+1000*point, "[5] 1k test");
//----
return(0);
}
//+------------------------------------------------------------------+
但是,订单根本没有出现。我错过了什么吗?我唯一改变的是 "Price",由于 WindowPriceOnDropped()
函数,它应该在下降时存储点值,而不是询问负点值。如果逻辑保持不变,为什么我不能简单地用变量替换 "Ask"?
谢谢。
WindowPriceOnDropped()
returns 价格的标准化值,您可以用 NormalizeDouble(double, _Digits)
再次标准化。因此,不要 Price*point
使用 Price
或其标准化值。