Hi all,
I'm testing the ea on a demo account and some times comes this error on Journal tab;
14:30:02 '2089041584': modification of order #6413070 sell 0.04 EURUSDi at 1.29077 sl: 1.29039 tp: 1.28584 -> sl: 1.29038 tp: 1.28584 failed [Invalid parameters]
Any suggestions how to avoid this '
Thank you in advance
Luis
Where is the message that you printed to the log ? what was the error number ? what was the Ask price at the time ? what is the Freezelevel ? are you printing Ask and Freezelevel when you get an error ? if not why not ? don't you want to know so you can diagnose the issue ? isn't more information better than less information ?
Hi RaptorUK,
The message was from the log file.
Regarding all the other parameters I will take your advise and go to update the line to get the errors.
Thank you for your support
Luis
Hi RaptorUK,
The message was from the log file.
Regarding all the other parameters I will take your advise and go to update the line to get the errors.
- You need to print out the Bid (and stop level) at the time you tried to modify SL to 1.29038 (one point below break even.)
- There are no mind readers here - post your code.
Play videoPlease edit your post.
For large amounts of code, attach it.
- You need to print out the Bid (and stop level) at the time you tried to modify SL to 1.29038 (one point below break even.)
- There are no mind readers here - post your code.
Play videoPlease edit your post.
For large amounts of code, attach it.
Hi WHRoeder,
My apologies not to use the SRC.
I am working to include that information on error routine and will back soon.
Best regards
Luis
It's really cool to print the Error description to the log . . . but which error was that description for ? how is anyone else to know with certainty which error occurred ? if you must print the description then also print the error number, it is unambiguous.
Good Morning RaptorUk,
So, now I've insert more information in error routine. My apologies for the method as I took it from examples found.
#property copyright "" #include <stdlib.mqh> #include <WinUser32.mqh>
// Buy Order Condition to Open //if(Ask > BuyTrigger && BuyAllowed) if(BuyAllowed) {//5 while(IsTradeContextBusy()) Sleep(SleepTime); RefreshRates(); BuyTicket=OrderSend(Symbol(),OP_BUY,LotSize,Ask,Slippage*pips2points,0,0,"Buy Order",MagicNumber,0,Green); if(BuyTicket > -1) {//6 BuyAllowed = false;SellAllowed = true; AddLimitsBuy(); Print("Initial Buy order placed ", BuyTicket); string ErrLog = StringConcatenate("Ask: ",Ask, "Open Buy Price: ", OrderOpenPrice(), " Ticket: ", BuyTicket, " Stop Level: " , StopLevel, " Freeze Level: " , FreezeLevel); Print(ErrLog); }//6 else {//7 ErrorCode = GetLastError(); string ErrDesc =ErrorDescription(ErrorCode); string ErrAlert = StringConcatenate("Initial Buy order failed", ErrorCode,": ", ErrDesc); Alert(ErrAlert); ErrLog = StringConcatenate("Ask: ",Ask, "Open Buy Price: ", OrderOpenPrice(), " Ticket: " , BuyTicket, " Stop Level: ", StopLevel," Freeze Level: ", FreezeLevel); Print(ErrLog); //Print("Order Send failed, error # ", GetLastError()); }//7 return(0); }//5
The error that I have in this moment is;
2013.03.27 09:06:36 '2089041584': modification of order #6468583 sell 0.04 EURUSDi at 1.28421 sl: 1.28393 tp: 1.27921 -> sl: 1.28392 tp: 1.27921 failed [Invalid parameters]
This has been take from the Journal tab and ea is running on a demo account.
From here what in your opinion should I go ?
Thank you in advance for support provide.
Luis
Good Morning RaptorUk,
So, now I've insert more information in error routine. My apologies for the method as I took it from examples found.
The error that I have in this moment is;
This has been take from the Journal tab and ea is running on a demo account.
Can you show the information you are printing, from the Expert tab or the log file in experts/logs
Hi RaptorUK,
Do you mean the file itself ?
From the Log
10:26:13 market_order_ecn_80_800_v7_v1 EURUSDi,M1: Ask: 1.279 Ticket: 6472213Sell Trailing: 1.279 Stop Loss: 1.2842 Stop Level: 0 Freeze Level: 0 10:26:14 market_order_ecn_80_800_v7_v1 EURUSDi,M1: Ask: 1.279 Ticket: 6472213Sell Trailing: 1.279 Stop Loss: 1.279 Stop Level: 0 Freeze Level: 0 10:26:14 market_order_ecn_80_800_v7_v1 EURUSDi,M1: modify #6472213 sell 0.04 EURUSDi at 1.27922 sl: 1.27897 tp: 1.27421 ok 10:26:14 market_order_ecn_80_800_v7_v1 EURUSDi,M1: Ask: 1.279 Ticket: 6472213Sell Trailing: 1.279 Stop Loss: 1.279 Stop Level: 0 Freeze Level: 0 10:26:14 market_order_ecn_80_800_v7_v1 EURUSDi,M1: Ask: 1.279 Ticket: 6472213Sell Trailing: 1.279 Stop Loss: 1.279 Stop Level: 0 Freeze Level: 0 10:26:14 market_order_ecn_80_800_v7_v1 EURUSDi,M1: modify #6472213 sell 0.04 EURUSDi at 1.27922 sl: 1.27894 tp: 1.27421 ok 10:26:14 market_order_ecn_80_800_v7_v1 EURUSDi,M1: Ask: 1.2789 Ticket: 6472213Sell Trailing: 1.2789 Stop Loss: 1.279 Stop Level: 0 Freeze Level: 0 10:26:14 market_order_ecn_80_800_v7_v1 EURUSDi,M1: Ask: 1.2789 Ticket: 6472213Sell Trailing: 1.2789 Stop Loss: 1.2789 Stop Level: 0 Freeze Level: 0 10:26:15 market_order_ecn_80_800_v7_v1 EURUSDi,M1: Ask: 1.2789 Ticket: 6472213Sell Trailing: 1.2789 Stop Loss: 1.2789 Stop Level: 0 Freeze Level: 0 <-------------------------- 10:26:16 market_order_ecn_80_800_v7_v1 EURUSDi,M1: modify #6472213 sell 0.04 EURUSDi at 1.27922 sl: 1.27893 tp: 1.27421 ok 10:26:16 market_order_ecn_80_800_v7_v1 EURUSDi,M1: Ask: 1.2789 Ticket: 6472213Sell Trailing: 1.2789 Stop Loss: 1.2789 Stop Level: 0 Freeze Level: 0 10:26:19 market_order_ecn_80_800_v7_v1 EURUSDi,M1: modify #6472213 sell 0.04 EURUSDi at 1.27922 sl: 1.27892 tp: 1.27421 ok 10:26:19 market_order_ecn_80_800_v7_v1 EURUSDi,M1: Ask: 1.2789 Ticket: 6472213Sell Trailing: 1.2789 Stop Loss: 1.2789 Stop Level: 0 Freeze Level: 0 10:26:20 market_order_ecn_80_800_v7_v1 EURUSDi,M1: modify #6472213 sell 0.04 EURUSDi at 1.27922 sl: 1.27891 tp: 1.27421 ok 10:26:20 market_order_ecn_80_800_v7_v1 EURUSDi,M1: Ask: 1.2789 Ticket: 6472213Sell Trailing: 1.2789 Stop Loss: 1.2789 Stop Level: 0 Freeze Level: 0 10:26:21 market_order_ecn_80_800_v7_v1 EURUSDi,M1: modify #6472213 sell 0.04 EURUSDi at 1.27922 sl: 1.27890 tp: 1.27421 ok 10:26:21 market_order_ecn_80_800_v7_v1 EURUSDi,M1: Ask: 1.2789 Ticket: 6472213Sell Trailing: 1.2789 Stop Loss: 1.2789 Stop Level: 0 Freeze Level: 0 10:26:21 market_order_ecn_80_800_v7_v1 EURUSDi,M1: modify #6472213 sell 0.04 EURUSDi at 1.27922 sl: 1.27889 tp: 1.27421 ok 10:26:21 market_order_ecn_80_800_v7_v1 EURUSDi,M1: Ask: 1.2789 Ticket: 6472213Sell Trailing: 1.2789 Stop Loss: 1.2789 Stop Level: 0 Freeze Level: 0
From the Journal tab
2013.03.27 10:26:16 '2089041584': modify order #6472213 sell 0.04 EURUSDi at 1.27922 sl: 1.27894 tp: 1.27421 -> sl: 1.27893 tp: 1.27421 2013.03.27 10:26:15 '2089041584': modification of order #6472213 sell 0.04 EURUSDi at 1.27922 sl: 1.27894 tp: 1.27421 -> sl: 1.27892 tp: 1.27421 failed [Invalid S/L or T/P]<---------------- 2013.03.27 10:26:15 '2089041584': modify order #6472213 sell 0.04 EURUSDi at 1.27922 sl: 1.27894 tp: 1.27421 -> sl: 1.27892 tp: 1.27421 2013.03.27 10:26:14 '2089041584': modification of order #6472213 sell 0.04 EURUSDi at 1.27922 sl: 1.27894 tp: 1.27421 -> sl: 1.27892 tp: 1.27421 failed [Invalid S/L or T/P] 2013.03.27 10:26:14 '2089041584': modify order #6472213 sell 0.04 EURUSDi at 1.27922 sl: 1.27894 tp: 1.27421 -> sl: 1.27892 tp: 1.27421
Hope that the above is the information you required....
Luis
Hi RaptorUK,
Do you mean the file itself ?
From the Log
From the Journal tab
The Journal tab is for when you are using the Strategy Tester, anything you print will show up in there . . . but make sure you aare looking at the correct Journal tab, not the one next to the Experts tab but the one next to the report tab under the Strategy tester sub-window. When you are running Live or Demo you need to look at the experts tab, there is where your print information goes . . . as well as the log file.
Your code above shows the mods you have made for the OrderSend() for a Buy order, did you do the same for a Sell order ? did you do similar for the OrderModify() for Buy and Sell ? I don't see an error number in the extract from the log that you posted. Also your prices only show 4 digits, you need to show all digits, use DoubleToString(Ask, Digits)
For example:
string ErrLog = StringConcatenate("Ask: ",DoubleToStr(Ask, Digits), "Open Buy Price: ", DoubleToStr(OrderOpenPrice(), Digits), " Ticket: ", BuyTicket, " Stop Level: " , StopLevel, " Freeze Level: " , FreezeLevel);
Maybe this is the issue . . .
Ask: 1.2789
sl: 1.27894 tp: 1.27421 -> sl: 1.27892 tp: 1.27421 failed [Invalid S/L or T/P]
Please show your code for the Sell OrderModify()
The Journal tab is for when you are using the Strategy Tester, anything you print will show up in there . . . but make sure you aare looking at the correct Journal tab, not the one next to the Experts tab but the one next to the report tab under the Strategy tester sub-window. When you are running Live or Demo you need to look at the experts tab, there is where your print information goes . . . as well as the log file.
Your code above shows the mods you have made for the OrderSend() for a Buy order, did you do the same for a Sell order ? did you do similar for the OrderModify() for Buy and Sell ? I don't see an error number in the extract from the log that you posted. Also your prices only show 4 digits, you need to show all digits, use DoubleToString(Ask, Digits)
For example:
Maybe this is the issue . . .
Ask: 1.2789
sl: 1.27894 tp: 1.27421 -> sl: 1.27892 tp: 1.27421 failed [Invalid S/L or T/P]
Please show your code for the Sell OrderModify()
Hi RaptorUk,
Now the ea is running and I've update the code per your advise.
As soon the error comes I come back.
Here is the code for order modify;
extern double StopLoss = 50.0; extern double TakeProfit = 50.0;
Spread = MarketInfo(Symbol(),MODE_SPREAD)*Point; StopLevel = MarketInfo(Symbol(),MODE_STOPLEVEL)*Point; FreezeLevel =MarketInfo(Symbol(),MODE_FREEZELEVEL)*Point; TickValue = MarketInfo(Symbol(),MODE_TICKVALUE); MinimumStop = StopLevel + Spread;
void AddLimitsBuy() { OrderSelect(BuyTicket,SELECT_BY_TICKET); // Calculate Stop Loss and Take Profit Limits if(StopLoss > 0)double BuyStopLoss = Ask - (StopLoss * pips2dbl); if(TakeProfit > 0)double BuyTakeProfit = Ask + (TakeProfit * pips2dbl); // Verify StopLoss Minimum Limits if(BuyStopLoss > 0 && BuyStopLoss < MinimumStop) { BuyStopLoss = MinimumStop; } // Buy Order Send Stop Loss and Take Profit if(IsTradeContextBusy()) Sleep(10); if(BuyStopLoss > 0 || BuyTakeProfit > 0) { RefreshRates(); if(!OrderModify(BuyTicket,Ask,BuyStopLoss,BuyTakeProfit,0)) ErrorCode = GetLastError(); string ErrDesc =ErrorDescription(ErrorCode); string ErrAlert = StringConcatenate("Add Limits Buy Failed ", ErrorCode,": ", ErrDesc); string ErrLog = StringConcatenate("Ask: ", DoubleToStr(Ask,Digits), "Ticket: ", BuyTicket, "Stop Level: " , StopLevel, "Freeze Level: ", FreezeLevel); Print(ErrLog); //Print("AddLimitsBuy Failed,order number:",OrderTicket(),"Error:",GetLastError()); } } //+------------------------------------------------------------------------------------------------------------------+ //Add limits after sent order (ECN Brokers) void AddLimitsSell() { OrderSelect(SellTicket,SELECT_BY_TICKET); // Calculate Stop Loss and Take Profit Limits if(StopLoss > 0) double SellStopLoss = Bid + (StopLoss * pips2dbl); if(TakeProfit > 0) double SellTakeProfit = Bid - (TakeProfit * pips2dbl); // Verify Stop Loss and Take Profit Minimum Limits if(SellStopLoss > 0 && SellStopLoss < MinimumStop) { double SellStopLevel = MinimumStop; } // Sell Order Send Stop loss and Take Profit if(IsTradeContextBusy()) Sleep(10); if(SellStopLoss > 0 || SellTakeProfit > 0) { RefreshRates(); if(!OrderModify(SellTicket,Bid,SellStopLoss,SellTakeProfit,0)) ErrorCode = GetLastError(); string ErrDesc =ErrorDescription(ErrorCode); string ErrAlert = StringConcatenate("Add Limits Sell Failed ", ErrorCode,": ", ErrDesc); string ErrLog = StringConcatenate("Bid: ", DoubleToStr(Bid,Digits)," Ticket: ", SellTicket," Stop Level: ", StopLevel," Freeze Level: ", FreezeLevel); Print(ErrLog); //Print("Add LimitsSell Failed,order number:",OrderTicket(),"Error:",GetLastError()); } } //+------------------------------------------------------------------+ //TrailingStop void Trail() {//0 int TrailingStop = 0.25 + StopLevel; double BuyTrailing = Bid - (TrailingStop * pips2dbl); double SellTrailing = Ask + (TrailingStop * pips2dbl); for(int OrderCounter = OrdersTotal()-1; OrderCounter >= 0; OrderCounter--) {//1 if(!OrderSelect(OrderCounter,SELECT_BY_POS))continue; if(OrderType()==OP_BUY && OrderSymbol()== Symbol()&& OrderMagicNumber()== MagicNumber) {//2 RefreshRates(); if(TotalOrderProfit > 0.1 && OrderStopLoss() < (Bid - TrailingStop * pips2dbl) && (Bid - OrderOpenPrice()) >= (MinimumProfit + TrailingStop) * pips2dbl) {//3 if(!OrderModify(OrderTicket(),OrderOpenPrice(),BuyTrailing, OrderTakeProfit(),0)) ErrorCode = GetLastError(); string ErrDesc =ErrorDescription(ErrorCode); string ErrAlert = StringConcatenate("Buy Trailing Stop Failed ", ErrorCode,": ", ErrDesc); string ErrLog = StringConcatenate("Bid: ", DoubleToStr(Bid,Digits)," Ticket: ", OrderTicket(), "Buy Trailing: ", BuyTrailing," Stop Loss: ", OrderStopLoss()," Stop Level: ", StopLevel," Freeze Level: ", FreezeLevel); Print(ErrLog); // Print("Buy TrailingStop Failed, error # ", GetLastError()); }//3 }//2 if(OrderType()==OP_SELL) {//4 RefreshRates(); if(TotalOrderProfit > 0.1 && OrderStopLoss() > (Ask + TrailingStop * pips2dbl)|| OrderStopLoss() < Point && (OrderOpenPrice() - Ask) >= (MinimumProfit + TrailingStop) * pips2dbl) {//5 if(!OrderModify(OrderTicket(),OrderOpenPrice(),SellTrailing,OrderTakeProfit(),0)) ErrorCode = GetLastError(); ErrDesc =ErrorDescription(ErrorCode); ErrAlert = StringConcatenate("Sell Trailing Stop Failed ", ErrorCode,": ", ErrDesc); ErrLog = StringConcatenate("Ask: ", DoubleToStr(Ask,Digits)," Ticket: ", OrderTicket(), "Sell Trailing: ", SellTrailing," Stop Loss: ", OrderStopLoss()," Stop Level: ", StopLevel," Freeze Level: ", FreezeLevel); Print(ErrLog); //Print("Sell TrailingStop Failed, error # ", GetLastError()); }//5 }//4 }//1 }//0
Thank you for your time
Luis
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all,
I'm testing the ea on a demo account and some times comes this error on Journal tab;
14:30:02 '2089041584': modification of order #6413070 sell 0.04 EURUSDi at 1.29077 sl: 1.29039 tp: 1.28584 -> sl: 1.29038 tp: 1.28584 failed [Invalid parameters]
Any suggestions how to avoid this '
Thank you in advance
Luis