Alert show up - page 2

 

Hi RaptorUK,

My apologies to keep use your time.

In log that follows when the initial order open the stop loss is different from 0 and that is ok because stop loss in external is 50, but when the opposite order open the stop loss is 0 and I suppose that this is wrong. How can this happen if opposite order calls for add limits function and in this functrion the stop loss is the external 50 ? 

Nevertheless on graphic one can see that all sto loss lines are 50 pips apart from price.... 

2013.04.02 16:44:46     market_order_ecn_80_800_v7_v3 EURUSDi,M1:  Opposite Sell Order Placed: 6621931 StopLoss: 0.00000 Open Price: 1.28339
2013.04.02 16:44:46     market_order_ecn_80_800_v7_v3 EURUSDi,M1: modify #6621931 sell 0.02 EURUSDi at 1.28339 sl: 1.28871 tp: 1.27871 ok
2013.04.02 16:44:45     market_order_ecn_80_800_v7_v3 EURUSDi,M1: open #6621931 sell 0.02 EURUSDi at 1.28339 ok
2013.04.02 16:41:06     market_order_ecn_80_800_v7_v3 EURUSDi,M1:  Initial Buy Order Placed - BuyTicket: 6621911
2013.04.02 16:41:06     market_order_ecn_80_800_v7_v3 EURUSDi,M1: modify #6621911 buy 0.01 EURUSDi at 1.28371 sl: 1.27852 tp: 1.28852 ok
2013.04.02 16:41:05     market_order_ecn_80_800_v7_v3 EURUSDi,M1: open #6621911 buy 0.01 EURUSDi at 1.28371 ok

 Thank you in advance

Luis 

 
luisneves:

Hi RaptorUK,

My apologies to keep use your time.

In log that follows when the initial order open the stop loss is different from 0 and that is ok because stop loss in external is 50, but when the opposite order open the stop loss is 0 and I suppose that this is wrong. How can this happen if opposite order calls for add limits function and in this functrion the stop loss is the external 50 ? 

Nevertheless on graphic one can see that all sto loss lines are 50 pips apart from price.... 

 Thank you in advance

Luis 

In the following code . . . 

   void   AddLimitsSell()
      {//0
       
       OrderSelect(SellTicket,SELECT_BY_TICKET);
                                                                              
            SellStopLoss = OpenPrice + (StopLoss * pips2dbl);
            SellTakeProfit = OpenPrice - (TakeProfit * pips2dbl); 

 where does the value of OpenPrice come from  ?  what code is used to set it ?  please post it here and explain how it is relevant to this code ?

 
RaptorUK:

In the following code . . . 

 where does the value of OpenPrice come from  ?  what code is used to set it ?  please post it here and explain how it is relevant to this code ?


Hi RaptorUk,

So, the OpenPrice is the OrderOpenPrice from the order that the ticket identifies, in this case is the OrderOpenPrice is the Bid at the moment the order is open. Hummmmm........should be bid for sell and ask for buy, right ?

The code is;

 

//Add limits after sent order for ECN Brokers)   

   void  AddLimitsBuy()
     {//0
        OpenPrice = OrderOpenPrice();
        OrderSelect(BuyTicket,SELECT_BY_TICKET);
                      
        BuyStopLoss = OpenPrice - (StopLoss * pips2dbl); 
        BuyTakeProfit = OpenPrice + (TakeProfit * pips2dbl);
            
        if(BuyStopLoss < MinimumStop)        
           BuyStopLoss = MinimumStop;
                                                                   
         RefreshRates();        
         if(!OrderModify(BuyTicket,OpenPrice,BuyStopLoss,BuyTakeProfit,0,CLR_NONE))
          {//1    
            ErrorCode = GetLastError();
            string ErrDesc = ErrorDescription(ErrorCode);
                  
            string ErrAlert = StringConcatenate(" Add Limits Buy Failed - Error: " ,ErrorCode,": ",ErrDesc);
            Alert(ErrAlert);
                  
            string ErrLog = StringConcatenate(" Add Limits Buy Failed - Ask: ",DoubleToStr(Ask,Digits)," Ticket: ",BuyTicket," Spread: ", DoubleToStr(Spread,Digits)," Lots: ",MLots," Buy Stop Loss: ",DoubleToStr(BuyStopLoss,Digits)," Stop Level: " ,StopLevel," Freeze Level: " ,FreezeLevel);
            Print(ErrLog); 
          }//1                         
       }//0
      
    //+------------------------------------------------------------------------------------------------------------------+ 
   //Add limits after sent order (ECN Brokers)   

   void   AddLimitsSell()
      {//0
         OpenPrice = OrderOpenPrice();
         OrderSelect(SellTicket,SELECT_BY_TICKET);
                                                                              
              SellStopLoss = OpenPrice + (StopLoss * pips2dbl);
              SellTakeProfit = OpenPrice - (TakeProfit * pips2dbl); 
         
              if(SellStopLoss < MinimumStop)         
                 SellStopLoss = MinimumStop;
                                                                      
                RefreshRates(); 
         if(!OrderModify(SellTicket,OpenPrice,SellStopLoss,SellTakeProfit,0,CLR_NONE))
          {//1
            ErrorCode = GetLastError();
            string ErrDesc =ErrorDescription(ErrorCode);
                  
            string ErrAlert = StringConcatenate(" Add Limits Sell Failed - Error: ",ErrorCode, ": ",ErrDesc);
            Alert(ErrAlert);
         
            string ErrLog = StringConcatenate("Add Limits Sell Failed - Bid: ",DoubleToStr(Bid,Digits)," Ticket: ",SellTicket," Spread: ",DoubleToStr(Spread,Digits)," Lots: " ,MLots," Sell Stop Loss: ",DoubleToStr(SellStopLoss,Digits)," Stop Level: " ,StopLevel," Freeze Level: " ,FreezeLevel);
            Print(ErrLog);
          }//1
       }//0                    
           

 

Thank you for your time

Luis 

 
luisneves:


Hi RaptorUk,

So, the OpenPrice is the OrderOpenPrice from the order that the ticket identifies, in this case is the OrderOpenPrice is the Bid at the moment the order is open. Hummmmm........should be bid for sell and ask for buy, right ?

The code is;


That should help,  test it and see what happens.
 
RaptorUK:
That should help,  test it and see what happens.


Hi RaptorUK,

 That issue was due to a line of error be in the wrong place.

Because the line was getting information from OrderSend(....) and here the StopLoss is 0, so it can only be 0.0000.

Now I've exclude information of StopLoss from the line. 

Best Regards

Luis 

Reason: