I want to compare various potential exit points for positions from previous days. For instance, I would like to know the price at which a stock first crossed below a moving average, such as SMA 10, in each of the past 4 trading days. I would also want the same for an exponential moving average. Ideally, I could store the SMA in one 5-minute column and the EMA in another. To collect history, I would update and export the watchlist for each of the ten days.
I can collect this data for the current day, but I'm unable to retrieve data from previous days using:
If today were Friday, I would like to use the watchlist to separately collect Mon, Tues, Wed, and Thurs.
I can collect this data for the current day, but I'm unable to retrieve data from previous days using:
Code:
Def OpeningBell = 930;
Def ClosingBell = 1600;
Def FloorIsOpen = SecondsFromTime(OpeningBell) >= 0 and SecondsTill(ClosingBell) >=0;
Def SMA10 = SimpleMovingAvg(Close,10);
Def XOver= if !FloorIsOpen then 0 else if XOver[1] == 0 and Crosses(Close,SMA10,CrossingDirection.below) then Close else XOver[1];
Plot X = XOver;
If today were Friday, I would like to use the watchlist to separately collect Mon, Tues, Wed, and Thurs.