Little bug... please help : )
HI,
Could you tell me why this is working only if I have only one order open at once?
Does the Order Reliable code handle the return values from the OrderModify() and report all errors ?
Now it works better:
for (int z2=OrdersTotal()-1; z2 >= 0; z2 --) { OrderSelect(z2, SELECT_BY_POS, MODE_TRADES); if( OrderType() == OP_SELL && OrderMagicNumber() == 0 && OrderLots() == 0.05 && OrderStopLoss() == 0 ) {OrderModifyReliable(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+P_Stoploss*10*Point,OrderTakeProfit(),0,White);} if( OrderType() == OP_BUY && OrderMagicNumber() == 0 && OrderLots() == 0.05 && OrderStopLoss() == 0 ) {OrderModifyReliable(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-75*10*Point,OrderTakeProfit(),0,White);} }
I have one more bug... The orderReliable show an error for AUDJPY.... 130 invalid SL. but I thought this was good to handle 3 or 5 digit
//+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- magicalNumber = currencyToInt()+stringToInt(EA_NAME); if(Digits == 3 || Digits == 5) { TakeProfit = P_TakeProfit * 10; StopLoss = P_Stoploss * 10; slippage = P_slippage * 10; TrailingStopDeclencheur = P_TrailingStopDeclencheur * 10; TrailingStopDistance = P_TrailingStopDistance * 10; } else { TakeProfit = P_TakeProfit; StopLoss = P_Stoploss; slippage = P_slippage; TrailingStopDeclencheur = P_TrailingStopDeclencheur; TrailingStopDistance = P_TrailingStopDistance; }
Thank you for your fast help
Now it works better:
I have one more bug... The orderReliable show an error for AUDJPY.... 130 invalid SL. but I thought this was good to handle 3 or 5 digit
Why bother with that code to adjust for 4/5 Digit Brokers when you don't bother to use the variable that it produces ?
StopLoss = P_Stoploss * 10;
OrderOpenPrice() + P_Stoploss * 10 * Point,
If your trade is already in DrawDown adjusting the SL based on the OrderOpenPrice() may mean that you are trying to set the SL too close . . . maybe OrderReliable isn't as reliable as it's name suggests . . .
Your code must comply with what is written in this document otherwise you will get issues: Requirements and Limitations in Making Trades
I don't understand how I could use it in order to work. My SL parameter = 20 but when it deals with JPY... in fact it becomes 0.2 pips... that's why I'm too close from market price.
HI,
Could you tell me why this is working only if I have only one order open at once?
Regards
Baptiste