I have been studying the the code for the jolly roger ea and have a few questions....
1. Why is "StopLevel" used to modify the request.price?
2. In back testing "SYMBOL_TRADE_STOPS_LEVEL" always equals zero, is this an error or is this information not available in the strategy tester?
A zero value of MODE_STOPLEVEL means either absence of any restrictions on
the minimal distance for Stop Loss/Take Profit
For me, if the stop level value = zero, I should use the distance (Ask-Bid+1Point) or SymbolInfoInteger SYMBOL_SPREAD+1
because if there is no distance, usually occurs the error 129 or error 130.
Because there must be a distance between the Ask or Bid price with price of the pending order.
A zero value of MODE_STOPLEVEL means either absence of any restrictions on
the minimal distance for Stop Loss/Take Profit
For me, if the stop level value = zero, I should use the distance (Ask-Bid+1Point) or SymbolInfoInteger SYMBOL_SPREAD+1
because if there is no distance, usually occurs the error 129 or error 130.
That's not exact. If stoplevel is 0 you don't need any distance. If your broker don't accept it (error) while Stoplevel is 0 then change your broker, it's not reliable.
See http://book.mql4.com/appendix/limits (also valid for mql5).
- book.mql4.com
Above code is mql5, there is no MODE_STOPLEVEL.
That's not exact. If stoplevel is 0 you don't need any distance. If your broker don't accept it (error) while Stoplevel is 0 then change your broker, it's not reliable.
See http://book.mql4.com/appendix/limits (also valid for mql5).
If after 2 hours the command is not executed then I want to close it. What I have to do StopLevel=SymbolInfoInteger(Symbol(),SYMBOL_TRADE_STOPS_LEVEL); //--- set orders if(PositionsTotal()<1 && OrdersTotal()<1) { if(rsiVal[1]<RSILevel && Ask>rates[0].low) { request.action = TRADE_ACTION_PENDING; request.symbol = _Symbol; request.volume = NormalizeDouble(volume(),2); request.price=NormalizeDouble(Ask+StopLevel*_Point,_Digits); request.sl = NormalizeDouble(request.price - SL*_Point,_Digits); request.tp = NormalizeDouble(request.price + TP*_Point,_Digits); request.deviation=0; request.type=ORDER_TYPE_BUY_STOP; request.type_filling=ORDER_FILLING_FOK; } if(rsiVal[1]>100-RSILevel && Bid<rates[0].high) { request.action = TRADE_ACTION_PENDING; request.symbol = _Symbol; request.volume = NormalizeDouble(volume(),2); request.price=NormalizeDouble(Bid-StopLevel*_Point,_Digits); request.sl = NormalizeDouble(request.price + SL*_Point,_Digits); request.tp = NormalizeDouble(request.price - TP*_Point,_Digits); request.deviation=0; request.type=ORDER_TYPE_SELL_STOP; request.type_filling=ORDER_FILLING_FOK; } }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have been studying the the code for the jolly roger ea and have a few questions....
1. Why is "StopLevel" used to modify the request.price?
2. In back testing "SYMBOL_TRADE_STOPS_LEVEL" always equals zero, is this an error or is this information not available in the strategy tester?