How to correct this code?


Buy =   Cross( Close, EMA(Close, 10) ) AND C < Ref(C,4);  
Sell =  Cross( EMA(Close, 10), Close)  AND C  > Ref(C,4);

What's wrong with the code?

1 Like

First you need to tell what results you want to achieve. We cant divine it for you.

1 Like

@BARASARA While I agree with @travick and @GustavTrader suggestions, I would also suggest reading about the Ref(ARRAY, period) function, https://www.amibroker.com/guide/afl/ref.html

Your current formula is looking into the future, is that what you intended?

2 Likes