[存档]任何菜鸟问题,为了不使论坛变得杂乱无章。专业人士,不要路过。没有你就无处可去 - 3. - 页 51

 
valenok2003:

其实是这样的

print给出_dif = 0.01,但_Lot = 0;

可能设置为

int_Lot; //那么它将切断任何小于1的

并应设置为。

双倍的 _Lot。


 
forexnew:

可能设置为

int_Lot; //那么它将切断任何小于零的东西

并应设置为。

双倍的 _Lot。



双倍的_Lot。
double _Lot_BUY = 0;
双倍 _Lot_SELL = 0;
double _Lot_BUYSTOP = 0;
double _Lot_SELLSTOP = 0;
 

这里是另一个建筑

   if(_Lot_BUY > _Lot_SELL+_Lot_SELLSTOP) {
       _dif = _Lot_BUY - (_Lot_SELL + _Lot_SELLSTOP);
      if(_Lot_BUY - (_Lot_SELL + _Lot_SELLSTOP) >= 0.01) _Lot = 0.01;
      if(_Lot_BUY - (_Lot_SELL + _Lot_SELLSTOP) >=  0.1) _Lot =  0.1; 
      if(_Lot_BUY - (_Lot_SELL + _Lot_SELLSTOP) >=    1) _Lot =    1;   
      if(_Lot_BUY - (_Lot_SELL + _Lot_SELLSTOP) >=   10) _Lot =   10; 

Print(_dif +" установка2 _Lot = "+_Lot+ "_Lot_BUY = "+_Lot_BUY+ "_Lot_BUYSTOP = "+_Lot_BUYSTOP+ "_Lot_SELL = "+_Lot_SELL+ "_Lot_SELLSTOP = "+_Lot_SELLSTOP);

      _Price = NormalizeDouble((Low [iLowest (Symbol(),TF_Cnt_Bar_for_Lock,MODE_LOW, _Bars_PP_OP_SELLSTOP,0)]- Dist_For_Boot*Point),Digits);
      if(Bid - _Price < Dist_For_Boot*Point) {
         _Bars_PP_OP_SELLSTOP *=2;
         _RESET_Bars_PP_OP_SELLSTOP = false;
      }
      if(set_order_sellstop(_Price, _Lot, _Txt_Lock+Comment_Order)!= -1) _RESET_Bars_PP_OP_SELLSTOP = true;
   }

并不像这样工作,但在下面的例子中,它是这样的

   if(_Lot_BUY > _Lot_SELL+_Lot_SELLSTOP) {
       _dif = _Lot_BUY - (_Lot_SELL + _Lot_SELLSTOP);
      //if(_Lot_BUY - (_Lot_SELL + _Lot_SELLSTOP) >= 0.01) 
      _Lot = 0.01;
      if(_Lot_BUY - (_Lot_SELL + _Lot_SELLSTOP) >=  0.1) _Lot =  0.1; 
      if(_Lot_BUY - (_Lot_SELL + _Lot_SELLSTOP) >=    1) _Lot =    1;   
      if(_Lot_BUY - (_Lot_SELL + _Lot_SELLSTOP) >=   10) _Lot =   10; 

Print(_dif +" установка2 _Lot = "+_Lot+ "_Lot_BUY = "+_Lot_BUY+ "_Lot_BUYSTOP = "+_Lot_BUYSTOP+ "_Lot_SELL = "+_Lot_SELL+ "_Lot_SELLSTOP = "+_Lot_SELLSTOP);

      _Price = NormalizeDouble((Low [iLowest (Symbol(),TF_Cnt_Bar_for_Lock,MODE_LOW, _Bars_PP_OP_SELLSTOP,0)]- Dist_For_Boot*Point),Digits);
      if(Bid - _Price < Dist_For_Boot*Point) {
         _Bars_PP_OP_SELLSTOP *=2;
         _RESET_Bars_PP_OP_SELLSTOP = false;
      }
      if(set_order_sellstop(_Price, _Lot, _Txt_Lock+Comment_Order)!= -1) _RESET_Bars_PP_OP_SELLSTOP = true;
   }
 

日志中出现以下信息

0.01000000 setting2 _Lot = 0.00000000_Lot_BUY = 0.03000000_Lot_BUYSTOP = 0.00000000_Lot_Sell = 0.00000000_Lot_SellSTOP = 0.02000000
17:07:12 Expert_V3 GBPUSD,M1:OrderSend函数 的手数无效

然而,虽然缺少3个SELLSTOP,但它设置前两个没有问题,但在第三个上却跌跌撞撞。

也就是说,为什么它没有将lot设置为0.01,尽管它正确地计算了_dif变量......。

 
Roger:


这是你的想法吗?

它只会从第二种情况下打开订单。甚至不是从第二次开始,而是从第三次开始。

谢谢你
 
请告知是否可以确定交易时段 开始的时间(例如,对于莫斯科是10-35,等等),或者只是创建一个变量并在其中写入一个值?这是必要的,以便不在会议开始时下订单,而是确定方向。
 
first_may:
请告知是否可以确定交易时段开始的时间(例如,对于莫斯科是10-35,等等),或者只是创建一个变量并在其中写入一个值?这是必要的,以便不在会议开始时下订单,而是确定方向。
外汇交易会议的时间表
 

所以建议只用一个变量来存储会话的开始。谢谢你。
 
另外,这是我遇到的最好的会议指标。
P.S.
在数据库中发现了它。https://www.mql5.com/ru/code/9313
附加的文件:
 
是否有一个处理日期的例子函数,即确定两个日期之间的差异,是否大于零?