I am new to AFL programming hence seeking your help/advice my strategy.
I have collected publicly available Supertrend and Choppiness indicator and used it for strategy.
Idea is to go long if Supertrend is showing long and choppiness is less than 40 and go to sell if Supertrend is showing sell and choppiness is less than 40. This condition is working perfectly however i have challenges in short and cover conditions.
In my exit conditions i have added below mentioned lines
Cp_short = Close > st OR Cross (Chop, 70); // Either Supretrend changed the direction or choppiness crossed 70
Cp_cover = Close < st OR Cross (Chop, 70); // Either Supretrend changed the direction or choppiness crossed 70
The short and cover conditions are not working as expected, i just need to exit only if i supertrend already showed buy or sell (could be some bars back), and then choppiness crosses above 70.
Thanks in advance.