Imagine after a decent up move, that the stop doesn't trail by ticks or percentage, but by the lows of the bars. In essence, this will continue to trail a long position until a truly new low is made.
In this case, lets say 5 bars...
So I'd want the stop to be the lowest low of the last 5 bars (minus a tick). Here's what I've come up with so far, but it doesn't seem to work at all during strategy testing. As a test, I just use a 2/3 period moving average for entries, so I can test the stop. However, it seems the only exits are the new entries in the other direction...
So this is what I have as an idea so far:
VARS:
private int barsAgo = 5;
OBU:
int LoBar = LowestBar(Low, barsAgo);
int HiBar = HighestBar(High, barsAgo);
if(Position.MarketPosition == MarketPosition.Long)
{
SetStopLoss(CalculationMode.Ticks, Low[LoBar] - 1*TickSize);
}
Thanks for your help ahead of time.
Comment