Option Heatmap and OI Strikes For ThinkOrSwim

ziongotoptions

Active member
Most Recent Update
Edit: Now works for prices > 1000
Code:
#hint barLength: The number of bars used to calculate the ADX <b>(Default is 14)</b>


#hint barLength: The number of bars used to calculate the ADX <b>(Default is 14)</b>


def series = 1;

input show_label = yes;
input mode = {default AUTO, MANUAL};


def RTHopen = open(period = AggregationPeriod.DAY);
def CurrentYear = GetYear();
def CurrentMonth = GetMonth();
def CurrentDOM = GetDayOfMonth(GetYYYYMMDD());
def Day1DOW1 = GetDayOfWeek((CurrentYear * 10000) + (CurrentMonth * 100) + 1); # First DOM is this DOW
def FirstFridayDOM1 = if Day1DOW1 < 6
then 6 - Day1DOW1
else if Day1DOW1 == 6
then 7
else 6;

def SecondFridayDOM = FirstFridayDOM1 + 7;
def ThirdFridayDOM = FirstFridayDOM1 + 14;
def FourthFridayDOM = FirstFridayDOM1 + 21;
def RollDOM = FirstFridayDOM1 + 14; #changed to 21 to pick up all Fridays of the current month for weekly options
def ExpMonthA = if RollDOM > CurrentDOM #MK - expmonth1 changed to ExpmonthA
then CurrentMonth + series - 1
else CurrentMonth + series;

def ExpMonthB = if ExpMonthA > 12 #options month input -- #MK - expmonth2 changed to ExpmonthB
then ExpMonthA - 12
else ExpMonthA;

def ExpYear = if ExpMonthA > 12 #options year input
then CurrentYear + 1
else CurrentYear;


def Day1DOW = GetDayOfWeek(ExpYear * 10000 + ExpMonthB * 100 + 1); #first friday expiry calc
def FirstFridayDOM = if Day1DOW < 6
then 6 - Day1DOW
else if Day1DOW == 6
then 7
else 6;

#MK added easier input to fix date
input datefix = 0;
def ExpDOM = FirstFridayDOM + 14 + datefix;

def ExpMonth2 = ExpMonthB; #MK in case more date issues need to be fixed

#strike spacing inputs
input maxStrikeSpacing = 25;
input manualCenterStrike = 440;
input manualStrikeSpacing = 1.0;


#centerstrike
rec centerStrike = if (mode == mode.AUTO and !IsNaN(close)) then Round(close / 10.0, 0) * 10.0 else if (mode == mode.MANUAL and !IsNaN(close)) then manualcenterstrike else centerStrike[1]; #MK - imported from prev code - plot now working

#strikeSpacing
def strikeSpacingC = fold i = 1 to maxStrikeSpacing with spacing = 0 do if !IsNaN( open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", Asprice(centerStrike + (maxStrikeSpacing - i)))))) then maxStrikeSpacing - i else spacing;

rec strikeSpacing = if (mode == mode.AUTO and !IsNaN(close)) then strikeSpacingC else if (mode == mode.MANUAL and !IsNaN(close)) then manualStrikeSpacing else strikeSpacing[1];

### bar vars ###
input displayOffset = 5; # Number of bars to right of current bar for display
input barWeight = 1;
rec barOffset = if !IsNaN(close) then strikeSpacing / 10.0 else barOffset[1];
rec extBar = if IsNaN(close[displayOffset]) then extBar[1] + 1 else 0; # Number of bars of right space minus 5
input barLength = 45;

#call/put colors
DefineGlobalColor("Calls", Color.GREEN);
DefineGlobalColor("Puts", Color.RED);

#current option expiry label
#AddLabel(yes, Concat("Expiration: ", Concat(Concat(ExpYear - 2000,
        #if ExpMonth2 <= 9 then Concat("0", ExpMonth2)
            #else Concat("", ExpMonth2)),
        #if ExpDOM <= 9 then Concat("0", ExpDOM)
            #else Concat("", ExpDOM))), Color.WHITE);


AddLabel(yes, (Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM))))));
addLabel(yes, (Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike)))));


#options calculations **************

def c1_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing *0 ))));
def c2_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 1))));
def c3_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 2))));
def c4_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 3))));
def c5_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing))));
def c6_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 2))));
def c7_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 3))));

def c8_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 4))));
def c9_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 4))));
def c10_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 5))));
def c11_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 5))));
def c12_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 6))));
def c13_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 6))));
def c14_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 7))));
def c15_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 7))));
def c16_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 8))));
def c17_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 8))));
def c18_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 9))));
def c19_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 9))));
def c20_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 10))));
def c21_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 10))));
def c22_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 11))));
def c23_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 11))));
def c24_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 12))));
def c25_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 12))));
def c26_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 13))));
def c27_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 13))));
def c28_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 14))));
def c29_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 14))));
def c30_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 15))));
def c31_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 15))));
def c32_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 16))));
def c33_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 16))));
def c34_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 17))));
def c35_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 17))));
def c36_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 18))));
def c37_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 18))));
def c38_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 19))));
def c39_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 19))));

#puts
def p1_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike))));
def p2_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing))));
def p3_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 2))));
def p4_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 3))));

def p5_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing))));
def p6_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 2))));
def p7_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 3))));

def p8_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 4))));
def p9_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 4))));
def p10_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 5))));
def p11_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 5))));
def p12_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 6))));
def p13_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 6))));
def p14_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 7))));
def p15_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 7))));
def p16_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 8))));
def p17_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 8))));
def p18_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 9))));
def p19_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 9))));
def p20_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 10))));
def p21_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 10))));
def p22_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 11))));
def p23_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 11))));
def p24_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 12))));
def p25_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 12))));
def p26_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 13))));
def p27_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 13))));
def p28_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 14))));
def p29_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 14))));
def p30_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 15))));
def p31_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 15))));
def p32_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 16))));
def p33_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 16))));
def p34_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 17))));
def p35_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 17))));
def p36_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 18))));
def p37_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 18))));
def p38_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 19))));
def p39_V_d = open_interest(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 19))));

def c1_V = if !IsNaN(c1_V_d) then c1_V_d else 0;
def c2_V = if !IsNaN(c2_V_d) then c2_V_d else 0;
def c3_V = if !IsNaN(c3_V_d) then c3_V_d else 0;
def c4_V = if !IsNaN(c4_V_d) then c4_V_d else 0;
def c5_V = if !IsNaN(c5_V_d) then c5_V_d else 0;
def c6_V = if !IsNaN(c6_V_d) then c6_V_d else 0;
def c7_V = if !IsNaN(c7_V_d) then c7_V_d else 0;
def c8_V = if !IsNaN(c8_V_d) then c8_V_d else 0;
def c9_V = if !IsNaN(c9_V_d) then c9_V_d else 0;
def c10_V = if !IsNaN(c10_V_d) then c10_V_d else 0;
def c11_V = if !IsNaN(c11_V_d) then c11_V_d else 0;

def c12_V = if !IsNaN(c12_V_d) then c12_V_d else 0;
def c13_V = if !IsNaN(c13_V_d) then c13_V_d else 0;
def c14_V = if !IsNaN(c14_V_d) then c14_V_d else 0;
def c15_V = if !IsNaN(c15_V_d) then c15_V_d else 0;
def c16_V = if !IsNaN(c16_V_d) then c16_V_d else 0;
def c17_V = if !IsNaN(c17_V_d) then c17_V_d else 0;
def c18_V = if !IsNaN(c18_V_d) then c18_V_d else 0;
def c19_V = if !IsNaN(c19_V_d) then c19_V_d else 0;
def c20_V = if !IsNaN(c20_V_d) then c20_V_d else 0;
def c21_V = if !IsNaN(c21_V_d) then c21_V_d else 0;
def c22_V = if !IsNaN(c22_V_d) then c22_V_d else 0;
def c23_V = if !IsNaN(c23_V_d) then c23_V_d else 0;
def c24_V = if !IsNaN(c24_V_d) then c24_V_d else 0;
def c25_V = if !IsNaN(c25_V_d) then c25_V_d else 0;
def c26_V = if !IsNaN(c26_V_d) then c26_V_d else 0;
def c27_V = if !IsNaN(c27_V_d) then c27_V_d else 0;
def c28_V = if !IsNaN(c28_V_d) then c28_V_d else 0;
def c29_V = if !IsNaN(c29_V_d) then c29_V_d else 0;
def c30_V = if !IsNaN(c30_V_d) then c30_V_d else 0;

def c31_V = if !IsNaN(c31_V_d) then c31_V_d else 0;
def c32_V = if !IsNaN(c32_V_d) then c32_V_d else 0;
def c33_V = if !IsNaN(c33_V_d) then c33_V_d else 0;
def c34_V = if !IsNaN(c34_V_d) then c34_V_d else 0;
def c35_V = if !IsNaN(c35_V_d) then c35_V_d else 0;
def c36_V = if !IsNaN(c36_V_d) then c36_V_d else 0;
def c37_V = if !IsNaN(c37_V_d) then c37_V_d else 0;
def c38_V = if !IsNaN(c38_V_d) then c38_V_d else 0;

def p1_V = if !IsNaN(p1_V_d) then p1_V_d else 0;
def p2_V = if !IsNaN(p2_V_d) then p2_V_d else 0;
def p3_V = if !IsNaN(p3_V_d) then p3_V_d else 0;
def p4_V = if !IsNaN(p4_V_d) then p4_V_d else 0;
def p5_V = if !IsNaN(p5_V_d) then p5_V_d else 0;
def p6_V = if !IsNaN(p6_V_d) then p6_V_d else 0;
def p7_V = if !IsNaN(p7_V_d) then p7_V_d else 0;
def p8_V = if !IsNaN(p8_V_d) then p8_V_d else 0;
def p9_V = if !IsNaN(p9_V_d) then p9_V_d else 0;
def p10_V = if !IsNaN(p10_V_d) then p10_V_d else 0;
def p11_V = if !IsNaN(p11_V_d) then p11_V_d else 0;

def p12_V = if !IsNaN(p12_V_d) then p12_V_d else 0;
def p13_V = if !IsNaN(p13_V_d) then p13_V_d else 0;
def p14_V = if !IsNaN(p14_V_d) then p14_V_d else 0;
def p15_V = if !IsNaN(p15_V_d) then p15_V_d else 0;
def p16_V = if !IsNaN(p16_V_d) then p16_V_d else 0;
def p17_V = if !IsNaN(p17_V_d) then p17_V_d else 0;
def p18_V = if !IsNaN(p18_V_d) then p18_V_d else 0;
def p19_V = if !IsNaN(p19_V_d) then p19_V_d else 0;
def p20_V = if !IsNaN(p20_V_d) then p20_V_d else 0;
def p21_V = if !IsNaN(p21_V_d) then p21_V_d else 0;
def p22_V = if !IsNaN(p22_V_d) then p22_V_d else 0;
def p23_V = if !IsNaN(p23_V_d) then p23_V_d else 0;
def p24_V = if !IsNaN(p24_V_d) then p24_V_d else 0;
def p25_V = if !IsNaN(p25_V_d) then p25_V_d else 0;
def p26_V = if !IsNaN(p26_V_d) then p26_V_d else 0;
def p27_V = if !IsNaN(p27_V_d) then p27_V_d else 0;
def p28_V = if !IsNaN(p28_V_d) then p28_V_d else 0;
def p29_V = if !IsNaN(p29_V_d) then p29_V_d else 0;
def p30_V = if !IsNaN(p30_V_d) then p30_V_d else 0;

def p31_V = if !IsNaN(p31_V_d) then p31_V_d else 0;
def p32_V = if !IsNaN(p32_V_d) then p32_V_d else 0;
def p33_V = if !IsNaN(p33_V_d) then p33_V_d else 0;
def p34_V = if !IsNaN(p34_V_d) then p34_V_d else 0;
def p35_V = if !IsNaN(p35_V_d) then p35_V_d else 0;
def p36_V = if !IsNaN(p36_V_d) then p36_V_d else 0;
def p37_V = if !IsNaN(p37_V_d) then p37_V_d else 0;
def p38_V = if !IsNaN(p38_V_d) then p38_V_d else 0;


def c1t = Max(Max(Max(Max(c1_V, c2_V), c3_V), c4_V), c5_V);
def c2t = Max(Max(Max(Max(Max(c6_V, c7_V), c8_V), c9_V), c10_V), c11_V);

def c3t = Max(Max(Max(Max(Max(Max(Max(c12_V, c13_V), c14_V), c15_V), c16_V), c17_V),c18_V),c19_V);
def c4t = Max(Max(Max(Max(Max(c20_V, c21_V),c22_V),c23_V),c24_V),c25_V);
def c5t = Max(Max(Max(Max(Max(Max(c26_V,c27_V),c28_v),c29_v),c30_V),c31_v),c32_v);
def c6t = Max(Max(Max(Max(Max(c33_V,c34_V),c35_v),c36_v),c37_V),c38_v);

def p1t = Max(Max(Max(Max(p1_V, p2_V), p3_V), p4_V), p5_V);
def p2t = Max(Max(Max(Max(Max(p6_V, p7_V), p8_V), p9_V), p10_V), p11_V);

def p3t = Max(Max(Max(Max(Max(Max(Max(p12_V, p13_V), p14_V), p15_V), p16_V), p17_V),p18_V),p19_V);
def p4t = Max(Max(Max(Max(Max(p20_V, p21_V),p22_V),p23_V),p24_V),p25_V);
def p5t = Max(Max(Max(Max(Max(Max(p26_V,p27_V),p28_v),p29_v),p30_V),p31_v),p32_v);
def p6t = Max(Max(Max(Max(Max(p33_V,p34_V),p35_v),p36_v),p37_V),p38_v);



def c_V_max = Max(Max(Max(Max(Max(c1t, c2t), c3t), c4t),c5t),c6t);
def p_V_max = Max(Max(Max(Max(Max(p1t, p2t), p3t), p4t),p5t),p6t);
def OI_max = Max(c_V_max, p_V_max);

def cVT = c1_V + c2_V + c3_V + c4_V + c5_V + c6_V + c7_V + c8_V + c9_V + c10_V + c11_V + c12_V + c13_V + c14_V + c15_V + c16_V + c17_V + c18_V + c19_V + c20_V + c21_V + c22_V + c23_V + c24_V + c25_V + c26_V + c27_V + c28_V + c29_V + c30_V + c31_V + c32_V + c33_V + c34_V + c35_V + c36_V + c37_V + c38_V;

def pVT = p1_V + p2_V + p3_V + p4_V + p5_V + p6_V + p7_V + p8_V + p9_V + p10_V + p11_V + p12_V + p13_V + p14_V + p15_V + p16_V + p17_V + p18_V + p19_V + p20_V + p21_V + p22_V + p23_V + p24_V + p25_V + p26_V + p27_V + p28_V + p29_V + p30_V + p31_V + p32_V + p33_V + p34_V + p35_V + p36_V + p37_V + p38_V;

AddLabel(yes, Concat("Call OI: ", cVT), GlobalColor("Calls"));
AddLabel(yes, Concat("Put OI: ", pVT), GlobalColor("Puts"));


#strike spacing
def strikespac = if mode == mode.AUTO then strikeSpacing else 1; #MK - auto pricerange option
AddLabel(show_label, Concat("Strike Spacing: ", strikespac), Color.WHITE);

rec c1_D = if IsNaN(close) then c1_D[1] else Ceil((c1_V / OI_max) * barLength);
plot C1 = if c1_D >= extBar and extBar != 0 then centerStrike + barOffset else Double.NaN;
C1.SetDefaultColor(GlobalColor("Calls") );
C1.SetLineWeight(barWeight);

rec c2_D = if IsNaN(close) then c2_D[1] else Ceil((c2_V / OI_max) * barLength);
plot C2 = if c2_D >= extBar and extBar != 0 then centerStrike + barOffset - strikespac else Double.NaN;
C2.SetDefaultColor(GlobalColor("Calls"));
C2.SetLineWeight(barWeight);

rec c3_D = if IsNaN(close) then c3_D[1] else Ceil((c3_V / OI_max) * barLength);
plot C3 = if c3_D >= extBar and extBar != 0 then centerStrike + barOffset - strikespac * 2 else Double.NaN;
C3.SetDefaultColor(GlobalColor("Calls"));
C3.SetLineWeight(barWeight);

rec c4_D = if IsNaN(close) then c4_D[1] else Ceil((c4_V / OI_max) * barLength);
plot C4 = if c4_D >= extBar and extBar != 0 then centerStrike + barOffset - strikespac * 3 else Double.NaN;
C4.SetDefaultColor(GlobalColor("Calls"));
C4.SetLineWeight(barWeight);

rec c5_D = if IsNaN(close) then c5_D[1] else Ceil((c5_V / OI_max) * barLength);
plot C5 = if c5_D >= extBar and extBar != 0 then centerStrike + barOffset + strikespac else Double.NaN;
C5.SetDefaultColor(GlobalColor("Calls"));
C5.SetLineWeight(barWeight);

rec c6_D = if IsNaN(close) then c6_D[1] else Ceil((c6_V / OI_max) * barLength);
plot C6 = if c6_D >= extBar and extBar != 0 then centerStrike + barOffset + strikespac * 2 else Double.NaN;
C6.SetDefaultColor(GlobalColor("Calls"));
C6.SetLineWeight(barWeight);

rec c7_D = if IsNaN(close) then c7_D[1] else Ceil((c7_V / OI_max) * barLength);
plot C7 = if c7_D >= extBar and extBar != 0 then centerStrike + barOffset + strikespac * 3 else Double.NaN;
C7.SetDefaultColor(GlobalColor("Calls"));
C7.SetLineWeight(barWeight);

rec c8_D = if IsNaN(close) then c8_D[1] else Ceil((c8_V / OI_max) * barLength);
plot C8 = if c8_D >= extBar and extBar != 0 then centerStrike + barOffset - strikespac * 4 else Double.NaN;
C8.SetDefaultColor(GlobalColor("Calls"));
C8.SetLineWeight(barWeight);

