What happens if I use a negative SL at PositionOpen? (the order is sent anyway? It goes with a zero SL?)
There is no such thing as a negative or zero stop loss. You either have a SL some pips away from your opening position or you don’t.
The SL level is always lower from the opening price if its a buy position or higher if its a sell position
Hi, Thanks for the reply
I mean while coding.
What happens if an error occurs and the value of “Stop Loss price” is a negative number?
For example SL = price - 10*ATR . And I am not checking if 10 times ATR is bigger then price
Why do not you check it out in the code? For example this is code for negative SL
CTrade Trade; ENUM_ORDER_TYPE otype = ORDER_TYPE_BUY_LIMIT; double price = SymbolInfoDouble(_Symbol, SYMBOL_ASK) - 0.02; if(Trade.OrderOpen(_Symbol, otype, Lot, 0, price, -0.22, 0, ORDER_TIME_SPECIFIED, TimeCurrent() + 3*60, "TestSpeed"))
2017.02.07 15:19:27.207 TestSpeedTradeFunctions (EURUSD,M15) CTrade::OrderSend: buy limit 0.10 EURUSD at 1.04804 sl: -0.22000 [invalid stops]
2017.02.07 15:19:27.206 Trades ‘912389’: failed buy limit 0.10 EURUSD at 1.04804 sl: -0.22000 [Invalid stops]
Thank you for the help
Actually this problem is not accruing. But it is possible
Now I know I should check it