input barsBack = 0;
input price= close;
def vClose = close;
def nan = double.NaN;
def bn = BarNumber();
def month = GetMonth();
def monthDay = GetDayOfMonth(GetYYYYMMDD());
def currentBar = HighestAll(if !IsNaN(price) then bn else Double.NaN);
def highestClose = HighestAll(if IsNaN(vClose[-1]) then vClose else nan);
plot hc = highestClose;
hc.SetPaintingStrategy(PaintingStrategy.DASHES);
hc.SetDefaultColor(Color.CYAN);
# throws an error symbol at top left of chart when condition is false. click on the error symbol to view the error message
# condition , "text"
assert(barsBack >= 0, "''bars back'' cannot be negative ");
# variables
AddChartBubble(bn == currentBar - barsBack, price,
# This section for text
"Price " + ( if price == close then "$ " else if price == open then "Open: $" else if price == low then " Low: $" else if price == high then " High: $" else if price == OHLC4 then " OHLC4 $" else if price == HLC3 then " HLC3 $" else " Value: " )+ price,(
# this section for color
if price == close then color.cyan else if price == open then color.pink else if price == low then color.yellow else if price == high then Color.White
else if price == OHLC4 then Color.Dark_Orange else if price == HLC3 then Color.Magenta else color.Plum), yes);
input StartDate = 20191003;
def hh = if GetYYYYMMDD() == StartDate then high else if high > hh[1] then high else hh[1];
plot higherHigh = if GetYYYYMMDD() < StartDate then Double.NaN else hh;
higherHigh.SetPaintingStrategy(12);
def RangeMax = Max(high, low);
def RangeMin = Min(high, low);
def IsMotherBarBullish3 = if close[2] > open[2] then 1 else 0;
def IBB3 = if RangeMax[1] < RangeMax[2] and RangeMin[1] > RangeMin[2]
and IsMotherBarBullish3
then 1 else 0;
plot IBB3_ = if IBB3 then high[2] else Double.NaN;
IBB3_.setPaintingStrategy(PaintingStrategy.HORIZONTAL);
IBB3_.setLineWeight(1);
IBB3_.setDefaultColor(Color.ORANGE);
plot IBB3 = if high[2],and high[3] and high[4] else Double.NaN;
Nope doesn't work. Thanks for tryingplot IBB3 = if high[2],and high[3] and high[4] else Double.NaN;
this might fix it
#
# Algo Predicted High Low Close for RTH and ETH sessions #
# These levels are inputed manually and is only valid
# for the specified period!
#
# Offset is the difference between the SPX and S&P 500 Emini Futures in points
def na = Double.NaN;
def timeStrRTH = (SecondsFromTime(930) > 0) and (SecondsFromTime(1700) < 0);
def timeStrETH = ((1700) > 0) and (SecondsFromTime(930) < 0);
input AlgoHigh = 2801;
input AlgoLow = 2689;
input AlgoClose = 2743;
input AlgoHighETH = 2801;
input AlgoLowETH = 2689;
input AlgoCloseETH = 2743;
input offset = 12;
input MarginErrorHigh = 10;
input MarginErrorLow = 14.5;
input MarginErrorClose = 5;
def AHRTH = AlgoHigh - offset;
def ALRTH = AlgoLow - offset;
def ACRTH = AlgoClose - offset;
def AHETH = AlgoHighETH - offset;
def ALETH = AlgoLowETH - offset;
def ACETH = AlgoCloseETH - offset;
plot AH;
plot AL;
plot AC;
if GetSymbol() == "/ES:XCME" {
AH = if timeStrRTH then AHRTH else if timeStrETH then AHETH else na ;
AL = if timeStrRTH then ALRTH else if timeStrETH then ALETH else na ;
AC = if timeStrRTH then ACRTH else if timeStrETH then ACETH else na ;
} else
if GetSymbol() == "SPX" {
AH = if timeStrRTH then AlgoHigh else na ;
AL = if timeStrRTH then AlgoLow else na ;
AC = if timeStrRTH then AlgoClose else na ;
} else {
AH = na;
AL = na;
AC = na;
}
def upperAH = AH + (MarginErrorHigh/2);
def lowerAH = AH - (MarginErrorHigh/2);
def upperAL = AL + (MarginErrorLow/2);
def lowerAL = AL - (MarginErrorLow/2);
def upperAC = AC + (MarginErrorClose/2);
def lowerAC = AC - (MarginErrorClose/2);
AddCloud(upperAH, lowerAH, Color.LIGHT_RED);
AddCloud(upperAL, lowerAL, Color.LIGHT_GREEN);
AddCloud(upperAC, lowerAC, Color.light_ORANGE);
AH.SetDefaultColor(Color.RED);
AH.SetLineWeight(2);
AL.SetDefaultColor(Color.GREEN);
AL.SetLineWeight(2);
AC.SetDefaultColor(Color.ORANGE);
AC.SetLineWeight(2);
AddLabel(GetSymbolPart()== "SPX", "Algo High: " + AH, Color.RED);
AddLabel(GetSymbol()== "SPX" and timeStrRTH, "Algo Low: " + AlgoLow, Color.GREEN);
AddLabel(GetSymbol()== "SPX" and timeStrRTH, "Algo Close: " + AlgoClose, Color.ORANGE);
AddLabel(GetSymbol()== "SPX" and timeStrETH, "Algo High: " + AlgoHighETH, Color.RED);
AddLabel(GetSymbol()== "SPX" and timeStrETH, "Algo Low: " + AlgoLowETH, Color.GREEN);
AddLabel(GetSymbol()== "SPX" and timeStrETH, "Algo Close: " + AlgoCloseETH, Color.ORANGE);
AddLabel(GetSymbolPart()== "/ES:XCME" and timeStrRTH, "Algo High: " + AHRTH, Color.RED);
AddLabel(GetSymbolPart()== "/ES:XCME" and timeStrRTH, "Algo Low: " + ALRTH, Color.GREEN);
AddLabel(GetSymbol()== "/ES:XCME" and timeStrRTH, "Algo Close: " + ACRTH, Color.ORANGE);
AddLabel(GetSymbol()== "/ES:XCME" and timeStrETH, "Algo High: " + AHETH, Color.RED);
AddLabel(GetSymbol()== "/ES:XCME" and timeStrETH, "Algo Low: " + ALETH, Color.GREEN);
AddLabel(GetSymbol()== "/ES:XCME" and timeStrETH, "Algo Close: " + ACETH, Color.ORANGE);
plot support = D*1.2;
support.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
support.setDefaultColor(Color.Yellow);
support.SetLineWeight(3);
# Even Number Lines by Len20
input step = .50;
def price = close;
def upper = roundUp(price / step , 0) * step;
def lower = roundDown(price/ step , 0) * step;
def upperLine = if !isNaN(price) and isNaN(price[-1]) then upper else if isNan(price) then upperLine[1] else double.NaN;
def lowerLine = if !isNaN(price) and isNaN(price[-1]) then lower else if isNan(price) then lowerLine[1] else double.NaN;
plot above1 = upperLine;
plot below1 = lowerLine;
plot my_line = 1; #change 1 to whatever static value or variable you want it to plot
def mostRecentBar = !IsNaN(close) and IsNaN(close[-1]);
def mostRecentBarNumExtract = If mostRecentBar Then BarNumber() else Double.NaN;
def mostRecentBarNum = HighestAll(mostRecentBarNumExtract);
plot someStuff = If BarNumber() > (mostRecentBarNum - 5) Then high + 2 else Double.NaN;
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
A | How to script to plot price level with horizontal line | Questions | 35 | |
N | To Scan stocks when the plot line changes Green to Red | Questions | 2 | |
R | Plot Beta as a label | Questions | 2 | |
![]() |
thinkScript At least one plot should be defined | Questions | 9 | |
G | Plot two consecutive closes above 9 EMA | Questions | 5 |