rec c9_D = if IsNaN(close) then c9_D[1] else Ceil((c9_V / OI_max) * barLength);
plot C9 = if c9_D >= extBar and extBar != 0 then centerStrike + barOffset + strikespac * 4 else Double.NaN;
C9.SetDefaultColor(GlobalColor("Calls"));
C9.SetLineWeight(barWeight);

rec c10_D = if IsNaN(close) then c10_D[1] else Ceil((c10_V / OI_max) * barLength);
plot C10 = if c10_D >= extBar and extBar != 0 then centerStrike + barOffset - strikespac * 5 else Double.NaN;
C10.SetDefaultColor(GlobalColor("Calls"));
C10.SetLineWeight(barWeight);

rec c11_D = if IsNaN(close) then c11_D[1] else Ceil((c11_V / OI_max) * barLength);
plot C11 = if c11_D >= extBar and extBar != 0 then centerStrike + barOffset + strikespac * 5 else Double.NaN;
C11.SetDefaultColor(GlobalColor("Calls"));
C11.SetLineWeight(barWeight);

rec c12_D = if IsNaN(close) then c12_D[1] else Ceil((c12_V / OI_max) * barLength);
plot C12 = if c12_D >= extBar and extBar != 0 then centerStrike + barOffset - strikespac * 6 else Double.NaN;
C12.SetDefaultColor(GlobalColor("Calls"));
C12.SetLineWeight(barWeight);

rec c13_D = if IsNaN(close) then c13_D[1] else Ceil((c13_V / OI_max) * barLength);
plot C13 = if c13_D >= extBar and extBar != 0 then centerStrike + barOffset + strikespac * 6 else Double.NaN;
C13.SetDefaultColor(GlobalColor("Calls"));
C13.SetLineWeight(barWeight);

rec c14_D = if IsNaN(close) then c14_D[1] else Ceil((c14_V / OI_max) * barLength);
plot C14 = if c14_D >= extBar and extBar != 0 then centerStrike + barOffset - strikespac * 7 else Double.NaN;
C14.SetDefaultColor(GlobalColor("Calls"));
C14.SetLineWeight(barWeight);

rec c15_D = if IsNaN(close) then c15_D[1] else Ceil((c15_V / OI_max) * barLength);
plot C15 = if c15_D >= extBar and extBar != 0 then centerStrike + barOffset + strikespac * 7 else Double.NaN;
C15.SetDefaultColor(GlobalColor("Calls"));
C15.SetLineWeight(barWeight);

rec c16_D = if IsNaN(close) then c16_D[1] else Ceil((c16_V / OI_max) * barLength);
plot C16 = if c16_D >= extBar and extBar != 0 then centerStrike + barOffset - strikespac * 8 else Double.NaN;
C16.SetDefaultColor(GlobalColor("Calls"));
C16.SetLineWeight(barWeight);

rec c17_D = if IsNaN(close) then c17_D[1] else Ceil((c17_V / OI_max) * barLength);
plot C17 = if c17_D >= extBar and extBar != 0 then centerStrike + barOffset + strikespac * 8 else Double.NaN;
C17.SetDefaultColor(GlobalColor("Calls"));
C17.SetLineWeight(barWeight);

rec c18_D = if IsNaN(close) then c18_D[1] else Ceil((c18_V / OI_max) * barLength);
plot C18 = if c18_D >= extBar and extBar != 0 then centerStrike + barOffset - strikespac * 9 else Double.NaN;
C18.SetDefaultColor(GlobalColor("Calls"));
C18.SetLineWeight(barWeight);

rec c19_D = if IsNaN(close) then c19_D[1] else Ceil((c19_V / OI_max) * barLength);
plot C19 = if c19_D >= extBar and extBar != 0 then centerStrike + barOffset + strikespac * 9 else Double.NaN;
C19.SetDefaultColor(GlobalColor("Calls"));
C19.SetLineWeight(barWeight);

rec c20_D = if IsNaN(close) then c20_D[1] else Ceil((c20_V / OI_max) * barLength);
plot C20 = if c20_D >= extBar and extBar != 0 then centerStrike + barOffset - strikespac * 10 else Double.NaN;
C20.SetDefaultColor(GlobalColor("Calls"));
C20.SetLineWeight(barWeight);

rec c21_D = if IsNaN(close) then c21_D[1] else Ceil((c21_V / OI_max) * barLength);
plot C21 = if c21_D >= extBar and extBar != 0 then centerStrike + barOffset + strikespac * 10 else Double.NaN;
C21.SetDefaultColor(GlobalColor("Calls"));
C21.SetLineWeight(barWeight);

rec c22_D = if IsNaN(close) then c22_D[1] else Ceil((c22_V / OI_max) * barLength);
plot C22 = if c22_D >= extBar and extBar != 0 then centerStrike + barOffset - strikespac * 11 else Double.NaN;
C22.SetDefaultColor(GlobalColor("Calls"));
C22.SetLineWeight(barWeight);

rec c23_D = if IsNaN(close) then c23_D[1] else Ceil((c23_V / OI_max) * barLength);
plot C23 = if c23_D >= extBar and extBar != 0 then centerStrike + barOffset + strikespac * 11 else Double.NaN;
C23.SetDefaultColor(GlobalColor("Calls"));
C23.SetLineWeight(barWeight);

rec c24_D = if IsNaN(close) then c24_D[1] else Ceil((c24_V / OI_max) * barLength);
plot C24 = if c24_D >= extBar and extBar != 0 then centerStrike + barOffset - strikespac * 12 else Double.NaN;
C24.SetDefaultColor(GlobalColor("Calls"));
C24.SetLineWeight(barWeight);

rec c25_D = if IsNaN(close) then c25_D[1] else Ceil((c25_V / OI_max) * barLength);
plot C25 = if c25_D >= extBar and extBar != 0 then centerStrike + barOffset + strikespac * 12 else Double.NaN;
C25.SetDefaultColor(GlobalColor("Calls"));
C25.SetLineWeight(barWeight);

rec c26_D = if IsNaN(close) then c26_D[1] else Ceil((c26_V / OI_max) * barLength);
plot C26 = if c26_D >= extBar and extBar != 0 then centerStrike + barOffset - strikespac * 13 else Double.NaN;
C26.SetDefaultColor(GlobalColor("Calls"));
C26.SetLineWeight(barWeight);

rec c27_D = if IsNaN(close) then c27_D[1] else Ceil((c27_V / OI_max) * barLength);
plot C27 = if c27_D >= extBar and extBar != 0 then centerStrike + barOffset + strikespac * 13 else Double.NaN;
C27.SetDefaultColor(GlobalColor("Calls"));
C27.SetLineWeight(barWeight);

rec c28_D = if IsNaN(close) then c28_D[1] else Ceil((c28_V / OI_max) * barLength);
plot C28 = if c28_D >= extBar and extBar != 0 then centerStrike + barOffset - strikespac * 14 else Double.NaN;
C28.SetDefaultColor(GlobalColor("Calls"));
C28.SetLineWeight(barWeight);

rec c29_D = if IsNaN(close) then c29_D[1] else Ceil((c29_V / OI_max) * barLength);
plot C29 = if c29_D >= extBar and extBar != 0 then centerStrike + barOffset + strikespac * 14 else Double.NaN;
C29.SetDefaultColor(GlobalColor("Calls"));
C29.SetLineWeight(barWeight);

rec c30_D = if IsNaN(close) then c30_D[1] else Ceil((c30_V / OI_max) * barLength);
plot C30 = if c30_D >= extBar and extBar != 0 then centerStrike + barOffset - strikespac * 15 else Double.NaN;
C30.SetDefaultColor(GlobalColor("Calls"));
C30.SetLineWeight(barWeight);

rec c31_D = if IsNaN(close) then c31_D[1] else Ceil((c31_V / OI_max) * barLength);
plot C31 = if c31_D >= extBar and extBar != 0 then centerStrike + barOffset + strikespac * 15 else Double.NaN;
C31.SetDefaultColor(GlobalColor("Calls"));
C31.SetLineWeight(barWeight);

rec c32_D = if IsNaN(close) then c32_D[1] else Ceil((c32_V / OI_max) * barLength);
plot C32 = if c32_D >= extBar and extBar != 0 then centerStrike + barOffset - strikespac * 16 else Double.NaN;
C32.SetDefaultColor(GlobalColor("Calls"));
C32.SetLineWeight(barWeight);

rec c33_D = if IsNaN(close) then c33_D[1] else Ceil((c33_V / OI_max) * barLength);
plot C33 = if c33_D >= extBar and extBar != 0 then centerStrike + barOffset + strikespac * 16 else Double.NaN;
C33.SetDefaultColor(GlobalColor("Calls"));
C33.SetLineWeight(barWeight);

rec c34_D = if IsNaN(close) then c34_D[1] else Ceil((c34_V / OI_max) * barLength);
plot C34 = if c34_D >= extBar and extBar != 0 then centerStrike + barOffset - strikespac * 17 else Double.NaN;
C34.SetDefaultColor(GlobalColor("Calls"));
C34.SetLineWeight(barWeight);

rec c35_D = if IsNaN(close) then c35_D[1] else Ceil((c35_V / OI_max) * barLength);
plot C35 = if c35_D >= extBar and extBar != 0 then centerStrike + barOffset + strikespac * 17 else Double.NaN;
C35.SetDefaultColor(GlobalColor("Calls"));
C35.SetLineWeight(barWeight);

rec c36_D = if IsNaN(close) then c36_D[1] else Ceil((c36_V / OI_max) * barLength);
plot C36 = if c36_D >= extBar and extBar != 0 then centerStrike + barOffset - strikespac * 18 else Double.NaN;
C36.SetDefaultColor(GlobalColor("Calls"));
C36.SetLineWeight(barWeight);

rec c37_D = if IsNaN(close) then c37_D[1] else Ceil((c37_V / OI_max) * barLength);
plot C37 = if c37_D >= extBar and extBar != 0 then centerStrike + barOffset + strikespac * 18 else Double.NaN;
C37.SetDefaultColor(GlobalColor("Calls"));
C37.SetLineWeight(barWeight);

rec c38_D = if IsNaN(close) then c38_D[1] else Ceil((c38_V / OI_max) * barLength);
plot C38 = if c38_D >= extBar and extBar != 0 then centerStrike + barOffset - strikespac * 19 else Double.NaN;
C38.SetDefaultColor(GlobalColor("Calls"));
C38.SetLineWeight(barWeight);


rec p1_D = if IsNaN(close) then p1_D[1] else Ceil((p1_V / OI_max) * barLength);
plot P1 = if p1_D >= extBar and extBar != 0 then centerStrike - barOffset else Double.NaN;
P1.SetDefaultColor(GlobalColor("Puts") );
P1.SetLineWeight(barWeight);

rec p2_D = if IsNaN(close) then p2_D[1] else Ceil((p2_V / OI_max) * barLength);
plot P2 = if p2_D >= extBar and extBar != 0 then centerStrike - barOffset - strikespac else Double.NaN;
P2.SetDefaultColor(GlobalColor("Puts"));
P2.SetLineWeight(barWeight);

rec p3_D = if IsNaN(close) then p3_D[1] else Ceil((p3_V / OI_max) * barLength);
plot P3 = if p3_D >= extBar and extBar != 0 then centerStrike - barOffset - strikespac * 2 else Double.NaN;
P3.SetDefaultColor(GlobalColor("Puts"));
P3.SetLineWeight(barWeight);

rec p4_D = if IsNaN(close) then p4_D[1] else Ceil((p4_V / OI_max) * barLength);
plot P4 = if p4_D >= extBar and extBar != 0 then centerStrike - barOffset - strikespac * 3 else Double.NaN;
P4.SetDefaultColor(GlobalColor("Puts"));
P4.SetLineWeight(barWeight);

rec p5_D = if IsNaN(close) then p5_D[1] else Ceil((p5_V / OI_max) * barLength);
plot P5 = if p5_D >= extBar and extBar != 0 then centerStrike - barOffset + strikespac else Double.NaN;
P5.SetDefaultColor(GlobalColor("Puts"));
P5.SetLineWeight(barWeight);

rec p6_D = if IsNaN(close) then p6_D[1] else Ceil((p6_V / OI_max) * barLength);
plot P6 = if p6_D >= extBar and extBar != 0 then centerStrike - barOffset + strikespac * 2 else Double.NaN;
P6.SetDefaultColor(GlobalColor("Puts"));
P6.SetLineWeight(barWeight);

rec p7_D = if IsNaN(close) then p7_D[1] else Ceil((p7_V / OI_max) * barLength);
plot P7 = if p7_D >= extBar and extBar != 0 then centerStrike - barOffset + strikespac * 3 else Double.NaN;
P7.SetDefaultColor(GlobalColor("Puts"));
P7.SetLineWeight(barWeight);

rec p8_D = if IsNaN(close) then p8_D[1] else Ceil((p8_V / OI_max) * barLength);
plot P8 = if p8_D >= extBar and extBar != 0 then centerStrike - barOffset - strikespac * 4 else Double.NaN;
P8.SetDefaultColor(GlobalColor("Puts"));
P8.SetLineWeight(barWeight);

rec p9_D = if IsNaN(close) then p9_D[1] else Ceil((p9_V / OI_max) * barLength);
plot P9 = if p9_D >= extBar and extBar != 0 then centerStrike - barOffset + strikespac * 4 else Double.NaN;
P9.SetDefaultColor(GlobalColor("Puts"));
P9.SetLineWeight(barWeight);

rec p10_D = if IsNaN(close) then p10_D[1] else Ceil((p10_V / OI_max) * barLength);
plot P10 = if p10_D >= extBar and extBar != 0 then centerStrike - barOffset - strikespac * 5 else Double.NaN;
P10.SetDefaultColor(GlobalColor("Puts"));
P10.SetLineWeight(barWeight);

rec p11_D = if IsNaN(close) then p11_D[1] else Ceil((p11_V / OI_max) * barLength);
plot P11 = if p11_D >= extBar and extBar != 0 then centerStrike - barOffset + strikespac * 5 else Double.NaN;
P11.SetDefaultColor(GlobalColor("Puts"));
P11.SetLineWeight(barWeight);

rec p12_D = if IsNaN(close) then p12_D[1] else Ceil((p12_V / OI_max) * barLength);
plot P12 = if p12_D >= extBar and extBar != 0 then centerStrike - barOffset - strikespac * 6 else Double.NaN;
P12.SetDefaultColor(GlobalColor("Puts"));
P12.SetLineWeight(barWeight);

rec p13_D = if IsNaN(close) then p13_D[1] else Ceil((p13_V / OI_max) * barLength);
plot P13 = if p13_D >= extBar and extBar != 0 then centerStrike - barOffset + strikespac * 6 else Double.NaN;
P13.SetDefaultColor(GlobalColor("Puts"));
P13.SetLineWeight(barWeight);

rec p14_D = if IsNaN(close) then p14_D[1] else Ceil((p14_V / OI_max) * barLength);
plot P14 = if p14_D >= extBar and extBar != 0 then centerStrike - barOffset - strikespac * 7 else Double.NaN;
P14.SetDefaultColor(GlobalColor("Puts"));
P14.SetLineWeight(barWeight);

rec p15_D = if IsNaN(close) then p15_D[1] else Ceil((p15_V / OI_max) * barLength);
plot P15 = if p15_D >= extBar and extBar != 0 then centerStrike - barOffset + strikespac * 7 else Double.NaN;
P15.SetDefaultColor(GlobalColor("Puts"));
P15.SetLineWeight(barWeight);

rec p16_D = if IsNaN(close) then p16_D[1] else Ceil((p16_V / OI_max) * barLength);
plot P16 = if p16_D >= extBar and extBar != 0 then centerStrike - barOffset - strikespac * 8 else Double.NaN;
P16.SetDefaultColor(GlobalColor("Puts"));
P16.SetLineWeight(barWeight);

rec p17_D = if IsNaN(close) then p17_D[1] else Ceil((p17_V / OI_max) * barLength);
plot P17 = if p17_D >= extBar and extBar != 0 then centerStrike - barOffset + strikespac * 8 else Double.NaN;
P17.SetDefaultColor(GlobalColor("Puts"));
P17.SetLineWeight(barWeight);

rec p18_D = if IsNaN(close) then p18_D[1] else Ceil((p18_V / OI_max) * barLength);
plot P18 = if p18_D >= extBar and extBar != 0 then centerStrike - barOffset - strikespac * 9 else Double.NaN;
P18.SetDefaultColor(GlobalColor("Puts"));
P18.SetLineWeight(barWeight);

rec p19_D = if IsNaN(close) then p19_D[1] else Ceil((p19_V / OI_max) * barLength);
plot P19 = if p19_D >= extBar and extBar != 0 then centerStrike - barOffset + strikespac * 9 else Double.NaN;
P19.SetDefaultColor(GlobalColor("Puts"));
P19.SetLineWeight(barWeight);

rec p20_D = if IsNaN(close) then p20_D[1] else Ceil((p20_V / OI_max) * barLength);
plot p20 = if p20_D >= extBar and extBar != 0 then centerStrike - barOffset - strikespac * 10 else Double.NaN;
P20.SetDefaultColor(GlobalColor("Puts"));
P20.SetLineWeight(barWeight);

rec p21_D = if IsNaN(close) then p21_D[1] else Ceil((P21_V / OI_max) * barLength);
plot P21 = if p21_D >= extBar and extBar != 0 then centerStrike - barOffset + strikespac * 10 else Double.NaN;
P21.SetDefaultColor(GlobalColor("Puts"));
P21.SetLineWeight(barWeight);

rec p22_D = if IsNaN(close) then p22_D[1] else Ceil((p22_V / OI_max) * barLength);
plot P22 = if p22_D >= extBar and extBar != 0 then centerStrike - barOffset - strikespac * 11 else Double.NaN;
P22.SetDefaultColor(GlobalColor("Puts"));
P22.SetLineWeight(barWeight);

rec p23_D = if IsNaN(close) then p23_D[1] else Ceil((p23_V / OI_max) * barLength);
plot P23 = if p23_D >= extBar and extBar != 0 then centerStrike - barOffset + strikespac * 11 else Double.NaN;
P23.SetDefaultColor(GlobalColor("Puts"));
P23.SetLineWeight(barWeight);

