以10个点的差距开立订单 - 页 6

 
WHRoeder:
  1. 我要求提供找到最高开盘价的代码。这样做吗?在有滑点的情况下会这样吗?
  2. 你认为这意味着什么?
  3. 我要求你展示测试Bid是否比最后的开盘价高10个点的代码。当市场比任何订单(不是最高的)高10个点时,你为什么要开卖。
  4. 请你决定,你是要10个点还是10个点。





是的,我想要10个点。

 
dan100:

并检查我添加的这个条件是否正确..............

 double highest_open_price=0;
   int    highest_Ticket=-1;
   for(int pos=OrdersTotal()-1; pos>=0; pos--)
      if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES) // Only my orders w/
         && OrderMagicNumber()==0           // my magic number
         && OrderSymbol()==Symbol() // and my pair.
         && OrderOpenPrice()>=highest_open_price)
        {
         highest_open_price=OrderOpenPrice();
         highest_Ticket=OrderTicket();
        }
         RefreshRates();
          if (Bid>=highest_open_price+10*Point)
   highest_Ticket=OrderSend(Symbol(),OP_SELL,mylot(),Bid,0,0,0,"My Comment",0,0,Red);


     }

请不要发布带有杂散的}的代码。

它是混乱的

在策略测试器中尝试你的EA,你会看到你是否正确。


 
GumRai:

} -- WHRoeder 指出了这一点,我已经改正了,谢谢你的注意。



我认为WHRoeder:关于点和点观点是正确的,现在高点已经得到了,我认为 应该被考虑


 

现在看看我是如何计算我的点数的,因为高点已经得到了,我说的对吗..........


 double highest_open_price=0;
   int    highest_Ticket=-1;
   for(int pos=OrdersTotal()-1; pos>=0; pos--)
      if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES) // Only my orders w/
         && OrderMagicNumber()==0           // my magic number
         && OrderSymbol()==Symbol() // and my pair.
         && OrderOpenPrice()>=highest_open_price)
        {
         highest_open_price=OrderOpenPrice();
         highest_Ticket=OrderTicket();
        }
        

 int look_pips=0; 
for(pos=OrdersTotal()-1; pos>=0; pos--) 

      highest_open_price=MathAbs(High[pos]-Low[pos])/Point;  //pips levels of the bar
      if (Bid>=highest_open_price && look_pips >=my_pips)
      Print("The last price movement more than ",my_pips); 
 
         RefreshRates();
   highest_Ticket=OrderSend(Symbol(),OP_SELL,mylot(),Bid,0,0,0,"My Comment",0,0,Red);



记得我的 点数是在extern double my_pips =10 中添加的 而且也没有计算到适合5位数的经纪人,我将在后面添加。

	          
 

我不知道你想做什么

在第一个循环 中得到了最高 价格的值

然后你再循环一遍订单,给它一个不同的值

why?????

 
GumRai:

我不知道你想做什么

在第一个循环 中得到了最高 价格的值

然后你再循环一遍订单,给它一个不同的值

why?????




对不起,这是个错误,在我看到你的帖子之前,我正准备重写它。只是在它上面做了更多的工作,把它改为tick值......。

现在我用tick值来计算pips.....。



 double highest_open_price=0;
   int    highest_Ticket=-1;
   for(int pos=OrdersTotal()-1; pos>=0; pos--)
      if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES) // Only my orders w/
         && OrderMagicNumber()==0           // my magic number
         && OrderSymbol()==Symbol() // and my pair.
         && OrderOpenPrice()>=highest_open_price)
        {
         highest_open_price=OrderOpenPrice();
         highest_Ticket=OrderTicket();
        }
        
        
   double tickvalue = (MarketInfo(Symbol(),MODE_TICKVALUE));
   if(Digits == 5 || Digits == 3){
      tickvalue = tickvalue*10;
   }
       if (Bid>=highest_open_price + tickvalue*10)
      Print("The last price movement more than ",tickvalue); 
 
         RefreshRates();
   highest_Ticket=OrderSend(Symbol(),OP_SELL,mylot(),Bid,0,0,0,"My Comment",0,0,Red);




now to add my comment on this tick value. one thing i know is -----10pips is a movement of price upward or down to definite number point stored while 10tick 
is count of moving price without storing number

else 10tick can complete in 1 candle far below pips. while 10pips can complete in more than 20bars/candle or even 1bar/candle.

conclusion i dont think i got it right?


please point me through 



in addition double MYPIP= MarketInfo(Symbol(), MODE_DIGITS); can  it work on this case to get pip
 
        
   double PipDecimal=Point;
   if(Digits == 5 || Digits == 3)
      PipDecimal = PipDecimal*10;

   if (Bid>=highest_open_price + PipDecimal *10)
 
GumRai:


谢谢你的指正,我很感激。


现在我把代码连接在一起,最高的是得到了点子......

然后我进行了回测,但结果与代码不一致,为什么?

我还需要添加到代码中,还是因为市场已经关闭...谢谢

还是应该考虑双PipDecimal = (MarketInfo(Symbol(),MODE_DIGITS));


 double highest_open_price=0;
   int    highest_Ticket=-1;
   for(int pos=OrdersTotal()-1; pos>=0; pos--)
      if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES) // Only my orders w/
         && OrderMagicNumber()==0           // my magic number
         && OrderSymbol()==Symbol() // and my pair.
         && OrderOpenPrice()>=highest_open_price)
        {
         highest_open_price=OrderOpenPrice();
         highest_Ticket=OrderTicket();
        }
        
   double PipDecimal=Point;
   if(Digits == 5 || Digits == 3)
      PipDecimal = PipDecimal*10;

   if (Bid>=highest_open_price + PipDecimal *10)
      Print("The last price movement more than ",PipDecimal); 
 
         RefreshRates();
   highest_Ticket=OrderSend(Symbol(),OP_SELL,mylot(),Bid,0,0,0,"My Comment",0,0,Red);





结果
 
   if (Bid>=highest_open_price + PipDecimal *10)
      {
      Print("The last price movement more than ",PipDecimal); 
      RefreshRates();
      highest_Ticket=OrderSend(Symbol(),OP_SELL,mylot(),Bid,0,0,0,"My Comment",0,0,Red);
      }
如果没有大括号,每一次打勾 都会有一个新的交易被打开。
 
GumRai:
如果没有大括号,每一次交易都会打开一个新的交易。


很好!效果很好......完美地找到了。


但唯一的问题是,在第二个 订单期间,在第一个成功的 订单打开后,它又继续打开多个订单。

请问我有什么地方做错了吗?