Using 'HighestSince'

Hi, I want to run a backtest using 'HighestSince' as my sell parameter.

Specifically, I want an open position to be sold if it closes under the highest value for 'exitLevel' (defined below).

This is what I attempted to use-

atrVal = ATR( 10 );

exitLevel = Ref( Close - 3.00 * atrVal, -1 );

Sell = Cross( Highestsince (exitLevel, Close, 1 ));

I'm getting an 'error 17 missing arguments'

I am not good at coding (obviously). Please respond like I am 6 years old.

I did not include all of the code for the backtest, as the rest seems to run fine.

Any help you can provide is greatly appreciated!

The first argument for the HighestSince() function is an expression that evaluates to True or False. It's the event that marks the start of your search. Also, the Cross() function requires two arguments, which is why you're getting the error message that you are.

Assuming that the exit is based on the most recent Buy signal (which may NOT be a valid assumption), you could use something like this:

Sell = Cross (HighestSince(Buy, exitLevel), Close);

The HighestSince function will find the greatest value of exitLevel since a Buy signal occurred. The Cross function will look for that value to cross above the Close, i.e. the Close to cross below the exitLevel.


Matt, thank you very much for your response and information. Will review this weekend, but makes sense!
Thanks again!