rec p24_D = if IsNaN(close) then p24_D[1] else Ceil((p24_V / OI_max) * barLength);
plot P24 = if p24_D >= extBar and extBar != 0 then centerStrike - barOffset - strikespac * 12 else Double.NaN;
P24.SetDefaultColor(GlobalColor("Puts"));
P24.SetLineWeight(barWeight);

rec p25_D = if IsNaN(close) then p25_D[1] else Ceil((p25_V / OI_max) * barLength);
plot P25 = if p25_D >= extBar and extBar != 0 then centerStrike - barOffset + strikespac * 12 else Double.NaN;
P25.SetDefaultColor(GlobalColor("Puts"));
P25.SetLineWeight(barWeight);

rec p26_D = if IsNaN(close) then p26_D[1] else Ceil((p26_V / OI_max) * barLength);
plot P26 = if p26_D >= extBar and extBar != 0 then centerStrike - barOffset - strikespac * 13 else Double.NaN;
P26.SetDefaultColor(GlobalColor("Puts"));
P26.SetLineWeight(barWeight);

rec p27_D = if IsNaN(close) then p27_D[1] else Ceil((p27_V / OI_max) * barLength);
plot P27 = if p27_D >= extBar and extBar != 0 then centerStrike - barOffset + strikespac * 13 else Double.NaN;
P27.SetDefaultColor(GlobalColor("Puts"));
P27.SetLineWeight(barWeight);

rec p28_D = if IsNaN(close) then p28_D[1] else Ceil((p28_V / OI_max) * barLength);
plot P28 = if p28_D >= extBar and extBar != 0 then centerStrike - barOffset - strikespac * 14 else Double.NaN;
P28.SetDefaultColor(GlobalColor("Puts"));
P28.SetLineWeight(barWeight);

rec p29_D = if IsNaN(close) then p29_D[1] else Ceil((p29_V / OI_max) * barLength);
plot P29 = if p29_D >= extBar and extBar != 0 then centerStrike - barOffset + strikespac * 14 else Double.NaN;
P29.SetDefaultColor(GlobalColor("Puts"));
P29.SetLineWeight(barWeight);

rec p30_D = if IsNaN(close) then p30_D[1] else Ceil((p30_V / OI_max) * barLength);
plot P30 = if p30_D >= extBar and extBar != 0 then centerStrike - barOffset - strikespac * 15 else Double.NaN;
P30.SetDefaultColor(GlobalColor("Puts"));
P30.SetLineWeight(barWeight);

rec p31_D = if IsNaN(close) then p31_D[1] else Ceil((p31_V / OI_max) * barLength);
plot P31 = if p31_D >= extBar and extBar != 0 then centerStrike - barOffset + strikespac * 15 else Double.NaN;
P31.SetDefaultColor(GlobalColor("Puts"));
P31.SetLineWeight(barWeight);

rec p32_D = if IsNaN(close) then p32_D[1] else Ceil((p32_V / OI_max) * barLength);
plot P32 = if p32_D >= extBar and extBar != 0 then centerStrike - barOffset - strikespac * 16 else Double.NaN;
P32.SetDefaultColor(GlobalColor("Puts"));
P32.SetLineWeight(barWeight);

rec p33_D = if IsNaN(close) then p33_D[1] else Ceil((p33_V / OI_max) * barLength);
plot P33 = if p33_D >= extBar and extBar != 0 then centerStrike - barOffset + strikespac * 16 else Double.NaN;
P33.SetDefaultColor(GlobalColor("Puts"));
P33.SetLineWeight(barWeight);

rec p34_D = if IsNaN(close) then p34_D[1] else Ceil((p34_V / OI_max) * barLength);
plot P34 = if p34_D >= extBar and extBar != 0 then centerStrike - barOffset - strikespac * 17 else Double.NaN;
P34.SetDefaultColor(GlobalColor("Puts"));
P34.SetLineWeight(barWeight);

rec p35_D = if IsNaN(close) then p35_D[1] else Ceil((p35_V / OI_max) * barLength);
plot P35 = if p35_D >= extBar and extBar != 0 then centerStrike - barOffset + strikespac * 17 else Double.NaN;
P35.SetDefaultColor(GlobalColor("Puts"));
P35.SetLineWeight(barWeight);

rec p36_D = if IsNaN(close) then p36_D[1] else Ceil((p36_V / OI_max) * barLength);
plot P36 = if p36_D >= extBar and extBar != 0 then centerStrike - barOffset - strikespac * 18 else Double.NaN;
P36.SetDefaultColor(GlobalColor("Puts"));
P36.SetLineWeight(barWeight);

rec p37_D = if IsNaN(close) then p37_D[1] else Ceil((p37_V / OI_max) * barLength);
plot P37 = if p37_D >= extBar and extBar != 0 then centerStrike - barOffset + strikespac * 18 else Double.NaN;
P37.SetDefaultColor(GlobalColor("Puts"));
P37.SetLineWeight(barWeight);

rec p38_D = if IsNaN(close) then p38_D[1] else Ceil((p38_V / OI_max) * barLength);
plot P38 = if p38_D >= extBar and extBar != 0 then centerStrike - barOffset - strikespac * 19 else Double.NaN;
P38.SetDefaultColor(GlobalColor("Puts"));
P38.SetLineWeight(barWeight);


C1.SetPaintingStrategy(PaintingStrategy.DASHES);
C2.SetPaintingStrategy(PaintingStrategy.DASHES);
C3.SetPaintingStrategy(PaintingStrategy.DASHES);
C4.SetPaintingStrategy(PaintingStrategy.DASHES);
C5.SetPaintingStrategy(PaintingStrategy.DASHES);
C6.SetPaintingStrategy(PaintingStrategy.DASHES);
C7.SetPaintingStrategy(PaintingStrategy.DASHES);
C8.SetPaintingStrategy(PaintingStrategy.DASHES);
C9.SetPaintingStrategy(PaintingStrategy.DASHES);
C10.SetPaintingStrategy(PaintingStrategy.DASHES);
C11.SetPaintingStrategy(PaintingStrategy.DASHES);

C12.SetPaintingStrategy(PaintingStrategy.DASHES);
C13.SetPaintingStrategy(PaintingStrategy.DASHES);
C14.SetPaintingStrategy(PaintingStrategy.DASHES);
C15.SetPaintingStrategy(PaintingStrategy.DASHES);
C16.SetPaintingStrategy(PaintingStrategy.DASHES);
C17.SetPaintingStrategy(PaintingStrategy.DASHES);
C18.SetPaintingStrategy(PaintingStrategy.DASHES);
C19.SetPaintingStrategy(PaintingStrategy.DASHES);
C20.SetPaintingStrategy(PaintingStrategy.DASHES);
C21.SetPaintingStrategy(PaintingStrategy.DASHES);
C22.SetPaintingStrategy(PaintingStrategy.DASHES);
C23.SetPaintingStrategy(PaintingStrategy.DASHES);
C24.SetPaintingStrategy(PaintingStrategy.DASHES);
C25.SetPaintingStrategy(PaintingStrategy.DASHES);
C26.SetPaintingStrategy(PaintingStrategy.DASHES);
C27.SetPaintingStrategy(PaintingStrategy.DASHES);
C28.SetPaintingStrategy(PaintingStrategy.DASHES);
C29.SetPaintingStrategy(PaintingStrategy.DASHES);
C30.SetPaintingStrategy(PaintingStrategy.DASHES);

C31.SetPaintingStrategy(PaintingStrategy.DASHES);
C32.SetPaintingStrategy(PaintingStrategy.DASHES);
C33.SetPaintingStrategy(PaintingStrategy.DASHES);
C34.SetPaintingStrategy(PaintingStrategy.DASHES);
C35.SetPaintingStrategy(PaintingStrategy.DASHES);
C36.SetPaintingStrategy(PaintingStrategy.DASHES);
C37.SetPaintingStrategy(PaintingStrategy.DASHES);
C38.SetPaintingStrategy(PaintingStrategy.DASHES);


P1.SetPaintingStrategy(PaintingStrategy.DASHES);
P2.SetPaintingStrategy(PaintingStrategy.DASHES);
P3.SetPaintingStrategy(PaintingStrategy.DASHES);
P4.SetPaintingStrategy(PaintingStrategy.DASHES);
P5.SetPaintingStrategy(PaintingStrategy.DASHES);
P6.SetPaintingStrategy(PaintingStrategy.DASHES);
P7.SetPaintingStrategy(PaintingStrategy.DASHES);
P8.SetPaintingStrategy(PaintingStrategy.DASHES);
P9.SetPaintingStrategy(PaintingStrategy.DASHES);
P10.SetPaintingStrategy(PaintingStrategy.DASHES);
P11.SetPaintingStrategy(PaintingStrategy.DASHES);

P12.SetPaintingStrategy(PaintingStrategy.DASHES);
P13.SetPaintingStrategy(PaintingStrategy.DASHES);
P14.SetPaintingStrategy(PaintingStrategy.DASHES);
P15.SetPaintingStrategy(PaintingStrategy.DASHES);
P16.SetPaintingStrategy(PaintingStrategy.DASHES);
P17.SetPaintingStrategy(PaintingStrategy.DASHES);
P18.SetPaintingStrategy(PaintingStrategy.DASHES);
P19.SetPaintingStrategy(PaintingStrategy.DASHES);
P20.SetPaintingStrategy(PaintingStrategy.DASHES);
P21.SetPaintingStrategy(PaintingStrategy.DASHES);
P22.SetPaintingStrategy(PaintingStrategy.DASHES);
P23.SetPaintingStrategy(PaintingStrategy.DASHES);
P24.SetPaintingStrategy(PaintingStrategy.DASHES);
P25.SetPaintingStrategy(PaintingStrategy.DASHES);
P26.SetPaintingStrategy(PaintingStrategy.DASHES);
P27.SetPaintingStrategy(PaintingStrategy.DASHES);
P28.SetPaintingStrategy(PaintingStrategy.DASHES);
P29.SetPaintingStrategy(PaintingStrategy.DASHES);
P30.SetPaintingStrategy(PaintingStrategy.DASHES);

P31.SetPaintingStrategy(PaintingStrategy.DASHES);
P32.SetPaintingStrategy(PaintingStrategy.DASHES);
P33.SetPaintingStrategy(PaintingStrategy.DASHES);
P34.SetPaintingStrategy(PaintingStrategy.DASHES);
P35.SetPaintingStrategy(PaintingStrategy.DASHES);
P36.SetPaintingStrategy(PaintingStrategy.DASHES);
P37.SetPaintingStrategy(PaintingStrategy.DASHES);
P38.SetPaintingStrategy(PaintingStrategy.DASHES);




rec c1_V_e = if IsNaN(close) and !IsNaN(close[1]) then c1_V[1] else c1_V_e[1];
rec c2_V_e = if IsNaN(close) and !IsNaN(close[1]) then c2_V[1] else c2_V_e[1];
rec c3_V_e = if IsNaN(close) and !IsNaN(close[1]) then c3_V[1] else c3_V_e[1];
rec c4_V_e = if IsNaN(close) and !IsNaN(close[1]) then c4_V[1] else c4_V_e[1];
rec c5_V_e = if IsNaN(close) and !IsNaN(close[1]) then c5_V[1] else c5_V_e[1];
rec c6_V_e = if IsNaN(close) and !IsNaN(close[1]) then c6_V[1] else c6_V_e[1];
rec c7_V_e = if IsNaN(close) and !IsNaN(close[1]) then c7_V[1] else c7_V_e[1];
rec c8_V_e = if IsNaN(close) and !IsNaN(close[1]) then c8_V[1] else c8_V_e[1];
rec c9_V_e = if IsNaN(close) and !IsNaN(close[1]) then c9_V[1] else c9_V_e[1];
rec c10_V_e = if IsNaN(close) and !IsNaN(close[1]) then c10_V[1] else c10_V_e[1];
rec c11_V_e = if IsNaN(close) and !IsNaN(close[1]) then c11_V[1] else c11_V_e[1];

rec c12_V_e = if IsNaN(close) and !IsNaN(close[1]) then c12_V[1] else c12_V_e[1];
rec c13_V_e = if IsNaN(close) and !IsNaN(close[1]) then c13_V[1] else c13_V_e[1];
rec c14_V_e = if IsNaN(close) and !IsNaN(close[1]) then c14_V[1] else c14_V_e[1];
rec c15_V_e = if IsNaN(close) and !IsNaN(close[1]) then c15_V[1] else c15_V_e[1];
rec c16_V_e = if IsNaN(close) and !IsNaN(close[1]) then c16_V[1] else c16_V_e[1];
rec c17_V_e = if IsNaN(close) and !IsNaN(close[1]) then c17_V[1] else c17_V_e[1];
rec c18_V_e = if IsNaN(close) and !IsNaN(close[1]) then c18_V[1] else c18_V_e[1];
rec c19_V_e = if IsNaN(close) and !IsNaN(close[1]) then c19_V[1] else c19_V_e[1];
rec c20_V_e = if IsNaN(close) and !IsNaN(close[1]) then c20_V[1] else c20_V_e[1];
rec c21_V_e = if IsNaN(close) and !IsNaN(close[1]) then c21_V[1] else c21_V_e[1];
rec c22_V_e = if IsNaN(close) and !IsNaN(close[1]) then c22_V[1] else c22_V_e[1];
rec c23_V_e = if IsNaN(close) and !IsNaN(close[1]) then c23_V[1] else c23_V_e[1];
rec c24_V_e = if IsNaN(close) and !IsNaN(close[1]) then c24_V[1] else c24_V_e[1];
rec c25_V_e = if IsNaN(close) and !IsNaN(close[1]) then c25_V[1] else c25_V_e[1];
rec c26_V_e = if IsNaN(close) and !IsNaN(close[1]) then c26_V[1] else c26_V_e[1];
rec c27_V_e = if IsNaN(close) and !IsNaN(close[1]) then c27_V[1] else c27_V_e[1];
rec c28_V_e = if IsNaN(close) and !IsNaN(close[1]) then c28_V[1] else c28_V_e[1];
rec c29_V_e = if IsNaN(close) and !IsNaN(close[1]) then c29_V[1] else c29_V_e[1];
rec c30_V_e = if IsNaN(close) and !IsNaN(close[1]) then c30_V[1] else c30_V_e[1];

rec c31_V_e = if IsNaN(close) and !IsNaN(close[1]) then c31_V[1] else c31_V_e[1];
rec c32_V_e = if IsNaN(close) and !IsNaN(close[1]) then c32_V[1] else c32_V_e[1];
rec c33_V_e = if IsNaN(close) and !IsNaN(close[1]) then c33_V[1] else c33_V_e[1];
rec c34_V_e = if IsNaN(close) and !IsNaN(close[1]) then c34_V[1] else c34_V_e[1];
rec c35_V_e = if IsNaN(close) and !IsNaN(close[1]) then c35_V[1] else c35_V_e[1];
rec c36_V_e = if IsNaN(close) and !IsNaN(close[1]) then c36_V[1] else c36_V_e[1];
rec c37_V_e = if IsNaN(close) and !IsNaN(close[1]) then c37_V[1] else c37_V_e[1];
rec c38_V_e = if IsNaN(close) and !IsNaN(close[1]) then c38_V[1] else c38_V_e[1];


rec p1_V_e = if IsNaN(close) and !IsNaN(close[1]) then p1_V[1] else p1_V_e[1];
rec p2_V_e = if IsNaN(close) and !IsNaN(close[1]) then p2_V[1] else p2_V_e[1];
rec p3_V_e = if IsNaN(close) and !IsNaN(close[1]) then p3_V[1] else p3_V_e[1];
rec p4_V_e = if IsNaN(close) and !IsNaN(close[1]) then p4_V[1] else p4_V_e[1];
rec p5_V_e = if IsNaN(close) and !IsNaN(close[1]) then p5_V[1] else p5_V_e[1];
rec p6_V_e = if IsNaN(close) and !IsNaN(close[1]) then p6_V[1] else p6_V_e[1];
rec p7_V_e = if IsNaN(close) and !IsNaN(close[1]) then p7_V[1] else p7_V_e[1];
rec p8_V_e = if IsNaN(close) and !IsNaN(close[1]) then p8_V[1] else p8_V_e[1];
rec p9_V_e = if IsNaN(close) and !IsNaN(close[1]) then p9_V[1] else p9_V_e[1];
rec p10_V_e = if IsNaN(close) and !IsNaN(close[1]) then p10_V[1] else p10_V_e[1];
rec p11_V_e = if IsNaN(close) and !IsNaN(close[1]) then p11_V[1] else p11_V_e[1];

rec p12_V_e = if IsNaN(close) and !IsNaN(close[1]) then p12_V[1] else p12_V_e[1];
rec p13_V_e = if IsNaN(close) and !IsNaN(close[1]) then p13_V[1] else p13_V_e[1];
rec p14_V_e = if IsNaN(close) and !IsNaN(close[1]) then p14_V[1] else p14_V_e[1];
rec p15_V_e = if IsNaN(close) and !IsNaN(close[1]) then p15_V[1] else p15_V_e[1];
rec p16_V_e = if IsNaN(close) and !IsNaN(close[1]) then p16_V[1] else p16_V_e[1];
rec p17_V_e = if IsNaN(close) and !IsNaN(close[1]) then p17_V[1] else p17_V_e[1];
rec p18_V_e = if IsNaN(close) and !IsNaN(close[1]) then p18_V[1] else p18_V_e[1];
rec p19_V_e = if IsNaN(close) and !IsNaN(close[1]) then p19_V[1] else p19_V_e[1];
rec p20_V_e = if IsNaN(close) and !IsNaN(close[1]) then p20_V[1] else p20_V_e[1];
rec p21_V_e = if IsNaN(close) and !IsNaN(close[1]) then p21_V[1] else p21_V_e[1];
rec p22_V_e = if IsNaN(close) and !IsNaN(close[1]) then p22_V[1] else p22_V_e[1];
rec p23_V_e = if IsNaN(close) and !IsNaN(close[1]) then p23_V[1] else p23_V_e[1];
rec p24_V_e = if IsNaN(close) and !IsNaN(close[1]) then p24_V[1] else p24_V_e[1];
rec p25_V_e = if IsNaN(close) and !IsNaN(close[1]) then p25_V[1] else p25_V_e[1];
rec p26_V_e = if IsNaN(close) and !IsNaN(close[1]) then p26_V[1] else p26_V_e[1];
rec p27_V_e = if IsNaN(close) and !IsNaN(close[1]) then p27_V[1] else p27_V_e[1];
rec p28_V_e = if IsNaN(close) and !IsNaN(close[1]) then p28_V[1] else p28_V_e[1];
rec p29_V_e = if IsNaN(close) and !IsNaN(close[1]) then p29_V[1] else p29_V_e[1];
rec p30_V_e = if IsNaN(close) and !IsNaN(close[1]) then p30_V[1] else p30_V_e[1];

