Dear all,
my EA frequently reports "OrderSend Error 130" during backtest. The code snippnet is as follow:
I searched via google and modified my code(especially the 1st statement in the above code). But the problem remained. How should I enhance my code? Thanks a lot for your time and consideration, and, your prompt reply.
What is the point of the ret variable if you are not going to use it ?
Read this: What are Function return values ? How do I use them ?
Maybe your SL is too close to Bid ? does your trade comply with this ? Requirements and Limitations in Making Trades
You don't need to Normalize a price based on price values taken from a combination of OHLC or point.
What is the point of the ret variable if you are not going to use it ?
Read this: What are Function return values ? How do I use them ?
Maybe your SL is too close to Bid ? does your trade comply with this ? Requirements and Limitations in Making Trades
You don't need to Normalize a price based on price values taken from a combination of OHLC or point.
Bid - STOPLOSSPrice > marketinfo(symbol(),MODE_STOPLEVEL)* Point
if so, the first statment in the original question has already ensured the above condition to be met. Anything else is wrong?
Regards and best wishes.
Bid - STOPLOSSPrice > marketinfo(symbol(),MODE_STOPLEVEL)* Point
if so, the first statment in the original question has already ensured the above condition to be met. Anything else is wrong?
Regards and best wishes.
Below is what printed in the log:
ordersend error:130 Moving Average01 EURUSD,M15: Bid=1.2461SLevel=20slprice=1.2453Point=0.000010
The code used to print the message is as follows, hopefully it's useful....
slprice=High[iHighest(sym,tfforSL,MODE_HIGH,10,1)]+40*Point;
ret=OrderSend(sym,OP_SELL,LotsOptimized(),Bid,3,slprice,0,"",MAGICMA,0,Red); if(ret<0){ Print("ordersend error:",GetLastError()); Print("Bid=",Bid,"SLevel=",MarketInfo(sym, MODE_STOPLEVEL), "slprice=",slprice,"Point=",DoubleToStr(Point,6)); }
Below is what printed in the log:
So this is an OP_SELL . . . you checked the Requirements and Limitations in Making Trades and found that Bid - STOPLOSSPrice > marketinfo(symbol(),MODE_STOPLEVEL)* Point but that is for a BUY.
For a SELL SL-Ask ≥ StopLevel so 1.2453 - Ask will not be greater than 20 points , how do I know ? well your Bid is 1.2461 your Ask will be above this so 1.2453 - Ask will give a negative number.
Dear RaptorUK,
At last, I get your point. Thank you so much!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear all,
my EA frequently reports "OrderSend Error 130" during backtest. The code snippnet is as follow:
I searched via google and modified my code(especially the 1st statement in the above code). But the problem remained. How should I enhance my code? Thanks a lot for your time and consideration, and, your prompt reply.