I have a study that draws horizontal lines for a given range. I'd like to plot a simple horizontal line at the high and low 30seconds after the input time. I am familiar with how to set times and plots.
Any input? This plots at the high and low of the first minute, but struggling to capture this time range in seconds.
Any input? This plots at the high and low of the first minute, but struggling to capture this time range in seconds.
Code:
input openingRangeStartTimeEST = 900;
input openingRangeEndTimeEST = 901;
def openingRange = if SecondsTillTime(openingRangeStartTimeEST) <= 0 and SecondsTillTime(openingRangeEndTimeEST) >= 30 then 1 else 0;
def openingRangeHigh = if SecondsTillTime(openingRangeStartTimeEST) == 0 then high else if openingRange and high > openingRangeHigh[1] then high else openingRangeHigh[1];
def openingRangeLow = if SecondsTillTime(openingRangeStartTimeEST) == 0 then low else if openingRange and low < openingRangeLow[1] then low else openingRangeLow[1];
OR30secStartTimeEST = openingRangeStartTimeEST;
input OR30secEndTimeEST = 1000;
def OR30secRange = if SecondsTillTime(OR30secStartTimeEST) <= 0 and SecondsTillTime(OR30secEndTimeEST) >=0 then 1 else 0;
plot OR30secHighExtension = if OR30secRange then openingRangeHigh else double.nan;
plot OR30secLowExtension = if OR30secRange then openingRangeLow else double.nan;
OR30secHighExtension.setPaintingStrategy(PaintingStrategy.Horizontal);
OR30secLowExtension.setPaintingStrategy(PaintingStrategy.Horizontal);
OR30secHighExtension.setStyle(Curve.Short_Dash);
OR30secLowExtension.setStyle(Curve.Short_Dash);
OR30secHighExtension.setDefaultColor(Color.LIGHT_GREEN);
OR30secLowExtension.setDefaultColor(Color.LIGHT_RED);