rec p31_V_e = if IsNaN(close) and !IsNaN(close[1]) then p31_V[1] else p31_V_e[1];
rec p32_V_e = if IsNaN(close) and !IsNaN(close[1]) then p32_V[1] else p32_V_e[1];
rec p33_V_e = if IsNaN(close) and !IsNaN(close[1]) then p33_V[1] else p33_V_e[1];
rec p34_V_e = if IsNaN(close) and !IsNaN(close[1]) then p34_V[1] else p34_V_e[1];
rec p35_V_e = if IsNaN(close) and !IsNaN(close[1]) then p35_V[1] else p35_V_e[1];
rec p36_V_e = if IsNaN(close) and !IsNaN(close[1]) then p36_V[1] else p36_V_e[1];
rec p37_V_e = if IsNaN(close) and !IsNaN(close[1]) then p37_V[1] else p37_V_e[1];
rec p38_V_e = if IsNaN(close) and !IsNaN(close[1]) then p38_V[1] else p38_V_e[1];

AddChartBubble(c1_D == extBar, C1, concat("", c1_V_e), globalColor("Calls"), yes );

AddChartBubble(c2_D == extBar, C2, concat("", c2_V_e), globalColor("Calls"), yes );

AddChartBubble(c3_D == extBar, C3, concat("", c3_V_e), globalColor("Calls"), yes );

AddChartBubble(c4_D == extBar, C4, concat("", c4_V_e), globalColor("Calls"), yes );

AddChartBubble(c5_D == extBar, C5, concat("", c5_V_e), globalColor("Calls"), yes );

AddChartBubble(c6_D == extBar, C6, concat("", c6_V_e), globalColor("Calls"), yes );

AddChartBubble(c7_D == extBar, C7, concat("", c7_V_e), globalColor("Calls"), yes );

AddChartBubble(c8_D == extBar, C8, concat("", c8_V_e), globalColor("Calls"), yes );

AddChartBubble(c9_D == extBar, C9, concat("", c9_V_e), globalColor("Calls"), yes );

AddChartBubble(c10_D == extBar, C10, concat("", c10_V_e), globalColor("Calls"), yes );

AddChartBubble(c11_D == extBar, C11, concat("", c11_V_e), globalColor("Calls"), yes );



AddChartBubble(c12_D == extBar, C12, concat("", c12_V_e), globalColor("Calls"), yes );

AddChartBubble(c13_D == extBar, C13, concat("", c13_V_e), globalColor("Calls"), yes );

AddChartBubble(c14_D == extBar, C14, concat("", c14_V_e), globalColor("Calls"), yes );

AddChartBubble(c15_D == extBar, C15, concat("", c15_V_e), globalColor("Calls"), yes );

AddChartBubble(c16_D == extBar, C16, concat("", c16_V_e), globalColor("Calls"), yes );

AddChartBubble(c17_D == extBar, C17, concat("", c17_V_e), globalColor("Calls"), yes );

AddChartBubble(c18_D == extBar, C18, concat("", c18_V_e), globalColor("Calls"), yes );

AddChartBubble(c19_D == extBar, C19, concat("", c19_V_e), globalColor("Calls"), yes );

AddChartBubble(c20_D == extBar, C20, concat("", c20_V_e), globalColor("Calls"), yes );

AddChartBubble(c21_D == extBar, C21, concat("", c21_V_e), globalColor("Calls"), yes );

AddChartBubble(c22_D == extBar, C22, concat("", c22_V_e), globalColor("Calls"), yes );

AddChartBubble(c23_D == extBar, C23, concat("", c23_V_e), globalColor("Calls"), yes );

AddChartBubble(c24_D == extBar, C24, concat("", c24_V_e), globalColor("Calls"), yes );

AddChartBubble(c25_D == extBar, C25, concat("", c25_V_e), globalColor("Calls"), yes );

AddChartBubble(c26_D == extBar, C26, concat("", c26_V_e), globalColor("Calls"), yes );

AddChartBubble(c27_D == extBar, C27, concat("", c27_V_e), globalColor("Calls"), yes );

AddChartBubble(c28_D == extBar, C28, concat("", c28_V_e), globalColor("Calls"), yes );

AddChartBubble(c29_D == extBar, C29, concat("", c29_V_e), globalColor("Calls"), yes );

AddChartBubble(c30_D == extBar, C30, concat("", c30_V_e), globalColor("Calls"), yes );



AddChartBubble(c31_D == extBar, C31, concat("", c31_V_e), globalColor("Calls"), yes );

AddChartBubble(c32_D == extBar, C32, concat("", c32_V_e), globalColor("Calls"), yes );

AddChartBubble(c33_D == extBar, C33, concat("", c33_V_e), globalColor("Calls"), yes );

AddChartBubble(c34_D == extBar, C34, concat("", c34_V_e), globalColor("Calls"), yes );

AddChartBubble(c35_D == extBar, C35, concat("", c35_V_e), globalColor("Calls"), yes );

AddChartBubble(c36_D == extBar, C36, concat("", c36_V_e), globalColor("Calls"), yes );

AddChartBubble(c37_D == extBar, C37, concat("", c37_V_e), globalColor("Calls"), yes );

AddChartBubble(c38_D == extBar, C38, concat("", c38_V_e), globalColor("Calls"), yes );





AddChartBubble(p1_D == extBar, P1, concat("", p1_V_e), globalColor("Puts"), no );

AddChartBubble(p2_D == extBar, P2, concat("", p2_V_e), globalColor("Puts"), no );

AddChartBubble(p3_D == extBar, P3, concat("", p3_V_e), globalColor("Puts"), no );

AddChartBubble(p4_D == extBar, P4, concat("", p4_V_e), globalColor("Puts"), no );

AddChartBubble(p5_D == extBar, P5, concat("", p5_V_e), globalColor("Puts"), no );

AddChartBubble(p6_D == extBar, P6, concat("", p6_V_e), globalColor("Puts"), no );

AddChartBubble(p7_D == extBar, P7, concat("", p7_V_e), globalColor("Puts"), no );

AddChartBubble(p8_D == extBar, P8, concat("", p8_V_e), globalColor("Puts"), no );

AddChartBubble(p9_D == extBar, P9, concat("", p9_V_e), globalColor("Puts"), no );

AddChartBubble(p10_D == extBar, P10, concat("", p10_V_e), globalColor("Puts"), no );

AddChartBubble(p11_D == extBar, P11, concat("", p11_V_e), globalColor("Puts"), no );



AddChartBubble(p12_D == extBar, P12, concat("", p12_V_e), globalColor("Puts"), no );

AddChartBubble(p13_D == extBar, P13, concat("", p13_V_e), globalColor("Puts"), no );

AddChartBubble(p14_D == extBar, P14, concat("", p14_V_e), globalColor("Puts"), no );

AddChartBubble(p15_D == extBar, P15, concat("", p15_V_e), globalColor("Puts"), no );

AddChartBubble(p16_D == extBar, P16, concat("", p16_V_e), globalColor("Puts"), no );

AddChartBubble(p17_D == extBar, P17, concat("", p17_V_e), globalColor("Puts"), no );

AddChartBubble(p18_D == extBar, P18, concat("", p18_V_e), globalColor("Puts"), no );

AddChartBubble(p19_D == extBar, P19, concat("", p19_V_e), globalColor("Puts"), no );

AddChartBubble(p20_D == extBar, P20, concat("", P20_V_e), globalColor("Calls"), yes );

AddChartBubble(p21_D == extBar, P21, concat("", p21_V_e), globalColor("Calls"), yes );

AddChartBubble(p22_D == extBar, P22, concat("", p22_V_e), globalColor("Calls"), yes );

AddChartBubble(p23_D == extBar, P23, concat("", p23_V_e), globalColor("Calls"), yes );

AddChartBubble(p24_D == extBar, P24, concat("", p24_V_e), globalColor("Calls"), yes );

AddChartBubble(p25_D == extBar, P25, concat("", p25_V_e), globalColor("Calls"), yes );

AddChartBubble(p26_D == extBar, P26, concat("", p26_V_e), globalColor("Calls"), yes );

AddChartBubble(p27_D == extBar, P27, concat("", p27_V_e), globalColor("Calls"), yes );

AddChartBubble(p28_D == extBar, P28, concat("", p28_V_e), globalColor("Calls"), yes );

AddChartBubble(p29_D == extBar, P29, concat("", p29_V_e), globalColor("Calls"), yes );

AddChartBubble(p30_D == extBar, P30, concat("", p30_V_e), globalColor("Calls"), yes );



AddChartBubble(p31_D == extBar, P31, concat("", p31_V_e), globalColor("Calls"), yes );

AddChartBubble(p32_D == extBar, P32, concat("", p32_V_e), globalColor("Calls"), yes );

AddChartBubble(p33_D == extBar, P33, concat("", p33_V_e), globalColor("Calls"), yes );

AddChartBubble(p34_D == extBar, P34, concat("", p34_V_e), globalColor("Calls"), yes );

AddChartBubble(p35_D == extBar, P35, concat("", p35_V_e), globalColor("Calls"), yes );

AddChartBubble(p36_D == extBar, P36, concat("", p36_V_e), globalColor("Calls"), yes );

AddChartBubble(p37_D == extBar, P37, concat("", p37_V_e), globalColor("Calls"), yes );

AddChartBubble(p38_D == extBar, P38, concat("", p38_V_e), globalColor("Calls"), yes );




C1.HideBubble();
C2.HideBubble();
C3.HideBubble();
C4.HideBubble();
C5.HideBubble();
C6.HideBubble();
C7.HideBubble();
C8.HideBubble();
C9.HideBubble();
C10.HideBubble();
C11.HideBubble();

C12.HideBubble();
C13.HideBubble();
C14.HideBubble();
C15.HideBubble();
C16.HideBubble();
C17.HideBubble();
C18.HideBubble();
C19.HideBubble();
C20.HideBubble();
C21.HideBubble();
C22.HideBubble();
C23.HideBubble();
C24.HideBubble();
C25.HideBubble();
C26.HideBubble();
C27.HideBubble();
C28.HideBubble();
C29.HideBubble();
C30.HideBubble();

C31.HideBubble();
C32.HideBubble();
C33.HideBubble();
C34.HideBubble();
C35.HideBubble();
C36.HideBubble();
C37.HideBubble();
C38.HideBubble();

P1.HideBubble();
P2.HideBubble();
P3.HideBubble();
P4.HideBubble();
P5.HideBubble();
P6.HideBubble();
P7.HideBubble();
P8.HideBubble();
P9.HideBubble();
P10.HideBubble();
P11.HideBubble();

P12.HideBubble();
P13.HideBubble();
P14.HideBubble();
P15.HideBubble();
P16.HideBubble();
P17.HideBubble();
P18.HideBubble();
P19.HideBubble();
P20.HideBubble();
P21.HideBubble();
P22.HideBubble();
P23.HideBubble();
P24.HideBubble();
P25.HideBubble();
P26.HideBubble();
P27.HideBubble();
P28.HideBubble();
P29.HideBubble();
P30.HideBubble();

P31.HideBubble();
P32.HideBubble();
P33.HideBubble();
P34.HideBubble();
P35.HideBubble();
P36.HideBubble();
P37.HideBubble();
P38.HideBubble();

C1.HideTitle();
C2.HideTitle();
C3.HideTitle();
C4.HideTitle();
C5.HideTitle();
C6.HideTitle();
C7.HideTitle();
C8.HideTitle();
C9.HideTitle();
C10.HideTitle();
C11.HideTitle();

C12.HideTitle();
C13.HideTitle();
C14.HideTitle();
C15.HideTitle();
C16.HideTitle();
C17.HideTitle();
C18.HideTitle();
C19.HideTitle();
C20.HideTitle();
C21.HideTitle();
C22.HideTitle();
C23.HideTitle();
C24.HideTitle();
C25.HideTitle();
C26.HideTitle();
C27.HideTitle();
C28.HideTitle();
C29.HideTitle();
C30.HideTitle();

C31.HideTitle();
C32.HideTitle();
C33.HideTitle();
C34.HideTitle();
C35.HideTitle();
C36.HideTitle();
C37.HideTitle();
C38.HideTitle();

P1.HideTitle();
P2.HideTitle();
P3.HideTitle();
P4.HideTitle();
P5.HideTitle();
P6.HideTitle();
P7.HideTitle();
P8.HideTitle();
P9.HideTitle();
P10.HideTitle();
P11.HideTitle();

P12.HideTitle();
P13.HideTitle();
P14.HideTitle();
P15.HideTitle();
P16.HideTitle();
P17.HideTitle();
P18.HideTitle();
P19.HideTitle();
P20.HideTitle();
P21.HideTitle();
P22.HideTitle();
P23.HideTitle();
P24.HideTitle();
P25.HideTitle();
P26.HideTitle();
P27.HideTitle();
P28.HideTitle();
P29.HideTitle();
P30.HideTitle();

P31.HideTitle();
P32.HideTitle();
P33.HideTitle();
P34.HideTitle();
P35.HideTitle();
P36.HideTitle();
P37.HideTitle();
P38.HideTitle();
 
Last edited:
Thanks everyone, this thing is pretty much 80% done.

Finalizing things
1. Need to expand the range of strikes from 19 to 60 for open interest profile.
2. Need an auto plot function for current price for heatmap as a line
3. Need manual mode for heatmap for weekly exp.
4. Need to fetch historical data for heatmap.

Original from @melarue on twitter (Claimed that he programmed himself, I highly doubt it, went private on twitter as soon as I asked him)

New (old code from thinkscripter and modified by friends here)

http://tos.mx/8XZQOG3 (Open Interest Profile)
http://tos.mx/BpXAtTN (Heatmap)

sMWWAA4.png
 
so im really interested in how to get put/call options strike oi to show up like volume profile and the lower heat map similar to this example from @melarue on twitter. I have no idea how to even get started on something like this. Any hints or expert coders out there willing to reverse engineer this?

Ideally, the heat map portion could be shown on the upper chart as well, able to be mapped to strikes on today and future expirations as a dynamic color grid for daily, weekly, monthly options. Options codes should auto-generate.

this could be tweaked to show gamma levels as well -- lots of potential.

anyone up to the challenge? :unsure:
 
so im really interested in how to get put/call options strike oi to show up like volume profile and the lower heat map similar to this example from @melarue on twitter. I have no idea how to even get started on something like this. Any hints or expert coders out there willing to reverse engineer this?

Ideally, the heat map portion could be shown on the upper chart as well, able to be mapped to strikes on today and future expirations as a dynamic color grid for daily, weekly, monthly options. Options codes should auto-generate.

this could be tweaked to show gamma levels as well -- lots of potential.

anyone up to the challenge? :unsure:
There’s something called Data profile, I’d start there! I have a busy weekend ahead , but I’ll try to see if I can come up with something
 
There’s something called Data profile, I’d start there! I have a busy weekend ahead , but I’ll try to see if I can come up with something
I have a free version from another website that no longer works for some reason.

Maybe it can help

Code:
# TS_OptionVolumeProfileFull
# (c) 2013 ThinkScripter, LLC
# [URL]http://www.thinkscripter.com[/URL]
# [email][email protected][/email]
# Last Update 27 Jan 2013
# Next3rdFriday code (c) thinkorswim

#hint barLength: The number of bars used to calculate the ADX <b>(Default is 14)</b>


# Next3rdFriday excerpt
input series = 1;
input show_label = yes;

def CurrentYear = getYear();
def CurrentMonth = getMonth();
def CurrentDOM = getDayOfMonth(getYyyyMmDd());

def Day1DOW1 = getDayOfWeek(CurrentYear * 10000 + CurrentMonth * 100 + 1);
def FirstFridayDOM1 = if Day1DOW1 < 6
    then 6 - Day1DOW1
    else if Day1DOW1 == 6
        then 7
        else 6;
def RollDOM = FirstFridayDOM1 + 14;
def ExpMonth1 = if RollDOM > CurrentDOM
    then CurrentMonth + series - 1
    else CurrentMonth + series;
def ExpMonth2 = if ExpMonth1 > 12
    then ExpMonth1 - 12
    else ExpMonth1;
def ExpYear = if ExpMonth1 > 12
    then CurrentYear + 1
    else CurrentYear;
def Day1DOW = getDayOfWeek(ExpYear * 10000 + ExpMonth2 * 100 + 1);
def FirstFridayDOM = if Day1DOW < 6
    then 6 - Day1DOW
    else if Day1DOW == 6
        then 7
        else 6;
def ExpDOM = FirstFridayDOM + 15;


def maxStrikeSpacing = 25;
input mode = {default AUTO, MANUAL};
input manualCenterStrike = 147.0;
input manualStrikeSpacing = 1.0;


rec centerStrike =  if (mode == mode.AUTO and !IsNaN(close)) then roundDown(close / 10.0, 0) * 10.0 else if (mode == mode.MANUAL and !IsNaN(close)) then manualCenterStrike else centerStrike[1];
def strikeSpacingC = fold i = 1 to maxStrikeSpacing with spacing = 0 do if !IsNaN( volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("C", centerStrike + (maxStrikeSpacing - i))))) then maxStrikeSpacing - i else spacing;

rec strikeSpacing = if (mode == mode.AUTO and !IsNaN(close)) then strikeSpacingC else if (mode == mode.MANUAL and !IsNaN(close)) then manualStrikeSpacing else strikeSpacing[1];
rec barOffset = if !IsNaN(close) then strikeSpacing / 10.0 else barOffset[1];

