I have searched the forums but can't seem to get the answer I am looking for.
What I want to do is Buy on a signal with a stop at low of previous bar. After each bar, I want to move the stop to the low of previous bar.
So buy today with stop of yesterday's low.
Tomorrow (assuming I am still long) move stop to previous day's low. And keep doing this as long as I am in position.
What is the best way to approach this?
SetOption("AllowSameBarExit",0); // Don't allow same day exit
SetTradeDelays(0,0,0,0); // Set trade delays,
Buy = C > EMA(C,20); // random buy entry example
Sell = L < Ref(L,-1); // Sell signal if price crosses yesterday's low
SellPrice = IIf(Open < Ref(L,-1), Open, Ref(Low,-1));// If price gaps below previous days low,
// Sell = Open value, else it = yesterday's low,
This is how I'd code it up. Probably a better way to write it. Sure someone else chime in.