Problem: Crossing condition does not work in live trading - although everything runs smoothly in the simulation
Hello,
i hope you can help me because i have a strange problem, my idea is to open a buy order whenever the ADX value is greater
than a preset ADX value and the D+ value crosses the D- value of the ADX. This works fine in the simulation, but not in the live account. I do
not even get an error message. But it is interesting, if I change the entry condition and change it in such a way that the D+ (the green
curve) is above the D- (red) curve, then the Buy Trade
Order in connection with the preset ADX value works perfectly.
What is the problem?
I'm
posting my source code:
I am really very grateful for any help.
Best regards
Paul
Since you're checking once per bar, you should compare indicator values of bars 1 and 2, not 0 and 1.
- PS-WW-Trader: buy order whenever the ADX value is greater than a preset ADX value and the D+ value crosses the D- value of the ADX.
if( (ADXWert>=setADX) && ((ArrayDpl[0] > ArrayDmi[0]) && (ArrayDpl[1] <= ArrayDmi[1]))) //Crossing condition is commented out
Both conditions must occur on the same bar (1) no trade otherwise. I suggest
- You are looking at a signal. Act on a change of signal. (ADX above.)
MQL4 (in Strategy Tester) - double testing of entry conditions - Strategy Tester - Expert Advisors and Automated Trading - MQL5 programming forum #1 - Don't use the crossover as part of the signal, use them only to determine the trade direction.
- You are looking at a signal. Act on a change of signal. (ADX above.)
-
input int StopLoss=30; input int TakeProfit=20; ⋮ SL = SL*10; TP = TP*10;
Inputs can't be modified.
Language Basics / Variables / Input Variables - Reference on algorithmic/automated trading language for MetaTrader 5
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
i hope you can help me because i have a strange problem, my idea is to open a buy order whenever the ADX value is greater than a preset ADX value and the D+ value crosses the D- value of the ADX. This works fine in the simulation, but not in the live account. I do not even get an error message. But it is interesting, if I change the entry condition and change it in such a way that the D+ (the green curve) is above the D- (red) curve, then the Buy Trade Order in connection with the preset ADX value works perfectly.
What is the problem?
I'm posting my source code:
I am really very grateful for any help.
Best regards
Paul