AddLabel(show_label, concat("Expiration: ", concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM))), color.white);
AddLabel(show_label, concat("Strike Spacing: ", strikeSpacing), color.cyan);

DefineGlobalColor("Calls", color.lime);
DefineGlobalColor("Puts", color.violet);

def barWeight = 5;

# Number of bars to right of current bar for display
# Should be a positiveVolumeIndex number

input displayOffset = 5;

# Number of bars of right space minus 5
input barLength = 45;


rec extBar = if IsNaN(close[displayOffset]) then extBar[1] + 1 else 0;

def c1_V_d =  volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("C", centerStrike )));

def c2_V_d =  volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("C", centerStrike - strikeSpacing)));
def c3_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("C", centerStrike - strikeSpacing * 2)));
def c4_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("C", centerStrike - strikeSpacing * 3)));

def c5_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("C", centerStrike + strikeSpacing)));
def c6_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("C", centerStrike + strikeSpacing * 2)));
def c7_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("C", centerStrike + strikeSpacing * 3)));

def c8_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("C", centerStrike - strikeSpacing * 4)));
def c9_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("C", centerStrike + strikeSpacing * 4)));
def c10_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("C", centerStrike - strikeSpacing * 5)));
def c11_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("C", centerStrike + strikeSpacing * 5)));
def c12_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("C", centerStrike - strikeSpacing * 6)));
def c13_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("C", centerStrike + strikeSpacing * 6)));
def c14_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("C", centerStrike - strikeSpacing * 7)));
def c15_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("C", centerStrike + strikeSpacing * 7)));
def c16_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("C", centerStrike - strikeSpacing * 8)));
def c17_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("C", centerStrike + strikeSpacing * 8)));
def c18_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("C", centerStrike - strikeSpacing * 9)));
def c19_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("C", centerStrike + strikeSpacing * 9)));

def p1_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("P", centerStrike)));

def p2_V_d =  volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("P", centerStrike - strikeSpacing)));
def p3_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("P", centerStrike - strikeSpacing * 2)));
def p4_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("P", centerStrike - strikeSpacing * 3)));

def p5_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("P", centerStrike + strikeSpacing)));
def p6_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("P", centerStrike + strikeSpacing * 2)));
def p7_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("P", centerStrike + strikeSpacing * 3)));

def p8_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("P", centerStrike - strikeSpacing * 4)));
def p9_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("P", centerStrike + strikeSpacing * 4)));
def p10_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("P", centerStrike - strikeSpacing * 5)));
def p11_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("P", centerStrike + strikeSpacing * 5)));
def p12_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("P", centerStrike - strikeSpacing * 6)));
def p13_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("P", centerStrike + strikeSpacing * 6)));
def p14_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("P", centerStrike - strikeSpacing * 7)));
def p15_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("P", centerStrike + strikeSpacing * 7)));
def p16_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("P", centerStrike - strikeSpacing * 8)));
def p17_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("P", centerStrike + strikeSpacing * 8)));
def p18_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("P", centerStrike - strikeSpacing * 9)));
def p19_V_d = volume(concat(concat(".", concat(getSymbolPart(), concat(concat(EXPYear - 2000, if ExpMonth2 <= 9 then concat("0", ExpMonth2) else concat("", ExpMonth2)), if ExpDOM <= 9 then concat("0", ExpDOM) else concat("", ExpDOM)))), concat("P", centerStrike + strikeSpacing * 9)));

def c1_V = if !IsNaN(c1_V_d) then c1_V_d else 0;
def c2_V = if !IsNaN(c2_V_d) then c2_V_d else 0;
def c3_V = if !IsNaN(c3_V_d) then c3_V_d else 0;
def c4_V = if !IsNaN(c4_V_d) then c4_V_d else 0;
def c5_V = if !IsNaN(c5_V_d) then c5_V_d else 0;
def c6_V = if !IsNaN(c6_V_d) then c6_V_d else 0;
def c7_V = if !IsNaN(c7_V_d) then c7_V_d else 0;
def c8_V = if !IsNaN(c8_V_d) then c8_V_d else 0;
def c9_V = if !IsNaN(c9_V_d) then c9_V_d else 0;
def c10_V = if !IsNaN(c10_V_d) then c10_V_d else 0;
def c11_V = if !IsNaN(c11_V_d) then c11_V_d else 0;

def c12_V = if !IsNaN(c12_V_d) then c12_V_d else 0;
def c13_V = if !IsNaN(c13_V_d) then c13_V_d else 0;
def c14_V = if !IsNaN(c14_V_d) then c14_V_d else 0;
def c15_V = if !IsNaN(c15_V_d) then c15_V_d else 0;
def c16_V = if !IsNaN(c16_V_d) then c16_V_d else 0;
def c17_V = if !IsNaN(c17_V_d) then c17_V_d else 0;
def c18_V = if !IsNaN(c18_V_d) then c18_V_d else 0;
def c19_V = if !IsNaN(c19_V_d) then c19_V_d else 0;

def p1_V = if !IsNaN(p1_V_d) then p1_V_d else 0;
def p2_V = if !IsNaN(p2_V_d) then p2_V_d else 0;
def p3_V = if !IsNaN(p3_V_d) then p3_V_d else 0;
def p4_V = if !IsNaN(p4_V_d) then p4_V_d else 0;
def p5_V = if !IsNaN(p5_V_d) then p5_V_d else 0;
def p6_V = if !IsNaN(p6_V_d) then p6_V_d else 0;
def p7_V = if !IsNaN(p7_V_d) then p7_V_d else 0;
def p8_V = if !IsNaN(p8_V_d) then p8_V_d else 0;
def p9_V = if !IsNaN(p9_V_d) then p9_V_d else 0;
def p10_V = if !IsNaN(p10_V_d) then p10_V_d else 0;
def p11_V = if !IsNaN(p11_V_d) then p11_V_d else 0;

def p12_V = if !IsNaN(p12_V_d) then p12_V_d else 0;
def p13_V = if !IsNaN(p13_V_d) then p13_V_d else 0;
def p14_V = if !IsNaN(p14_V_d) then p14_V_d else 0;
def p15_V = if !IsNaN(p15_V_d) then p15_V_d else 0;
def p16_V = if !IsNaN(p16_V_d) then p16_V_d else 0;
def p17_V = if !IsNaN(p17_V_d) then p17_V_d else 0;
def p18_V = if !IsNaN(p18_V_d) then p18_V_d else 0;
def p19_V = if !IsNaN(p19_V_d) then p19_V_d else 0;

def c1t = Max(Max(Max(Max(c1_V, c2_V), c3_V), c4_V), c5_V);
def c2t = Max(Max(Max(Max(Max(c6_V, c7_V), c8_V), c9_V), c10_V), c11_V);

def c3t = Max(Max(Max(Max(Max(c12_V, c13_V), c14_V), c15_V), c16_V), c17_V);
def c4t = Max(c18_V, c19_V);

def p1t = Max(Max(Max(Max(p1_V, p2_V), p3_V), p4_V), p5_V);
def p2t = Max(Max(Max(Max(Max(p6_V, p7_V), p8_V), p9_V), p10_V), p11_V);

def p3t = Max(Max(Max(Max(Max(p12_V, p13_V), p14_V), p15_V), p16_V), p17_V);
def p4t = Max(p18_V, p19_V);


def c_V_max = Max(Max(Max(c1t, c2t), c3t), c4t);
def p_V_max = Max(Max(Max(p1t, p2t), p3t), p4t);
def OI_max = Max(c_V_max, p_V_max);

def cVT = c1_V + c2_V + c3_V + c4_V + c5_V + c6_V + c7_V + c8_V + c9_V + c10_V + c11_V + c12_V + c13_V + c14_V + c15_V + c16_V + c17_V + c18_V + c19_V;

def pVT = p1_V + p2_V + p3_V + p4_V + p5_V + p6_V + p7_V + p8_V + p9_V + p10_V + p11_V + p12_V + p13_V + p14_V + p15_V + p16_V + p17_V + p18_V + p19_V;

AddLabel(yes,Concat("Call Volume: ", cVT),globalColor("Calls"));
AddLabel(yes,Concat("Put Volume: ", pVT),globalColor("Puts"));

rec c1_D = if IsNaN(close) then c1_D[1] else Ceil((c1_V / OI_Max) * barLength);
plot C1 = if c1_D >= extBar and extBar != 0 then centerStrike + barOffset else double.nan;
C1.SetDefaultColor(globalColor("Calls") );
C1.SetLineWeight(barWeight);

rec c2_D = if IsNaN(close) then c2_D[1] else Ceil((c2_V / OI_Max) * barLength);
plot C2 = if c2_D >= extBar and extBar != 0 then centerStrike + barOffset - strikeSpacing else double.nan;
C2.SetDefaultColor(globalColor("Calls"));
C2.SetLineWeight(barWeight);

rec c3_D = if IsNaN(close) then c3_D[1] else Ceil((c3_V / OI_Max) * barLength);
plot C3 = if c3_D >= extBar and extBar != 0 then centerStrike + barOffset - strikeSpacing * 2 else double.nan;
C3.SetDefaultColor(globalColor("Calls"));
C3.SetLineWeight(barWeight);

rec c4_D = if IsNaN(close) then c4_D[1] else Ceil((c4_V / OI_Max) * barLength);
plot C4 = if c4_D >= extBar  and extBar != 0 then centerStrike + barOffset - strikeSpacing * 3 else double.nan;
C4.SetDefaultColor(globalColor("Calls"));
C4.SetLineWeight(barWeight);

rec c5_D = if IsNaN(close) then c5_D[1] else Ceil((c5_V / OI_Max) * barLength);
plot C5 = if c5_D >= extBar  and extBar != 0 then centerStrike + barOffset + strikeSpacing else double.nan;
C5.SetDefaultColor(globalColor("Calls"));
C5.SetLineWeight(barWeight);

rec c6_D = if IsNaN(close) then c6_D[1] else Ceil((c6_V / OI_Max) * barLength);
plot C6 = if c6_D >= extBar  and extBar != 0 then centerStrike + barOffset + strikeSpacing * 2 else double.nan;
C6.SetDefaultColor(globalColor("Calls"));
C6.SetLineWeight(barWeight);

rec c7_D = if IsNaN(close) then c7_D[1] else Ceil((c7_V / OI_Max) * barLength);
plot C7 = if c7_D >= extBar  and extBar != 0 then centerStrike + barOffset + strikeSpacing * 3 else double.nan;
C7.SetDefaultColor(globalColor("Calls"));
C7.SetLineWeight(barWeight);

rec c8_D = if IsNaN(close) then c8_D[1] else Ceil((c8_V / OI_Max) * barLength);
plot C8 = if c8_D >= extBar  and extBar != 0 then centerStrike + barOffset - strikeSpacing * 4 else double.nan;
C8.SetDefaultColor(globalColor("Calls"));
C8.SetLineWeight(barWeight);

rec c9_D = if IsNaN(close) then c9_D[1] else Ceil((c9_V / OI_Max) * barLength);
plot C9 = if c9_D >= extBar  and extBar != 0 then centerStrike + barOffset + strikeSpacing * 4 else double.nan;
C9.SetDefaultColor(globalColor("Calls"));
C9.SetLineWeight(barWeight);

rec c10_D = if IsNaN(close) then c10_D[1] else Ceil((c10_V / OI_Max) * barLength);
plot C10 = if c10_D >= extBar  and extBar != 0 then centerStrike + barOffset - strikeSpacing * 5 else double.nan;
C10.SetDefaultColor(globalColor("Calls"));
C10.SetLineWeight(barWeight);

rec c11_D = if IsNaN(close) then c11_D[1] else Ceil((c11_V / OI_Max) * barLength);
plot C11 = if c11_D >= extBar  and extBar != 0 then centerStrike + barOffset + strikeSpacing * 5 else double.nan;
C11.SetDefaultColor(globalColor("Calls"));
C11.SetLineWeight(barWeight);

rec c12_D = if IsNaN(close) then c12_D[1] else Ceil((c12_V / OI_Max) * barLength);
plot C12 = if c12_D >= extBar  and extBar != 0 then centerStrike + barOffset - strikeSpacing * 6 else double.nan;
C12.SetDefaultColor(globalColor("Calls"));
C12.SetLineWeight(barWeight);

rec c13_D = if IsNaN(close) then c13_D[1] else Ceil((c13_V / OI_Max) * barLength);
plot C13 = if c13_D >= extBar  and extBar != 0 then centerStrike + barOffset + strikeSpacing * 6 else double.nan;
C13.SetDefaultColor(globalColor("Calls"));
C13.SetLineWeight(barWeight);

rec c14_D = if IsNaN(close) then c14_D[1] else Ceil((c14_V / OI_Max) * barLength);
plot C14 = if c14_D >= extBar  and extBar != 0 then centerStrike + barOffset - strikeSpacing * 7 else double.nan;
C14.SetDefaultColor(globalColor("Calls"));
C14.SetLineWeight(barWeight);

rec c15_D = if IsNaN(close) then c15_D[1] else Ceil((c15_V / OI_Max) * barLength);
plot C15 = if c15_D >= extBar  and extBar != 0 then centerStrike + barOffset + strikeSpacing * 7 else double.nan;
C15.SetDefaultColor(globalColor("Calls"));
C15.SetLineWeight(barWeight);

rec c16_D = if IsNaN(close) then c16_D[1] else Ceil((c16_V / OI_Max) * barLength);
plot C16 = if c16_D >= extBar  and extBar != 0 then centerStrike + barOffset - strikeSpacing * 8 else double.nan;
C16.SetDefaultColor(globalColor("Calls"));
C16.SetLineWeight(barWeight);

rec c17_D = if IsNaN(close) then c17_D[1] else Ceil((c17_V / OI_Max) * barLength);
plot C17 = if c17_D >= extBar  and extBar != 0 then centerStrike + barOffset + strikeSpacing * 8 else double.nan;
C17.SetDefaultColor(globalColor("Calls"));
C17.SetLineWeight(barWeight);

rec c18_D = if IsNaN(close) then c18_D[1] else Ceil((c18_V / OI_Max) * barLength);
plot C18 = if c18_D >= extBar  and extBar != 0 then centerStrike + barOffset - strikeSpacing * 9 else double.nan;
C18.SetDefaultColor(globalColor("Calls"));
C18.SetLineWeight(barWeight);

rec c19_D = if IsNaN(close) then c19_D[1] else Ceil((c19_V / OI_Max) * barLength);
plot C19 = if c19_D >= extBar  and extBar != 0 then centerStrike + barOffset + strikeSpacing * 9 else double.nan;
C19.SetDefaultColor(globalColor("Calls"));
C19.SetLineWeight(barWeight);


rec p1_D = if IsNaN(close) then p1_D[1] else Ceil((p1_V / OI_Max) * barLength);
plot P1 = if p1_D >= extBar and extBar != 0 then centerStrike - barOffset else double.nan;
P1.SetDefaultColor(globalColor("Puts") );
P1.SetLineWeight(barWeight);

rec p2_D = if IsNaN(close) then p2_D[1] else Ceil((p2_V / OI_Max) * barLength);
plot P2 = if p2_D >= extBar and extBar != 0 then centerStrike - barOffset - strikeSpacing else double.nan;
P2.SetDefaultColor(globalColor("Puts"));
P2.SetLineWeight(barWeight);

rec p3_D = if IsNaN(close) then p3_D[1] else Ceil((p3_V / OI_Max) * barLength);
plot P3 = if p3_D >= extBar and extBar != 0 then centerStrike - barOffset - strikeSpacing * 2 else double.nan;
P3.SetDefaultColor(globalColor("Puts"));
P3.SetLineWeight(barWeight);

rec p4_D = if IsNaN(close) then p4_D[1] else Ceil((p4_V / OI_Max) * barLength);
plot P4 = if p4_D >= extBar  and extBar != 0 then centerStrike - barOffset - strikeSpacing * 3 else double.nan;
P4.SetDefaultColor(globalColor("Puts"));
P4.SetLineWeight(barWeight);

rec p5_D = if IsNaN(close) then p5_D[1] else Ceil((p5_V / OI_Max) * barLength);
plot P5 = if p5_D >= extBar  and extBar != 0 then centerStrike - barOffset + strikeSpacing else double.nan;
P5.SetDefaultColor(globalColor("Puts"));
P5.SetLineWeight(barWeight);

rec p6_D = if IsNaN(close) then p6_D[1] else Ceil((p6_V / OI_Max) * barLength);
plot P6 = if p6_D >= extBar  and extBar != 0 then centerStrike - barOffset + strikeSpacing * 2 else double.nan;
P6.SetDefaultColor(globalColor("Puts"));
P6.SetLineWeight(barWeight);

rec p7_D = if IsNaN(close) then p7_D[1] else Ceil((p7_V / OI_Max) * barLength);
plot P7 = if p7_D >= extBar  and extBar != 0 then centerStrike - barOffset + strikeSpacing * 3 else double.nan;
P7.SetDefaultColor(globalColor("Puts"));
P7.SetLineWeight(barWeight);

rec p8_D = if IsNaN(close) then p8_D[1] else Ceil((p8_V / OI_Max) * barLength);
plot P8 = if p8_D >= extBar  and extBar != 0 then centerStrike - barOffset - strikeSpacing * 4 else double.nan;
P8.SetDefaultColor(globalColor("Puts"));
P8.SetLineWeight(barWeight);

rec p9_D = if IsNaN(close) then p9_D[1] else Ceil((p9_V / OI_Max) * barLength);
plot P9 = if p9_D >= extBar  and extBar != 0 then centerStrike - barOffset + strikeSpacing * 4 else double.nan;
P9.SetDefaultColor(globalColor("Puts"));
P9.SetLineWeight(barWeight);

rec p10_D = if IsNaN(close) then p10_D[1] else Ceil((p10_V / OI_Max) * barLength);
plot P10 = if p10_D >= extBar  and extBar != 0 then centerStrike - barOffset - strikeSpacing * 5 else double.nan;
P10.SetDefaultColor(globalColor("Puts"));
P10.SetLineWeight(barWeight);

rec p11_D = if IsNaN(close) then p11_D[1] else Ceil((p11_V / OI_Max) * barLength);
plot P11 = if p11_D >= extBar  and extBar != 0 then centerStrike - barOffset + strikeSpacing * 5 else double.nan;
P11.SetDefaultColor(globalColor("Puts"));
P11.SetLineWeight(barWeight);

rec p12_D = if IsNaN(close) then p12_D[1] else Ceil((p12_V / OI_Max) * barLength);
plot P12 = if p12_D >= extBar  and extBar != 0 then centerStrike - barOffset - strikeSpacing * 6 else double.nan;
P12.SetDefaultColor(globalColor("Puts"));
P12.SetLineWeight(barWeight);

rec p13_D = if IsNaN(close) then p13_D[1] else Ceil((p13_V / OI_Max) * barLength);
plot P13 = if p13_D >= extBar  and extBar != 0 then centerStrike - barOffset + strikeSpacing * 6 else double.nan;
P13.SetDefaultColor(globalColor("Puts"));
P13.SetLineWeight(barWeight);

rec p14_D = if IsNaN(close) then p14_D[1] else Ceil((p14_V / OI_Max) * barLength);
plot P14 = if p14_D >= extBar  and extBar != 0 then centerStrike - barOffset - strikeSpacing * 7 else double.nan;
P14.SetDefaultColor(globalColor("Puts"));
P14.SetLineWeight(barWeight);

rec p15_D = if IsNaN(close) then p15_D[1] else Ceil((p15_V / OI_Max) * barLength);
plot P15 = if p15_D >= extBar  and extBar != 0 then centerStrike - barOffset + strikeSpacing * 7 else double.nan;
P15.SetDefaultColor(globalColor("Puts"));
P15.SetLineWeight(barWeight);

rec p16_D = if IsNaN(close) then p16_D[1] else Ceil((p16_V / OI_Max) * barLength);
plot P16 = if p16_D >= extBar  and extBar != 0 then centerStrike - barOffset - strikeSpacing * 8 else double.nan;
P16.SetDefaultColor(globalColor("Puts"));
P16.SetLineWeight(barWeight);

rec p17_D = if IsNaN(close) then p17_D[1] else Ceil((p17_V / OI_Max) * barLength);
plot P17 = if p17_D >= extBar  and extBar != 0 then centerStrike - barOffset + strikeSpacing * 8 else double.nan;
P17.SetDefaultColor(globalColor("Puts"));
P17.SetLineWeight(barWeight);

rec p18_D = if IsNaN(close) then p18_D[1] else Ceil((p18_V / OI_Max) * barLength);
plot P18 = if p18_D >= extBar  and extBar != 0 then centerStrike - barOffset - strikeSpacing * 9 else double.nan;
P18.SetDefaultColor(globalColor("Puts"));
P18.SetLineWeight(barWeight);

rec p19_D = if IsNaN(close) then p19_D[1] else Ceil((p19_V / OI_Max) * barLength);
plot P19 = if p19_D >= extBar  and extBar != 0 then centerStrike - barOffset + strikeSpacing * 9 else double.nan;
P19.SetDefaultColor(globalColor("Puts"));
P19.SetLineWeight(barWeight);


C1.SetPaintingStrategy(PaintingStrategy.DASHES);
C2.SetPaintingStrategy(PaintingStrategy.DASHES);
C3.SetPaintingStrategy(PaintingStrategy.DASHES);
C4.SetPaintingStrategy(PaintingStrategy.DASHES);
C5.SetPaintingStrategy(PaintingStrategy.DASHES);
C6.SetPaintingStrategy(PaintingStrategy.DASHES);
C7.SetPaintingStrategy(PaintingStrategy.DASHES);
C8.SetPaintingStrategy(PaintingStrategy.DASHES);
C9.SetPaintingStrategy(PaintingStrategy.DASHES);
C10.SetPaintingStrategy(PaintingStrategy.DASHES);
C11.SetPaintingStrategy(PaintingStrategy.DASHES);

C12.SetPaintingStrategy(PaintingStrategy.DASHES);
C13.SetPaintingStrategy(PaintingStrategy.DASHES);
C14.SetPaintingStrategy(PaintingStrategy.DASHES);
C15.SetPaintingStrategy(PaintingStrategy.DASHES);
C16.SetPaintingStrategy(PaintingStrategy.DASHES);
C17.SetPaintingStrategy(PaintingStrategy.DASHES);
C18.SetPaintingStrategy(PaintingStrategy.DASHES);
C19.SetPaintingStrategy(PaintingStrategy.DASHES);


P1.SetPaintingStrategy(PaintingStrategy.DASHES);
P2.SetPaintingStrategy(PaintingStrategy.DASHES);
P3.SetPaintingStrategy(PaintingStrategy.DASHES);
P4.SetPaintingStrategy(PaintingStrategy.DASHES);
P5.SetPaintingStrategy(PaintingStrategy.DASHES);
P6.SetPaintingStrategy(PaintingStrategy.DASHES);
P7.SetPaintingStrategy(PaintingStrategy.DASHES);
P8.SetPaintingStrategy(PaintingStrategy.DASHES);
P9.SetPaintingStrategy(PaintingStrategy.DASHES);
P10.SetPaintingStrategy(PaintingStrategy.DASHES);
P11.SetPaintingStrategy(PaintingStrategy.DASHES);

P12.SetPaintingStrategy(PaintingStrategy.DASHES);
P13.SetPaintingStrategy(PaintingStrategy.DASHES);
P14.SetPaintingStrategy(PaintingStrategy.DASHES);
P15.SetPaintingStrategy(PaintingStrategy.DASHES);
P16.SetPaintingStrategy(PaintingStrategy.DASHES);
P17.SetPaintingStrategy(PaintingStrategy.DASHES);
P18.SetPaintingStrategy(PaintingStrategy.DASHES);
P19.SetPaintingStrategy(PaintingStrategy.DASHES);



rec c1_V_e = if IsNaN(close) and !IsNaN(close[1]) then c1_V[1] else c1_V_e[1];
rec c2_V_e = if IsNaN(close) and !IsNaN(close[1]) then c2_V[1] else c2_V_e[1];
rec c3_V_e = if IsNaN(close) and !IsNaN(close[1]) then c3_V[1] else c3_V_e[1];
rec c4_V_e = if IsNaN(close) and !IsNaN(close[1]) then c4_V[1] else c4_V_e[1];
rec c5_V_e = if IsNaN(close) and !IsNaN(close[1]) then c5_V[1] else c5_V_e[1];
rec c6_V_e = if IsNaN(close) and !IsNaN(close[1]) then c6_V[1] else c6_V_e[1];
rec c7_V_e = if IsNaN(close) and !IsNaN(close[1]) then c7_V[1] else c7_V_e[1];
rec c8_V_e = if IsNaN(close) and !IsNaN(close[1]) then c8_V[1] else c8_V_e[1];
rec c9_V_e = if IsNaN(close) and !IsNaN(close[1]) then c9_V[1] else c9_V_e[1];
rec c10_V_e = if IsNaN(close) and !IsNaN(close[1]) then c10_V[1] else c10_V_e[1];
rec c11_V_e = if IsNaN(close) and !IsNaN(close[1]) then c11_V[1] else c11_V_e[1];

rec c12_V_e = if IsNaN(close) and !IsNaN(close[1]) then c12_V[1] else c12_V_e[1];
rec c13_V_e = if IsNaN(close) and !IsNaN(close[1]) then c13_V[1] else c13_V_e[1];
rec c14_V_e = if IsNaN(close) and !IsNaN(close[1]) then c14_V[1] else c14_V_e[1];
rec c15_V_e = if IsNaN(close) and !IsNaN(close[1]) then c15_V[1] else c15_V_e[1];
rec c16_V_e = if IsNaN(close) and !IsNaN(close[1]) then c16_V[1] else c16_V_e[1];
rec c17_V_e = if IsNaN(close) and !IsNaN(close[1]) then c17_V[1] else c17_V_e[1];
rec c18_V_e = if IsNaN(close) and !IsNaN(close[1]) then c18_V[1] else c18_V_e[1];
rec c19_V_e = if IsNaN(close) and !IsNaN(close[1]) then c19_V[1] else c19_V_e[1];


rec p1_V_e = if IsNaN(close) and !IsNaN(close[1]) then p1_V[1] else p1_V_e[1];
rec p2_V_e = if IsNaN(close) and !IsNaN(close[1]) then p2_V[1] else p2_V_e[1];
rec p3_V_e = if IsNaN(close) and !IsNaN(close[1]) then p3_V[1] else p3_V_e[1];
rec p4_V_e = if IsNaN(close) and !IsNaN(close[1]) then p4_V[1] else p4_V_e[1];
rec p5_V_e = if IsNaN(close) and !IsNaN(close[1]) then p5_V[1] else p5_V_e[1];
rec p6_V_e = if IsNaN(close) and !IsNaN(close[1]) then p6_V[1] else p6_V_e[1];
rec p7_V_e = if IsNaN(close) and !IsNaN(close[1]) then p7_V[1] else p7_V_e[1];
rec p8_V_e = if IsNaN(close) and !IsNaN(close[1]) then p8_V[1] else p8_V_e[1];
rec p9_V_e = if IsNaN(close) and !IsNaN(close[1]) then p9_V[1] else p9_V_e[1];
rec p10_V_e = if IsNaN(close) and !IsNaN(close[1]) then p10_V[1] else p10_V_e[1];
rec p11_V_e = if IsNaN(close) and !IsNaN(close[1]) then p11_V[1] else p11_V_e[1];

rec p12_V_e = if IsNaN(close) and !IsNaN(close[1]) then p12_V[1] else p12_V_e[1];
rec p13_V_e = if IsNaN(close) and !IsNaN(close[1]) then p13_V[1] else p13_V_e[1];
rec p14_V_e = if IsNaN(close) and !IsNaN(close[1]) then p14_V[1] else p14_V_e[1];
rec p15_V_e = if IsNaN(close) and !IsNaN(close[1]) then p15_V[1] else p15_V_e[1];
rec p16_V_e = if IsNaN(close) and !IsNaN(close[1]) then p16_V[1] else p16_V_e[1];
rec p17_V_e = if IsNaN(close) and !IsNaN(close[1]) then p17_V[1] else p17_V_e[1];
rec p18_V_e = if IsNaN(close) and !IsNaN(close[1]) then p18_V[1] else p18_V_e[1];
rec p19_V_e = if IsNaN(close) and !IsNaN(close[1]) then p19_V[1] else p19_V_e[1];


AddChartBubble(c1_D == extBar, C1, concat("", c1_V_e), globalColor("Calls"), yes );
AddChartBubble(c2_D == extBar, C2, concat("", c2_V_e), globalColor("Calls"), yes );
AddChartBubble(c3_D == extBar, C3, concat("", c3_V_e), globalColor("Calls"), yes );
AddChartBubble(c4_D == extBar, C4, concat("", c4_V_e), globalColor("Calls"), yes );
AddChartBubble(c5_D == extBar, C5, concat("", c5_V_e), globalColor("Calls"), yes );
AddChartBubble(c6_D == extBar, C6, concat("", c6_V_e), globalColor("Calls"), yes );
AddChartBubble(c7_D == extBar, C7, concat("", c7_V_e), globalColor("Calls"), yes );
AddChartBubble(c8_D == extBar, C8, concat("", c8_V_e), globalColor("Calls"), yes );
AddChartBubble(c9_D == extBar, C9, concat("", c9_V_e), globalColor("Calls"), yes );
AddChartBubble(c10_D == extBar, C10, concat("", c10_V_e), globalColor("Calls"), yes );
AddChartBubble(c11_D == extBar, C11, concat("", c11_V_e), globalColor("Calls"), yes );

AddChartBubble(c12_D == extBar, C12, concat("", c12_V_e), globalColor("Calls"), yes );
AddChartBubble(c13_D == extBar, C13, concat("", c13_V_e), globalColor("Calls"), yes );
AddChartBubble(c14_D == extBar, C14, concat("", c14_V_e), globalColor("Calls"), yes );
AddChartBubble(c15_D == extBar, C15, concat("", c15_V_e), globalColor("Calls"), yes );
AddChartBubble(c16_D == extBar, C16, concat("", c16_V_e), globalColor("Calls"), yes );
AddChartBubble(c17_D == extBar, C17, concat("", c17_V_e), globalColor("Calls"), yes );
AddChartBubble(c18_D == extBar, C18, concat("", c18_V_e), globalColor("Calls"), yes );
AddChartBubble(c19_D == extBar, C19, concat("", c19_V_e), globalColor("Calls"), yes );

AddChartBubble(p1_D == extBar, P1, concat("", p1_V_e), globalColor("Puts"), no );
AddChartBubble(p2_D == extBar, P2, concat("", p2_V_e), globalColor("Puts"), no );
AddChartBubble(p3_D == extBar, P3, concat("", p3_V_e), globalColor("Puts"), no );
AddChartBubble(p4_D == extBar, P4, concat("", p4_V_e), globalColor("Puts"), no );
AddChartBubble(p5_D == extBar, P5, concat("", p5_V_e), globalColor("Puts"), no );
AddChartBubble(p6_D == extBar, P6, concat("", p6_V_e), globalColor("Puts"), no );
AddChartBubble(p7_D == extBar, P7, concat("", p7_V_e), globalColor("Puts"), no );
AddChartBubble(p8_D == extBar, P8, concat("", p8_V_e), globalColor("Puts"), no );
AddChartBubble(p9_D == extBar, P9, concat("", p9_V_e), globalColor("Puts"), no );
AddChartBubble(p10_D == extBar, P10, concat("", p10_V_e), globalColor("Puts"), no );
AddChartBubble(p11_D == extBar, P11, concat("", p11_V_e), globalColor("Puts"), no );

AddChartBubble(p12_D == extBar, P12, concat("", p12_V_e), globalColor("Puts"), no );
AddChartBubble(p13_D == extBar, P13, concat("", p13_V_e), globalColor("Puts"), no );
AddChartBubble(p14_D == extBar, P14, concat("", p14_V_e), globalColor("Puts"), no );
AddChartBubble(p15_D == extBar, P15, concat("", p15_V_e), globalColor("Puts"), no );
AddChartBubble(p16_D == extBar, P16, concat("", p16_V_e), globalColor("Puts"), no );
AddChartBubble(p17_D == extBar, P17, concat("", p17_V_e), globalColor("Puts"), no );
AddChartBubble(p18_D == extBar, P18, concat("", p18_V_e), globalColor("Puts"), no );
AddChartBubble(p19_D == extBar, P19, concat("", p19_V_e), globalColor("Puts"), no );

C1.HideBubble();
C2.HideBubble();
C3.HideBubble();
C4.HideBubble();
C5.HideBubble();
C6.HideBubble();
C7.HideBubble();
C8.HideBubble();
C9.HideBubble();
C10.HideBubble();
C11.HideBubble();

C12.HideBubble();
C13.HideBubble();
C14.HideBubble();
C15.HideBubble();
C16.HideBubble();
C17.HideBubble();
C18.HideBubble();
C19.HideBubble();

P1.HideBubble();
P2.HideBubble();
P3.HideBubble();
P4.HideBubble();
P5.HideBubble();
P6.HideBubble();
P7.HideBubble();
P8.HideBubble();
P9.HideBubble();
P10.HideBubble();
P11.HideBubble();

P12.HideBubble();
P13.HideBubble();
P14.HideBubble();
P15.HideBubble();
P16.HideBubble();
P17.HideBubble();
P18.HideBubble();
P19.HideBubble();

C1.HideTitle();
C2.HideTitle();
C3.HideTitle();
C4.HideTitle();
C5.HideTitle();
C6.HideTitle();
C7.HideTitle();
C8.HideTitle();
C9.HideTitle();
C10.HideTitle();
C11.HideTitle();

C12.HideTitle();
C13.HideTitle();
C14.HideTitle();
C15.HideTitle();
C16.HideTitle();
C17.HideTitle();
C18.HideTitle();
C19.HideTitle();
   
P1.HideTitle();
P2.HideTitle();
P3.HideTitle();
P4.HideTitle();
P5.HideTitle();
P6.HideTitle();
P7.HideTitle();
P8.HideTitle();
P9.HideTitle();
P10.HideTitle();
P11.HideTitle();

P12.HideTitle();
P13.HideTitle();
P14.HideTitle();
P15.HideTitle();
P16.HideTitle();
P17.HideTitle();
P18.HideTitle();
P19.HideTitle();
 
Code:
# TS_OptionVolumeHeatmap
# (c) 2013 ThinkScripter, LLC
# [URL]http://www.thinkscripter.com[/URL]
# [email][email protected][/email]
# Last Update 23 April 2013
# Next3rdFriday code (c) thinkorswim


declare lower;

input period = 20;
input gain = 1.0;
input calculation_voodoo = {default a, b};

# Next3rdFriday excerpt
input series = 1;
input show_label = yes;

def CurrentYear = GetYear();
def CurrentMonth = GetMonth();
def CurrentDOM = GetDayOfMonth(GetYYYYMMDD());

def Day1DOW1 = GetDayOfWeek(CurrentYear * 10000 + CurrentMonth * 100 + 1);
def FirstFridayDOM1 = if Day1DOW1 < 6
    then 6 - Day1DOW1
    else if Day1DOW1 == 6
        then 7
        else 6;
def RollDOM = FirstFridayDOM1 + 14;
def ExpMonth1 = if RollDOM > CurrentDOM
    then CurrentMonth + series - 1
    else CurrentMonth + series;
def ExpMonth2 = if ExpMonth1 > 12
    then ExpMonth1 - 12
    else ExpMonth1;
def ExpYear = if ExpMonth1 > 12
    then CurrentYear + 1
    else CurrentYear;
def Day1DOW = GetDayOfWeek(ExpYear * 10000 + ExpMonth2 * 100 + 1);
def FirstFridayDOM = if Day1DOW < 6
    then 6 - Day1DOW
    else if Day1DOW == 6
        then 7
        else 6;
def ExpDOM = FirstFridayDOM + 15;


def maxStrikeSpacing = 25;
def centerSpacingDenominator = if close > 150 then 10 else if close > 50 then 5 else 1;

def centerStrike =  RoundDown(close / centerSpacingDenominator, 0) * centerSpacingDenominator;
def strikeSpacingC = fold i = 1 to maxStrikeSpacing with spacing = 0 do if !IsNaN( volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + (maxStrikeSpacing - i)))))) then maxStrikeSpacing - i else spacing;

def strikeSpacing =  strikeSpacingC ;

AddLabel(show_label, Concat("Expiration: ", Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Color.WHITE);
AddLabel(show_label, Concat("Strike Spacing: ", strikeSpacing), Color.CYAN);


DefineGlobalColor("L10", CreateColor(255, 255,  0));
DefineGlobalColor("L09", CreateColor(255, 204,  0));
DefineGlobalColor("L08", CreateColor(255, 153,  0));
DefineGlobalColor("L07", CreateColor(255, 102,  0));
DefineGlobalColor("L06", CreateColor(255, 51,  0));
DefineGlobalColor("L05", CreateColor(255,  0,  0));
DefineGlobalColor("L04", CreateColor(204,  0,  0));
DefineGlobalColor("L03", CreateColor(153,  0,  0));
DefineGlobalColor("L02", CreateColor( 51,  0,  0));
DefineGlobalColor("L01", CreateColor(  0,  0,  0));

DefineGlobalColor("H10", CreateColor(0, 255,  255));
DefineGlobalColor("H09", CreateColor(0, 204,  255));
DefineGlobalColor("H08", CreateColor(0, 153,  255));
DefineGlobalColor("H07", CreateColor(0, 102,  255));
DefineGlobalColor("H06", CreateColor(0, 51,  255));
DefineGlobalColor("H05", CreateColor(0,  0,  255));
DefineGlobalColor("H04", CreateColor(0,  0,  204));
DefineGlobalColor("H03", CreateColor(0,  0,  153));
DefineGlobalColor("H02", CreateColor(0,  0,  51));
DefineGlobalColor("H01", CreateColor(0,  0,  0));

def barWeight = 5;

def c1_V_d =  volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike ))));
def c2_V_d =  volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing))));
def c3_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 2))));
def c4_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 3))));
def c5_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing))));
def c6_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 2))));
def c7_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 3))));
def c8_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 4))));
def c9_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 4))));
def c10_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 5))));
def c11_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 5))));

def c12_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 6))));
def c13_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 6))));
def c14_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 7))));
def c15_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 7))));
def c16_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 8))));
def c17_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 8))));
def c18_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike - strikeSpacing * 9))));
def c19_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("C", AsPrice(centerStrike + strikeSpacing * 9))));

def p1_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike))));
def p2_V_d =  volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing))));
def p3_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 2))));
def p4_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 3))));
def p5_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing))));
def p6_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 2))));
def p7_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 3))));
def p8_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 4))));
def p9_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 4))));
def p10_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 5))));
def p11_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 5))));

