As iCustom, we don't know what it is expected to return, showing more code for advice would help..
Hi everyone, I've a strategy using a supertrend indicator. This supertrend indicator have 2 buffer which is supertrend up and supertrend down.
When using code above EA doesn't open any position, I don't know if it's because of the code or because I'm using EMPTY_VALUE for open a trade position. Is using EMPTY_VALUE on this condition is incorrect?
Do not use EMPTY_VALUE in Expert. Because Buffers returning from the indicator returns a value. EMPTY_VALUE value is 2147483647.
It can work if you edit the code like this.
Print(EMPTY_VALUE); if(supertrendUP(shift+1)==2147483647 && supertrendUP(shift)!=2147483647) // >>>> OPEN BUY POSITION if(supertrendDOWN(shift+1)==2147483647 && supertrendDOWN(shift)!=2147483647 //>>>> OPEN SELL POSITION
As iCustom, we don't know what it is expected to return, showing more code for advice would help..
It's a condition to open a position. The indicator consist only 2 buffer which is up and down. I want to open a condition when the indicator changing from supertrend down to supertrend up.
Do not use EMPTY_VALUE in Expert. Because Buffers returning from the indicator returns a value. EMPTY_VALUE value is 2147483647.
It can work if you edit the code like this.
I change it to 2147483647 and still the problem still occur. btw between using number and EMPTY_VALUE resulting the same.
- You absolutely should use the proper symbol (EMPTY_VALUE) rather than that 2147483647 which is wrong for MT5.
- Capture and print your variables or use the debugger, and find out why.
-
Don't double post! You already had this thread open.
General rules and best pratices of the Forum. - General - MQL5 programming forum (2017) - The indicator you posted in the other thread does not use EMPTY_VALUE. The previous value equals the opposite side. Just use:
bool isUpTrend = supertrendUP(shift) < supertrendUP(shift+1);
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi everyone, I've a strategy using a supertrend indicator. This supertrend indicator have 2 buffer which is supertrend up and supertrend down.
When using code above EA doesn't open any position, I don't know if it's because of the code or because I'm using EMPTY_VALUE for open a trade position. Is using EMPTY_VALUE on this condition is incorrect?