Hey guys, apologies if this has been asked before. I am new, I've tried reading the forums and AFL guide but I still don't understand what is happening with my formula.
My issue is that my buy and sell conditions aren't doing what I want them to do. I am trying to buy new all time highs and then will run a trailing stop being once price closes below the 10day moving average it is a sell.
When I backtest my code, I notice when bringing up the signals on the chart that my buy signal isn't accurate and just buys and sells everyday underneath the 10ma.
In my coding, I usually just try to define all my variables as condition 1, condition 2 etc and then buy would be equal to condition1 AND 2 etc. and same for sell. I am not sure if this is the best way to go about my signals.
example code below I am having issues with.
Any help would be appreciated,
Cheers - Brad
Condition1 = Highest(Close);
Condition2 = C < MA(C,10);
Buy = Condition1;
Sell = Condition2;