manucaaa:
hi guys . I made an ea that in backtest does good , but when I trade it on a live account it say invalid stop. why? (backtest made on realtick)
thanks
Forum on trading, automated trading systems and testing trading strategies
Unable to place order because of invalid stops
Automated-Trading, 2013.10.23 17:13
1. Use ZeroMemory before preparing MqlTradeRequest structure.
2. Calculate TP/SL levels relative to Bid/Ask levels.
void OnStart() { //--- MqlTradeRequest request; MqlTradeResult result; ZeroMemory(request); request.symbol =Symbol(); request.volume =0.1; request.deviation =1; request.type_filling=ORDER_FILLING_FOK; request.action=TRADE_ACTION_DEAL; double askPrice = SymbolInfoDouble(Symbol(),SYMBOL_ASK); double bidPrice = SymbolInfoDouble(Symbol(),SYMBOL_BID); long stopLevels=SymbolInfoInteger(Symbol(),SYMBOL_TRADE_STOPS_LEVEL); request.type = ORDER_TYPE_BUY; request.sl = NormalizeDouble(bidPrice - stopLevels * Point(),_Digits); request.tp = NormalizeDouble(askPrice + stopLevels * Point(),_Digits); request.price= askPrice; if (!OrderSend(request,result)) {Print("Error=", GetLastError());} }

Documentation on MQL5: Standard Library / Trade Classes / CSymbolInfo / FreezeLevel
- www.mql5.com
Gets the freeze level (in points). Return Value Distance of freeze level (in points). Note The symbol should be selected by Name method. ...

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
hi guys . I made an ea that in backtest does good , but when I trade it on a live account it say invalid stop. why? (backtest made on realtick)
thanks