nicktrader
New member
Looking for the correct TOS code to plot a trendline for the opening price based on premarket data (candle) starting at 4AM EST (0400). I have some code to plot the line, but Im having trouble with just plotting it for the current day only (not any prior days). I know my code is probably all messed up.. but it gives an idea.
Any assistance would be greatly appreciated. Thank You!! @BenTen
Code:
input openingPMTime = 0400.0; #hint OrMeanS: Begin Mean Period. Usually Market Open EST.
input openingTime = 0930.0; #hint OrMeanS: Begin Mean Period. Usually Market Open EST.
def isDaily = If (GetAggregationPeriod() == AggregationPeriod.DAY, yes, no);
def isToday = If (GetDay() == GetLastDay() and SecondsFromTime(openingPMTime) >= 0, yes, no);
def isPreMarket = If (GetDay() == GetLastDay() and SecondsTillTime(openingPMTime) < 0, yes, no);
input pricePMOpen = open;
rec time_value = if(SecondsTillTime(openingPMTime) == 0, pricePMOpen, time_value[1]);
plot plotPMOpenLine = if(time_value == 0 and isToday, double.nan, time_value);
plotPMOpenLine.SetDefaultColor(color.yellow);
Any assistance would be greatly appreciated. Thank You!! @BenTen