How do I get a script made
Last 5 bars after 9:30am with horizontal line at high and low of 5th bar only.
# Custom days back input and custom aggregation input.
declare lower;
input daysBack = 5;
input aggregationPeriod = AggregationPeriod.FIFTEEN_MIN;
def barNumber = BarNumber();
def aggregationFactor = GetAggregationPeriod();
def validBars = if (GetDay() != GetLastDay() and SecondsFromTime(0930) >= 0) then 1 else 0;
def lastFiveBars = if (barNumber >= (HighestAll(if validBars then barNumber else 0) - daysBack) and barNumber <= HighestAll(if validBars then barNumber else 0)) then 1 else 0;
def highOfLastBar = Highest(high[1], 5);
def lowOfLastBar = Lowest(low[1], 5);
plot HighLine = if lastFiveBars and barNumber == HighestAll(if lastFiveBars then barNumber else 0) then highOfLastBar else Double.NaN;
plot LowLine = if lastFiveBars and barNumber == HighestAll(if lastFiveBars then barNumber else 0) then lowOfLastBar else Double.NaN;
HighLine.SetDefaultColor(Color.GREEN);
LowLine.SetDefaultColor(Color.RED);
Script above won't show
how do I get lines to show
Last 5 bars after 9:30am with horizontal line at high and low of 5th bar only.
# Custom days back input and custom aggregation input.
declare lower;
input daysBack = 5;
input aggregationPeriod = AggregationPeriod.FIFTEEN_MIN;
def barNumber = BarNumber();
def aggregationFactor = GetAggregationPeriod();
def validBars = if (GetDay() != GetLastDay() and SecondsFromTime(0930) >= 0) then 1 else 0;
def lastFiveBars = if (barNumber >= (HighestAll(if validBars then barNumber else 0) - daysBack) and barNumber <= HighestAll(if validBars then barNumber else 0)) then 1 else 0;
def highOfLastBar = Highest(high[1], 5);
def lowOfLastBar = Lowest(low[1], 5);
plot HighLine = if lastFiveBars and barNumber == HighestAll(if lastFiveBars then barNumber else 0) then highOfLastBar else Double.NaN;
plot LowLine = if lastFiveBars and barNumber == HighestAll(if lastFiveBars then barNumber else 0) then lowOfLastBar else Double.NaN;
HighLine.SetDefaultColor(Color.GREEN);
LowLine.SetDefaultColor(Color.RED);
Script above won't show
how do I get lines to show
Last edited by a moderator: