Allowing for STOP LEVEL
-
I have a problem which I'm hoping someone can help me solve.
I created an EA which places a pending order above the high of the previous candle with a price offset of 3 pips (LONG).
However, I'm getting a few error codes on MT4 (130: invalid SL or TP).
I also trade some of the exotics (e.g USDSEK) and the error rate is much higher - which I assume is based on the higher spread.
After doing a lot of research I think the problem is based on the actual STOP LEVEL (min. distance allowed between current price & entry) of the market being traded.Is there some simple way around this - apart from changing the price offset for each market traded?
Thanks in advance for your help. -
@amadablam Can you please share the link to the project? Maybe there is something missing there.
-
@amadablam MarketInfo(0,MODE_STOPLEVEL); This code in a modify variables block should give you the minimum stop loss, before placing an order check the SL distance is far enough away, otherwise use this number for the stoploss.
-
Thanks @l-andorrà & @jstap for your responses.
Here is the link to the project:
https://fxdreema.com/shared/8wAI3eyveThis project is based on a SMA crossover.
When I talk of STOPS LEVEL (as per my original post) I am not talking of stop loss.
Stop Level is set for each market (I assume by the broker) and can be found in MT4 'Market Watch', then right click a market, 'Specification'.
My understanding is this is the minimum distance permitted between current price & entry price (and SL??) for a pending order.
This becomes a problem when prices closes near the top of the previous candle (LONG), especially when trading exotics (the stop levels can be significantly higher).Thanks
-
@amadablam These are set by broker, used IG to trade but they have minimum distances, doesn't affect certain strategies but some it does Spread will affect the open price and only pending can be affected my a minimum distance to place, you may be as well putting a spread filter in, this may stop trades being placed when it doesn't suit.