double StopLoss=Low-Atr[1]*MultipleStopLoss; double TakeProfit=Low+Atr[1]*MultipleTakeProfit;
SL and TP should be related to the open price not a Low.
The TP is probably below the open price. You should check this before trying to open an order.
Keith Watford #:
SL and TP should be related to the open price not a Low.
The TP is probably below the open price. You should check this before trying to open an order.
I already tried my friend, thanks for your help but still not working, I also tried using SynmbolInfoDouble function to give me the current price but nothing.
This only works if I use the default tp and sl values without ATR calculation...
double StopLoss=SymbolInfoDouble(_Symbol,SYMBOL_ASK)-Atr[1]*MultipleStopLoss; double TakeProfit=SymbolInfoDouble(_Symbol,SYMBOL_ASK)+Atr[1]*MultipleTakeProfit; // This variant does not work double StopLoss=SymbolInfoDouble(_Symbol,SYMBOL_ASK)-1000*_Point; double TakeProfit=SymbolInfoDouble(_Symbol,SYMBOL_ASK)+1000*_Point; // If I use the classic value points, it works
These are the two variants i tried, only the second one works.
I assure you that the first calculation with ATR on CFDs always worked...
This thing makes you laugh because the calculation is right.
The stop level calculates it correctly and it is exactly the level I want.
But he still doesn't accept it.
Hi Claudio. Did you get this resolved? I have the same issue. I have an EA with an ATR based stoploss that works beautifully with CFDs. I try it on Futures and get "invalid stops". When I have my EA print the price levels, everything looks good and I can't think of why it won't take the trade. What's more confusing is that sometimes it takes the trade, most of the time it won't.
Theo H. #:
Hi Claudio. Did you get this resolved? I have the same issue. I have an EA with an ATR based stoploss that works beautifully with CFDs. I try it on Futures and get "invalid stops". When I have my EA print the price levels, everything looks good and I can't think of why it won't take the trade. What's more confusing is that sometimes it takes the trade, most of the time it won't.
Hi Claudio. Did you get this resolved? I have the same issue. I have an EA with an ATR based stoploss that works beautifully with CFDs. I try it on Futures and get "invalid stops". When I have my EA print the price levels, everything looks good and I can't think of why it won't take the trade. What's more confusing is that sometimes it takes the trade, most of the time it won't.
My guess here would be to check the freeze levels of the symbol, as they might get in your way.
Search the mql site for "Checks an EA must pass" and see if you fulfill all requirements. It will most probably guide you to the solution for your problem.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Hello everyone and I wish you a merry Christmas. I have a serious problem in my trading system. The problem is error 10016. Premise I assure you that this code, even if it is incomplete (sorry it would be too long) works 100% in CFDs, everything changes with futures.
This EA bases the take profit and stop loss calculation based on the ATR indicator.
My question is why the broker accepts orders on CFDs and while in futures it gives me "stop loss invalid"?
How can I solve the problem (if it can be solved) by using equal calculation of TP and SL with ATR like in CFDs?
Thank you very much whoever wants to answer.