Error 145 Trade Server Return Code To add comments, please log in or register

 

Hi, while in strategy tester I Try to modify my stop loss and I get error 145 (short position). I can not explain the reason why because the Stoplevel is 10 pips, my TS is 39 pips and the SL-Ask=48 pips > than 10 (the stop level)

The position at hand is a short position!

2014.03.01 13:53:05.343 2013.03.04 00:37 Gaptrading GBPJPY,H1: OrderModify error 145
2014.03.01 13:53:05.343 2013.03.04 00:37 Gaptrading GBPJPY,H1: Selltrailing: Error in OrderModify. Error code= 145, SL-Ask= 0.48, Stoplevel= 10, Freezelevel= 10Orderstoploss= 140.94Ask= 140.46


Can anyone give a clue why is this happening?

Thnx
 
kei2tahn: Can anyone give a clue why is this happening?

There are no mind readers here.

We can't believe you when you say 48 pips as you may not understand the a pip is not a point on a 3/5 digit broker.

Why didn't you post the actual prices, to full resolution, so we'd know you got the signs right? (Ask by itself isn't helpful.)

string   PriceToStr(double p){   return( DoubleToStr(p, Digits) );            }

Why didn't you post the code, both the modify and your print statements, and the actual output? Summarizing isn't helpful as you may be hiding the truth by your misunderstanding.

 

WHRoeder thatnk you for your answer and your time. I fully understand that a pip might differ in size, that's why i use MarketInfo(Symbol(), MODE_TICKSIZE) and that's why i know that 48 pips is 0.48 in the GBPJPY which is the case at hand.

Here is the order modify code: OrderModify(trailticket,OrderOpenPrice(),Ask+trailminimumstoploss,OrderTakeProfit(),0,Yellow);

and this is my Print code in case of an error:Print("Selltrailing: Error in OrderModify. Error code= ",GetLastError(), ", SL-Ask= ",NormalizeDouble(OrderStopLoss(),Digits)-Ask, ", Stoplevel= ", MarketInfo(Symbol(), MODE_STOPLEVEL), ", Freezelevel= ", MarketInfo(Symbol(), MODE_FREEZELEVEL), "Orderstoploss= ", OrderStopLoss(), "Ask= ", Ask );


Ask by definition is double so I believe that the print function returns the Ask price in its full length.

 
kei2tahn:

WHRoeder thatnk you for your answer and your time. I fully understand that a pip might differ in size, that's why i use MarketInfo(Symbol(), MODE_TICKSIZE) and that's why i know that 48 pips is 0.48 in the GBPJPY which is the case at hand.

Here is the order modify code: OrderModify(trailticket,OrderOpenPrice(),Ask+trailminimumstoploss,OrderTakeProfit(),0,Yellow);

and this is my Print code in case of an error:Print("Selltrailing: Error in OrderModify. Error code= ",GetLastError(), ", SL-Ask= ",NormalizeDouble(OrderStopLoss(),Digits)-Ask, ", Stoplevel= ", MarketInfo(Symbol(), MODE_STOPLEVEL), ", Freezelevel= ", MarketInfo(Symbol(), MODE_FREEZELEVEL), "Orderstoploss= ", OrderStopLoss(), "Ask= ", Ask );

Ask by definition is double so I believe that the print function returns the Ask price in its full length.

  1. On currencies TICKSIZE is the same a Point and neither are the same as a pip on a 3/5 digit broker. On metals they can be different.
  2. 0.48 is 48 pips on JPY. Agreed and irrelevant. Why do we care about the current SL value being 48 pips higher? We still don't know weither you are on a 3/5 digit broker. Ask= 140.46 doesn't tell us since the price at that moment could have been 140.460 (3 digits.)
  3. SL-Ask is irrelevant to your problem, we need to know the NEW value (Ask+trailminimumstoploss.)
  4. trailminimumstoploss is meaningless. We need to know the value.
  5. Pre-build 600 Print output up to 4 digits not full length and you didn't haven't specified.
  6. Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is always wrong
 

same ordermodify: OrderModify(trailticket,OrderOpenPrice(),Ask+trailminimumstoploss,OrderTakeProfit(),0,Yellow);

printing code: Print("Selltrailing: Error in OrderModify. Error code= ",GetLastError(),"trailingminimumstoploss= ", trailminimumstoploss, ", Ask+ trailingminimumstoploss= ", Ask+trailminimumstoploss, ", Stoplevel= ", MarketInfo(Symbol(), MODE_STOPLEVEL), ", Freezelevel= ", MarketInfo(Symbol(), MODE_FREEZELEVEL), "Orderstoploss= ", OrderStopLoss(), "Ask= ", Ask );

output message in tester: 2014.03.01 20:47:22.953 2013.03.04 00:37 Gaptrading GBPJPY,H1: Selltrailing: Error in OrderModify. Error code= 145trailingminimumstoploss= 0.39, Ask+ trailingminimumstoploss= 140.85, Stoplevel= 10, Freezelevel= 10Orderstoploss= 140.94Ask= 140.46


I run the strategy tester as you wanted. I hope that this is more helpful!

 
It would be more helpful to give more information (such as full resolution of actual prices for OpenPrice, StoplossPrice, TakeprofitPrice, Ask, Bid, etc). With that said, you might think about the Ask being too close to your TakeProfit price. Review the Requirements and Limitations in Making Trades (while the Book was for <=b509, I suspect that this section also applies to >=b600). That section states that trade operations can only be performed on a sell trade if (a) SL-Ask >= StopLevel or Ask-TP >= StopLevel or (b) SL-Ask > FreezeLevel or Ask-TP > FreezeLevel.
 
ok i found the problem! it was the Ask-TP>= StopLevel but my brain had stuck because i thought that if you dont want to modify the TP but only the SL it does matter the Ask-TP >= StopLevel clause. But it does!! Thank you guys!!! You really helped me!!
Reason: