I am trying to add a sell signal if a moving average cross occurs within the first 10 bars following buy signal. Then Sell on the 10th bar.
I researched the forum and found HighestSince and HHV but can't seem to pinpoint how best to achieve my goal.
A couple attempts at coding this:
MAexit = Cross (MA(Close, 30), MA(Close,10)); Sell = HighestSince (Buy, MAexit, 10)>0;
I don't think the highest since "nth 10" is correct here.
OR another attempt:
MAexit = Cross (MA(Close, 30), MA(Close,10)); Sell = HHV(MAexit, 10)>0;
but this wouldn't give me the 10 bar lockout after Buy that I am looking for.
Any advice would be greatly appreciated. Thanks in advance!