def p12_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 6))));
def p13_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 6))));
def p14_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 7))));
def p15_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 7))));
def p16_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 8))));
def p17_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 8))));
def p18_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike - strikeSpacing * 9))));
def p19_V_d = volume(Concat(Concat(".", Concat(GetSymbolPart(), Concat(Concat(ExpYear - 2000, if ExpMonth2 <= 9 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM <= 9 then Concat("0", ExpDOM) else Concat("", ExpDOM)))), Concat("P", AsPrice(centerStrike + strikeSpacing * 9))));

def c1_V = if !IsNaN(c1_V_d) then c1_V_d else 0;
def c2_V = if !IsNaN(c2_V_d) then c2_V_d else 0;
def c3_V = if !IsNaN(c3_V_d) then c3_V_d else 0;
def c4_V = if !IsNaN(c4_V_d) then c4_V_d else 0;
def c5_V = if !IsNaN(c5_V_d) then c5_V_d else 0;
def c6_V = if !IsNaN(c6_V_d) then c6_V_d else 0;
def c7_V = if !IsNaN(c7_V_d) then c7_V_d else 0;
def c8_V = if !IsNaN(c8_V_d) then c8_V_d else 0;
def c9_V = if !IsNaN(c9_V_d) then c9_V_d else 0;
def c10_V = if !IsNaN(c10_V_d) then c10_V_d else 0;
def c11_V = if !IsNaN(c11_V_d) then c11_V_d else 0;

def c12_V = if !IsNaN(c12_V_d) then c12_V_d else 0;
def c13_V = if !IsNaN(c13_V_d) then c13_V_d else 0;
def c14_V = if !IsNaN(c14_V_d) then c14_V_d else 0;
def c15_V = if !IsNaN(c15_V_d) then c15_V_d else 0;
def c16_V = if !IsNaN(c16_V_d) then c16_V_d else 0;
def c17_V = if !IsNaN(c17_V_d) then c17_V_d else 0;
def c18_V = if !IsNaN(c18_V_d) then c18_V_d else 0;
def c19_V = if !IsNaN(c19_V_d) then c19_V_d else 0;

def p1_V = if !IsNaN(p1_V_d) then p1_V_d else 0;
def p2_V = if !IsNaN(p2_V_d) then p2_V_d else 0;
def p3_V = if !IsNaN(p3_V_d) then p3_V_d else 0;
def p4_V = if !IsNaN(p4_V_d) then p4_V_d else 0;
def p5_V = if !IsNaN(p5_V_d) then p5_V_d else 0;
def p6_V = if !IsNaN(p6_V_d) then p6_V_d else 0;
def p7_V = if !IsNaN(p7_V_d) then p7_V_d else 0;
def p8_V = if !IsNaN(p8_V_d) then p8_V_d else 0;
def p9_V = if !IsNaN(p9_V_d) then p9_V_d else 0;
def p10_V = if !IsNaN(p10_V_d) then p10_V_d else 0;
def p11_V = if !IsNaN(p11_V_d) then p11_V_d else 0;

def p12_V = if !IsNaN(p12_V_d) then p12_V_d else 0;
def p13_V = if !IsNaN(p13_V_d) then p13_V_d else 0;
def p14_V = if !IsNaN(p14_V_d) then p14_V_d else 0;
def p15_V = if !IsNaN(p15_V_d) then p15_V_d else 0;
def p16_V = if !IsNaN(p16_V_d) then p16_V_d else 0;
def p17_V = if !IsNaN(p17_V_d) then p17_V_d else 0;
def p18_V = if !IsNaN(p18_V_d) then p18_V_d else 0;
def p19_V = if !IsNaN(p19_V_d) then p19_V_d else 0;

def c1t = Max(Max(Max(Max(c1_V, c2_V), c3_V), c4_V), c5_V);
def c2t = Max(Max(Max(Max(Max(c6_V, c7_V), c8_V), c9_V), c10_V), c11_V);

def c3t = Max(Max(Max(Max(Max(c12_V, c13_V), c14_V), c15_V), c16_V), c17_V);
def c4t = Max(c18_V, c19_V);

def p1t = Max(Max(Max(Max(p1_V, p2_V), p3_V), p4_V), p5_V);
def p2t = Max(Max(Max(Max(Max(p6_V, p7_V), p8_V), p9_V), p10_V), p11_V);

def p3t = Max(Max(Max(Max(Max(p12_V, p13_V), p14_V), p15_V), p16_V), p17_V);
def p4t = Max(p18_V, p19_V);


def c_V_max = Max(Max(Max(c1t, c2t), c3t), c4t);
def p_V_max = Max(Max(Max(p1t, p2t), p3t), p4t);
def V_max = c_V_max + p_V_max;

def cVT = c1_V + c2_V + c3_V + c4_V + c5_V + c6_V + c7_V + c8_V + c9_V + c10_V + c11_V + c12_V + c13_V + c14_V + c15_V + c16_V + c17_V + c18_V + c19_V;

def cVTt = c1_V + c2_V + c3_V + c4_V + c5_V + c6_V + c7_V + c8_V + c9_V;

def pVT = p1_V + p2_V + p3_V + p4_V + p5_V + p6_V + p7_V + p8_V + p9_V + p10_V + p11_V + p12_V + p13_V + p14_V + p15_V + p16_V + p17_V + p18_V + p19_V;

def tVT = cVT + pVT;
def oVT = if calculation_voodoo == calculation_voodoo.a then Average(V_max, period) else Average(tVT, period);

def c1RS = (c1_V / oVT) * 10.0 * gain;
def c2RS = (c2_V / oVT) * 10.0 * gain;
def c3RS = (c3_V / oVT) * 10.0 * gain;
def c4RS = (c4_V / oVT) * 10.0 * gain;
def c5RS = (c5_V / oVT) * 10.0 * gain;
def c6RS = (c6_V / oVT) * 10.0 * gain;
def c7RS = (c7_V / oVT) * 10.0 * gain;
def c8RS = (c8_V / oVT) * 10.0 * gain;
def c9RS = (c9_V / oVT) * 10.0 * gain;
def c10RS = (c10_V / oVT) * 10.0 * gain;
def c11RS = (c11_V / oVT) * 10.0 * gain;
def c12RS = (c12_V / oVT) * 10.0 * gain;
def c13RS = (c13_V / oVT) * 10.0 * gain;
def c14RS = (c14_V / oVT) * 10.0 * gain;
def c15RS = (c15_V / oVT) * 10.0 * gain;
def c16RS = (c16_V / oVT) * 10.0 * gain;
def c17RS = (c17_V / oVT) * 10.0 * gain;
def c18RS = (c18_V / oVT) * 10.0 * gain;
def c19RS = (c19_V / oVT) * 10.0 * gain;

def p1RS = (p1_V / oVT) * 10.0 * gain;
def p2RS = (p2_V / oVT) * 10.0 * gain;
def p3RS = (p3_V / oVT) * 10.0 * gain;
def p4RS = (p4_V / oVT) * 10.0 * gain;
def p5RS = (p5_V / oVT) * 10.0 * gain;
def p6RS = (p6_V / oVT) * 10.0 * gain;
def p7RS = (p7_V / oVT) * 10.0 * gain;
def p8RS = (p8_V / oVT) * 10.0 * gain;
def p9RS = (p9_V / oVT) * 10.0 * gain;
def p10RS = (p10_V / oVT) * 10.0 * gain;
def p11RS = (p11_V / oVT) * 10.0 * gain;
def p12RS = (p12_V / oVT) * 10.0 * gain;
def p13RS = (p13_V / oVT) * 10.0 * gain;
def p14RS = (p14_V / oVT) * 10.0 * gain;
def p15RS = (p15_V / oVT) * 10.0 * gain;
def p16RS = (p16_V / oVT) * 10.0 * gain;
def p17RS = (p17_V / oVT) * 10.0 * gain;
def p18RS = (p18_V / oVT) * 10.0 * gain;
def p19RS = (p19_V / oVT) * 10.0 * gain;


def o1RS = Max(c1RS, p1RS);
def o1M = if c1RS > p1RS then 1 else 0;
def o2RS = Max(c2RS, p2RS);
def o2M = if c2RS > p2RS then 1 else 0;
def o3RS = Max(c3RS, p3RS);
def o3M = if c3RS > p3RS then 1 else 0;
def o4RS = Max(c4RS, p4RS);
def o4M = if c4RS > p4RS then 1 else 0;
def o5RS = Max(c5RS, p5RS);
def o5M = if c5RS > p5RS then 1 else 0;
def o6RS = Max(c6RS, p6RS);
def o6M = if c6RS > p6RS then 1 else 0;
def o7RS = Max(c7RS, p7RS);
def o7M = if c7RS > p7RS then 1 else 0;
def o8RS = Max(c8RS, p8RS);
def o8M = if c8RS > p8RS then 1 else 0;
def o9RS = Max(c9RS, p9RS);
def o9M = if c9RS > p9RS then 1 else 0;
def o10RS = Max(c10RS, p10RS);
def o10M = if c10RS > p10RS then 1 else 0;
def o11RS = Max(c11RS, p11RS);
def o11M = if c11RS > p11RS then 1 else 0;
def o12RS = Max(c12RS, p12RS);
def o12M = if c12RS > p12RS then 1 else 0;
def o13RS = Max(c13RS, p13RS);
def o13M = if c13RS > p13RS then 1 else 0;
def o14RS = Max(c14RS, p14RS);
def o14M = if c14RS > p14RS then 1 else 0;
def o15RS = Max(c15RS, p15RS);
def o15M = if c15RS > p15RS then 1 else 0;
def o16RS = Max(c16RS, p16RS);
def o16M = if c16RS > p16RS then 1 else 0;
def o17RS = Max(c17RS, p17RS);
def o17M = if c17RS > p17RS then 1 else 0;
def o18RS = Max(c18RS, p18RS);
def o18M = if c18RS > p18RS then 1 else 0;
def o19RS = Max(c19RS, p19RS);
def o19M = if c19RS > p19RS then 1 else 0;

plot price = close;

plot C1 = centerStrike ;
C1.SetLineWeight(5);
C1.SetDefaultColor(Color.BLACK);
C1.AssignValueColor(if o1M == 1 then (if o1RS <= 1 then GlobalColor("L01") else if o1RS <= 2 then GlobalColor("L02") else if o1RS <= 3 then GlobalColor("L03") else if o1RS <= 4 then GlobalColor("L04") else if o1RS <= 5 then GlobalColor("L05") else if o1RS <= 6 then GlobalColor("L06") else if o1RS <= 7 then GlobalColor("L07") else if o1RS <= 8 then GlobalColor("L08") else if o1RS <= 9 then GlobalColor("L09") else GlobalColor("L10")) else
(if o1RS <= 1 then GlobalColor("H01") else if o1RS <= 2 then GlobalColor("H02") else if o1RS <= 3 then GlobalColor("H03") else if o1RS <= 4 then GlobalColor("H04") else if o1RS <= 5 then GlobalColor("H05") else if o1RS <= 6 then GlobalColor("H06") else if o1RS <= 7 then GlobalColor("H07") else if o1RS <= 8 then GlobalColor("H08") else if o1RS <= 9 then GlobalColor("H09") else GlobalColor("H10")));

plot C2 = centerStrike  - strikeSpacing;
C2.SetLineWeight(5);
C2.SetDefaultColor(Color.BLACK);
C2.AssignValueColor(if o2M == 1 then (if o2RS <= 1 then GlobalColor("L01") else if o2RS <= 2 then GlobalColor("L02") else if o2RS <= 3 then GlobalColor("L03") else if o2RS <= 4 then GlobalColor("L04") else if o2RS <= 5 then GlobalColor("L05") else if o2RS <= 6 then GlobalColor("L06") else if o2RS <= 7 then GlobalColor("L07") else if o2RS <= 8 then GlobalColor("L08") else if o2RS <= 9 then GlobalColor("L09") else GlobalColor("L10")) else
(if o2RS <= 1 then GlobalColor("H01") else if o2RS <= 2 then GlobalColor("H02") else if o2RS <= 3 then GlobalColor("H03") else if o2RS <= 4 then GlobalColor("H04") else if o2RS <= 5 then GlobalColor("H05") else if o2RS <= 6 then GlobalColor("H06") else if o2RS <= 7 then GlobalColor("H07") else if o2RS <= 8 then GlobalColor("H08") else if o2RS <= 9 then GlobalColor("H09") else GlobalColor("H10")));


plot C3 = centerStrike  - strikeSpacing * 2;
C3.SetLineWeight(5);
C3.SetDefaultColor(Color.BLACK);
C3.AssignValueColor(if o3M == 1 then (if o3RS <= 1 then GlobalColor("L01") else if o3RS <= 2 then GlobalColor("L02") else if o3RS <= 3 then GlobalColor("L03") else if o3RS <= 4 then GlobalColor("L04") else if o3RS <= 5 then GlobalColor("L05") else if o3RS <= 6 then GlobalColor("L06") else if o3RS <= 7 then GlobalColor("L07") else if o3RS <= 8 then GlobalColor("L08") else if o3RS <= 9 then GlobalColor("L09") else GlobalColor("L10")) else
(if o3RS <= 1 then GlobalColor("H01") else if o3RS <= 2 then GlobalColor("H02") else if o3RS <= 3 then GlobalColor("H03") else if o3RS <= 4 then GlobalColor("H04") else if o3RS <= 5 then GlobalColor("H05") else if o3RS <= 6 then GlobalColor("H06") else if o3RS <= 7 then GlobalColor("H07") else if o3RS <= 8 then GlobalColor("H08") else if o3RS <= 9 then GlobalColor("H09") else GlobalColor("H10")));

plot C4 = centerStrike  - strikeSpacing * 3;
C4.SetLineWeight(5);
C4.SetDefaultColor(Color.BLACK);
C4.AssignValueColor(if o4M == 1 then (if o4RS <= 1 then GlobalColor("L01") else if o4RS <= 2 then GlobalColor("L02") else if o4RS <= 3 then GlobalColor("L03") else if o4RS <= 4 then GlobalColor("L04") else if o4RS <= 5 then GlobalColor("L05") else if o4RS <= 6 then GlobalColor("L06") else if o4RS <= 7 then GlobalColor("L07") else if o4RS <= 8 then GlobalColor("L08") else if o4RS <= 9 then GlobalColor("L09") else GlobalColor("L10")) else
(if o4RS <= 1 then GlobalColor("H01") else if o4RS <= 2 then GlobalColor("H02") else if o4RS <= 3 then GlobalColor("H03") else if o4RS <= 4 then GlobalColor("H04") else if o4RS <= 5 then GlobalColor("H05") else if o4RS <= 6 then GlobalColor("H06") else if o4RS <= 7 then GlobalColor("H07") else if o4RS <= 8 then GlobalColor("H08") else if o4RS <= 9 then GlobalColor("H09") else GlobalColor("H10")));


plot C5 = centerStrike  + strikeSpacing;
C5.SetLineWeight(5);
C5.SetDefaultColor(Color.BLACK);
C5.AssignValueColor(if o5M == 1 then (if o5RS <= 1 then GlobalColor("L01") else if o5RS <= 2 then GlobalColor("L02") else if o5RS <= 3 then GlobalColor("L03") else if o5RS <= 4 then GlobalColor("L04") else if o5RS <= 5 then GlobalColor("L05") else if o5RS <= 6 then GlobalColor("L06") else if o5RS <= 7 then GlobalColor("L07") else if o5RS <= 8 then GlobalColor("L08") else if o5RS <= 9 then GlobalColor("L09") else GlobalColor("L10")) else
(if o5RS <= 1 then GlobalColor("H01") else if o5RS <= 2 then GlobalColor("H02") else if o5RS <= 3 then GlobalColor("H03") else if o5RS <= 4 then GlobalColor("H04") else if o5RS <= 5 then GlobalColor("H05") else if o5RS <= 6 then GlobalColor("H06") else if o5RS <= 7 then GlobalColor("H07") else if o5RS <= 8 then GlobalColor("H08") else if o5RS <= 9 then GlobalColor("H09") else GlobalColor("H10")));

plot C6 = centerStrike  + strikeSpacing * 2;
C6.SetLineWeight(5);
C6.SetDefaultColor(Color.BLACK);

C6.AssignValueColor(if o6M == 1 then (if o6RS <= 1 then GlobalColor("L01") else if o6RS <= 2 then GlobalColor("L02") else if o6RS <= 3 then GlobalColor("L03") else if o6RS <= 4 then GlobalColor("L04") else if o6RS <= 5 then GlobalColor("L05") else if o6RS <= 6 then GlobalColor("L06") else if o6RS <= 7 then GlobalColor("L07") else if o6RS <= 8 then GlobalColor("L08") else if o6RS <= 9 then GlobalColor("L09") else GlobalColor("L10")) else
(if o6RS <= 1 then GlobalColor("H01") else if o6RS <= 2 then GlobalColor("H02") else if o6RS <= 3 then GlobalColor("H03") else if o6RS <= 4 then GlobalColor("H04") else if o6RS <= 5 then GlobalColor("H05") else if o6RS <= 6 then GlobalColor("H06") else if o6RS <= 7 then GlobalColor("H07") else if o6RS <= 8 then GlobalColor("H08") else if o6RS <= 9 then GlobalColor("H09") else GlobalColor("H10")));

plot C7 = centerStrike  + strikeSpacing * 3;
C7.SetLineWeight(5);
C7.SetDefaultColor(Color.BLACK);

C7.AssignValueColor(if o7M == 1 then (if o7RS <= 1 then GlobalColor("L01") else if o7RS <= 2 then GlobalColor("L02") else if o7RS <= 3 then GlobalColor("L03") else if o7RS <= 4 then GlobalColor("L04") else if o7RS <= 5 then GlobalColor("L05") else if o7RS <= 6 then GlobalColor("L06") else if o7RS <= 7 then GlobalColor("L07") else if o7RS <= 8 then GlobalColor("L08") else if o7RS <= 9 then GlobalColor("L09") else GlobalColor("L10")) else
(if o7RS <= 1 then GlobalColor("H01") else if o7RS <= 2 then GlobalColor("H02") else if o7RS <= 3 then GlobalColor("H03") else if o7RS <= 4 then GlobalColor("H04") else if o7RS <= 5 then GlobalColor("H05") else if o7RS <= 6 then GlobalColor("H06") else if o7RS <= 7 then GlobalColor("H07") else if o7RS <= 8 then GlobalColor("H08") else if o7RS <= 9 then GlobalColor("H09") else GlobalColor("H10")));

plot C8 = centerStrike  - strikeSpacing * 4;
C8.SetLineWeight(5);
C8.SetDefaultColor(Color.BLACK);

C8.AssignValueColor(if o8M == 1 then (if o8RS <= 1 then GlobalColor("L01") else if o8RS <= 2 then GlobalColor("L02") else if o8RS <= 3 then GlobalColor("L03") else if o8RS <= 4 then GlobalColor("L04") else if o8RS <= 5 then GlobalColor("L05") else if o8RS <= 6 then GlobalColor("L06") else if o8RS <= 7 then GlobalColor("L07") else if o8RS <= 8 then GlobalColor("L08") else if o8RS <= 9 then GlobalColor("L09") else GlobalColor("L10")) else
(if o8RS <= 1 then GlobalColor("H01") else if o8RS <= 2 then GlobalColor("H02") else if o8RS <= 3 then GlobalColor("H03") else if o8RS <= 4 then GlobalColor("H04") else if o8RS <= 5 then GlobalColor("H05") else if o8RS <= 6 then GlobalColor("H06") else if o8RS <= 7 then GlobalColor("H07") else if o8RS <= 8 then GlobalColor("H08") else if o8RS <= 9 then GlobalColor("H09") else GlobalColor("H10")));

plot C9 = centerStrike  + strikeSpacing * 4;
C9.SetLineWeight(5);
C9.SetDefaultColor(Color.BLACK);

C9.AssignValueColor(if o9M == 1 then (if o9RS <= 1 then GlobalColor("L01") else if o9RS <= 2 then GlobalColor("L02") else if o9RS <= 3 then GlobalColor("L03") else if o9RS <= 4 then GlobalColor("L04") else if o9RS <= 5 then GlobalColor("L05") else if o9RS <= 6 then GlobalColor("L06") else if o9RS <= 7 then GlobalColor("L07") else if o9RS <= 8 then GlobalColor("L08") else if o9RS <= 9 then GlobalColor("L09") else GlobalColor("L10")) else
(if o9RS <= 1 then GlobalColor("H01") else if o9RS <= 2 then GlobalColor("H02") else if o9RS <= 3 then GlobalColor("H03") else if o9RS <= 4 then GlobalColor("H04") else if o9RS <= 5 then GlobalColor("H05") else if o9RS <= 6 then GlobalColor("H06") else if o9RS <= 7 then GlobalColor("H07") else if o9RS <= 8 then GlobalColor("H08") else if o9RS <= 9 then GlobalColor("H09") else GlobalColor("H10")));

plot C10 = centerStrike  - strikeSpacing * 5;
C10.SetLineWeight(5);
C10.SetDefaultColor(Color.BLACK);

C10.AssignValueColor(if o10M == 1 then (if o10RS <= 1 then GlobalColor("L01") else if o10RS <= 2 then GlobalColor("L02") else if o10RS <= 3 then GlobalColor("L03") else if o10RS <= 4 then GlobalColor("L04") else if o10RS <= 5 then GlobalColor("L05") else if o10RS <= 6 then GlobalColor("L06") else if o10RS <= 7 then GlobalColor("L07") else if o10RS <= 8 then GlobalColor("L08") else if o10RS <= 9 then GlobalColor("L09") else GlobalColor("L10")) else
(if o10RS <= 1 then GlobalColor("H01") else if o10RS <= 2 then GlobalColor("H02") else if o10RS <= 3 then GlobalColor("H03") else if o10RS <= 4 then GlobalColor("H04") else if o10RS <= 5 then GlobalColor("H05") else if o10RS <= 6 then GlobalColor("H06") else if o10RS <= 7 then GlobalColor("H07") else if o10RS <= 8 then GlobalColor("H08") else if o10RS <= 9 then GlobalColor("H09") else GlobalColor("H10")));

plot C11 = centerStrike  + strikeSpacing * 4;
C11.SetLineWeight(5);
C11.SetDefaultColor(Color.BLACK);

C11.AssignValueColor(if o11M == 1 then (if o11RS <= 1 then GlobalColor("L01") else if o11RS <= 2 then GlobalColor("L02") else if o11RS <= 3 then GlobalColor("L03") else if o11RS <= 4 then GlobalColor("L04") else if o11RS <= 5 then GlobalColor("L05") else if o11RS <= 6 then GlobalColor("L06") else if o11RS <= 7 then GlobalColor("L07") else if o11RS <= 8 then GlobalColor("L08") else if o11RS <= 9 then GlobalColor("L09") else GlobalColor("L10")) else
(if o11RS <= 1 then GlobalColor("H01") else if o11RS <= 2 then GlobalColor("H02") else if o11RS <= 3 then GlobalColor("H03") else if o11RS <= 4 then GlobalColor("H04") else if o11RS <= 5 then GlobalColor("H05") else if o11RS <= 6 then GlobalColor("H06") else if o11RS <= 7 then GlobalColor("H07") else if o11RS <= 8 then GlobalColor("H08") else if o11RS <= 9 then GlobalColor("H09") else GlobalColor("H10")));


plot C12 = centerStrike  - strikeSpacing * 6;
C12.SetLineWeight(5);
C12.SetDefaultColor(Color.BLACK);

C12.AssignValueColor(if o12M == 1 then (if o12RS <= 1 then GlobalColor("L01") else if o12RS <= 2 then GlobalColor("L02") else if o12RS <= 3 then GlobalColor("L03") else if o12RS <= 4 then GlobalColor("L04") else if o12RS <= 5 then GlobalColor("L05") else if o12RS <= 6 then GlobalColor("L06") else if o12RS <= 7 then GlobalColor("L07") else if o12RS <= 8 then GlobalColor("L08") else if o12RS <= 9 then GlobalColor("L09") else GlobalColor("L10")) else
(if o12RS <= 1 then GlobalColor("H01") else if o12RS <= 2 then GlobalColor("H02") else if o12RS <= 3 then GlobalColor("H03") else if o12RS <= 4 then GlobalColor("H04") else if o12RS <= 5 then GlobalColor("H05") else if o12RS <= 6 then GlobalColor("H06") else if o12RS <= 7 then GlobalColor("H07") else if o12RS <= 8 then GlobalColor("H08") else if o12RS <= 9 then GlobalColor("H09") else GlobalColor("H10")));

plot C13 = centerStrike  + strikeSpacing * 6;
C13.SetLineWeight(5);
C13.SetDefaultColor(Color.BLACK);

C13.AssignValueColor(if o13M == 1 then (if o13RS <= 1 then GlobalColor("L01") else if o13RS <= 2 then GlobalColor("L02") else if o13RS <= 3 then GlobalColor("L03") else if o13RS <= 4 then GlobalColor("L04") else if o13RS <= 5 then GlobalColor("L05") else if o13RS <= 6 then GlobalColor("L06") else if o13RS <= 7 then GlobalColor("L07") else if o13RS <= 8 then GlobalColor("L08") else if o13RS <= 9 then GlobalColor("L09") else GlobalColor("L10")) else
(if o13RS <= 1 then GlobalColor("H01") else if o13RS <= 2 then GlobalColor("H02") else if o13RS <= 3 then GlobalColor("H03") else if o13RS <= 4 then GlobalColor("H04") else if o13RS <= 5 then GlobalColor("H05") else if o13RS <= 6 then GlobalColor("H06") else if o13RS <= 7 then GlobalColor("H07") else if o13RS <= 8 then GlobalColor("H08") else if o13RS <= 9 then GlobalColor("H09") else GlobalColor("H10")));

plot C14 = centerStrike  - strikeSpacing * 7;
C14.SetLineWeight(5);
C14.SetDefaultColor(Color.BLACK);

C14.AssignValueColor(if o14M == 1 then (if o14RS <= 1 then GlobalColor("L01") else if o14RS <= 2 then GlobalColor("L02") else if o14RS <= 3 then GlobalColor("L03") else if o14RS <= 4 then GlobalColor("L04") else if o14RS <= 5 then GlobalColor("L05") else if o14RS <= 6 then GlobalColor("L06") else if o14RS <= 7 then GlobalColor("L07") else if o14RS <= 8 then GlobalColor("L08") else if o14RS <= 9 then GlobalColor("L09") else GlobalColor("L10")) else
(if o14RS <= 1 then GlobalColor("H01") else if o14RS <= 2 then GlobalColor("H02") else if o14RS <= 3 then GlobalColor("H03") else if o14RS <= 4 then GlobalColor("H04") else if o14RS <= 5 then GlobalColor("H05") else if o14RS <= 6 then GlobalColor("H06") else if o14RS <= 7 then GlobalColor("H07") else if o14RS <= 8 then GlobalColor("H08") else if o14RS <= 9 then GlobalColor("H09") else GlobalColor("H10")));

plot C15 = centerStrike  + strikeSpacing * 7;
C15.SetLineWeight(5);
C15.SetDefaultColor(Color.BLACK);

C15.AssignValueColor(if o15M == 1 then (if o15RS <= 1 then GlobalColor("L01") else if o15RS <= 2 then GlobalColor("L02") else if o15RS <= 3 then GlobalColor("L03") else if o15RS <= 4 then GlobalColor("L04") else if o15RS <= 5 then GlobalColor("L05") else if o15RS <= 6 then GlobalColor("L06") else if o15RS <= 7 then GlobalColor("L07") else if o15RS <= 8 then GlobalColor("L08") else if o15RS <= 9 then GlobalColor("L09") else GlobalColor("L10")) else
(if o15RS <= 1 then GlobalColor("H01") else if o15RS <= 2 then GlobalColor("H02") else if o15RS <= 3 then GlobalColor("H03") else if o15RS <= 4 then GlobalColor("H04") else if o15RS <= 5 then GlobalColor("H05") else if o15RS <= 6 then GlobalColor("H06") else if o15RS <= 7 then GlobalColor("H07") else if o15RS <= 8 then GlobalColor("H08") else if o15RS <= 9 then GlobalColor("H09") else GlobalColor("H10")));

plot C16 = centerStrike  - strikeSpacing * 8;
C16.SetLineWeight(5);
C16.SetDefaultColor(Color.BLACK);

C16.AssignValueColor(if o16M == 1 then (if o16RS <= 1 then GlobalColor("L01") else if o16RS <= 2 then GlobalColor("L02") else if o16RS <= 3 then GlobalColor("L03") else if o16RS <= 4 then GlobalColor("L04") else if o16RS <= 5 then GlobalColor("L05") else if o16RS <= 6 then GlobalColor("L06") else if o16RS <= 7 then GlobalColor("L07") else if o16RS <= 8 then GlobalColor("L08") else if o16RS <= 9 then GlobalColor("L09") else GlobalColor("L10")) else
(if o16RS <= 1 then GlobalColor("H01") else if o16RS <= 2 then GlobalColor("H02") else if o16RS <= 3 then GlobalColor("H03") else if o16RS <= 4 then GlobalColor("H04") else if o16RS <= 5 then GlobalColor("H05") else if o16RS <= 6 then GlobalColor("H06") else if o16RS <= 7 then GlobalColor("H07") else if o16RS <= 8 then GlobalColor("H08") else if o16RS <= 9 then GlobalColor("H09") else GlobalColor("H10")));

plot C17 = centerStrike  + strikeSpacing * 8;
C17.SetLineWeight(5);
C17.SetDefaultColor(Color.BLACK);

C17.AssignValueColor(if o17M == 1 then (if o17RS <= 1 then GlobalColor("L01") else if o17RS <= 2 then GlobalColor("L02") else if o17RS <= 3 then GlobalColor("L03") else if o17RS <= 4 then GlobalColor("L04") else if o17RS <= 5 then GlobalColor("L05") else if o17RS <= 6 then GlobalColor("L06") else if o17RS <= 7 then GlobalColor("L07") else if o17RS <= 8 then GlobalColor("L08") else if o17RS <= 9 then GlobalColor("L09") else GlobalColor("L10")) else
(if o17RS <= 1 then GlobalColor("H01") else if o17RS <= 2 then GlobalColor("H02") else if o17RS <= 3 then GlobalColor("H03") else if o17RS <= 4 then GlobalColor("H04") else if o17RS <= 5 then GlobalColor("H05") else if o17RS <= 6 then GlobalColor("H06") else if o17RS <= 7 then GlobalColor("H07") else if o17RS <= 8 then GlobalColor("H08") else if o17RS <= 9 then GlobalColor("H09") else GlobalColor("H10")));

plot C18 = centerStrike  - strikeSpacing * 9;
C18.SetLineWeight(5);
C18.SetDefaultColor(Color.BLACK);

C18.AssignValueColor(if o18M == 1 then (if o18RS <= 1 then GlobalColor("L01") else if o18RS <= 2 then GlobalColor("L02") else if o18RS <= 3 then GlobalColor("L03") else if o18RS <= 4 then GlobalColor("L04") else if o18RS <= 5 then GlobalColor("L05") else if o18RS <= 6 then GlobalColor("L06") else if o18RS <= 7 then GlobalColor("L07") else if o18RS <= 8 then GlobalColor("L08") else if o18RS <= 9 then GlobalColor("L09") else GlobalColor("L10")) else
(if o18RS <= 1 then GlobalColor("H01") else if o18RS <= 2 then GlobalColor("H02") else if o18RS <= 3 then GlobalColor("H03") else if o18RS <= 4 then GlobalColor("H04") else if o18RS <= 5 then GlobalColor("H05") else if o18RS <= 6 then GlobalColor("H06") else if o18RS <= 7 then GlobalColor("H07") else if o18RS <= 8 then GlobalColor("H08") else if o18RS <= 9 then GlobalColor("H09") else GlobalColor("H10")));

plot C19 = centerStrike  + strikeSpacing * 9;
C19.SetLineWeight(5);
C19.SetDefaultColor(Color.BLACK);

C19.AssignValueColor(if o19M == 1 then (if o19RS <= 1 then GlobalColor("L01") else if o19RS <= 2 then GlobalColor("L02") else if o19RS <= 3 then GlobalColor("L03") else if o19RS <= 4 then GlobalColor("L04") else if o19RS <= 5 then GlobalColor("L05") else if o19RS <= 6 then GlobalColor("L06") else if o19RS <= 7 then GlobalColor("L07") else if o19RS <= 8 then GlobalColor("L08") else if o19RS <= 9 then GlobalColor("L09") else GlobalColor("L10")) else
(if o19RS <= 1 then GlobalColor("H01") else if o19RS <= 2 then GlobalColor("H02") else if o19RS <= 3 then GlobalColor("H03") else if o19RS <= 4 then GlobalColor("H04") else if o19RS <= 5 then GlobalColor("H05") else if o19RS <= 6 then GlobalColor("H06") else if o19RS <= 7 then GlobalColor("H07") else if o19RS <= 8 then GlobalColor("H08") else if o19RS <= 9 then GlobalColor("H09") else GlobalColor("H10")));

C1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
C2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
C3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
C4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
C5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
C6.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
C7.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
C8.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
C9.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
C10.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
C11.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
C12.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
C13.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
C14.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
C15.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
C16.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
C17.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
C18.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
C19.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);


price.SetPaintingStrategy(PaintingStrategy.DASHES);
price.SetDefaultColor(Color.WHITE);
price.setLineWeight(2);
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
447 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top