I am working on a simple strategy which will place an order when price breaks a previous low, or high.
Considering the example for when price breaks a previous low, I want to be able to set my stop loss to the price of the highest bar between the previous low and the current bar which breaks below the value of the previous low. The trade will exit when price closes above the value of the stop loss.
I have looked at the Ninjascript guidance for HighestBar() but I'm unsure how I can apply it.to a range. How do I constrain the HighestBar() search to the bar of the previous low and the current bar which breaks below the value of the previous low? Is there a way I can do this in time i.e set the time of the bar which makes the previous low into a user variable and set the time of the current bar which breaks the previous low into a second user variable then run the HighestBar() search between those time points?
Thanks in advance for your help.
Neil
Comment