Options Vol/Open Interest For ThinkOrSwim

blackbeard12

New member
Came across this option volume indicator that shows you the volume/open interest of whatever option contract for ETF/Stock youre looking at. Its a lower study under the chart that I use for SPY.

Right click on an option for analysis and hit "Copy"
Paste it into the Edit Studies "Option Series Prefix"

So if I want to look at SPY calls, I right click the July 12 Spy 290 Calls and hit copy.
I then go into the Edit Studies section and paste which gives me "SPY190712C290"

Then, I'll remove the C290 at the end and am left with only the prefix. And you will put that at the "optionseriesprefix" on line 02

Let me know what yall think.

Code:
declare lower;
input optionSeriesPrefix = ".SPY190712";
input strike = 260.0;
input strikeSpacing = 10.0;
input mode = {default volume, totalVolume, openInterest, volumePercentOI};
input totalStrikes = {default Five, Three, One};

def showThree = if mode == mode.volume and totalStrikes == totalStrikes.Three then 1 else 0;
def showFive = if  mode == mode.volume and totalStrikes == totalStrikes.Five then 1 else 0;

AddLabel(yes, optionSeriesPrefix, Color.WHITE);
AddLabel(yes, Concat(strike, "P"), Color.RED);
AddLabel(showThree or showFive, Concat(strike - strikeSpacing, "P"), Color.MAGENTA);
AddLabel(showThree or showFive, Concat(strike + strikeSpacing, "P"), Color.ORANGE);
AddLabel(showFive, Concat(strike - strikeSpacing - strikeSpacing, "P"), Color.PINK);
AddLabel(showFive, Concat(strike + strikeSpacing + strikeSpacing, "P"), Color.GRAY);
AddLabel(yes, Concat(strike, "C"), Color.GREEN);
AddLabel(showThree or showFive, Concat(strike - strikeSpacing, "C"), Color.CYAN);
AddLabel(showThree or showFive, Concat(strike + strikeSpacing, "C"), Color.BLUE);
AddLabel(showFive, Concat(strike - strikeSpacing - strikeSpacing, "C"), Color.LIME);
AddLabel(showFive, Concat(strike + strikeSpacing + strikeSpacing, "C"), Color.WHITE);

def putOptionVolume =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike)));
rec cumPutVolume = cumPutVolume[1] + putOptionVolume;
def totalputOptionVolume = volume(Concat(optionSeriesPrefix, Concat("P", strike)), "DAY");
def putOptionOI = open_interest(Concat(optionSeriesPrefix, Concat("P", strike)), "DAY");
def callOptionVolume = if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike)));
rec cumCallVolume = cumCallVolume[1] + callOptionVolume;
def totalcallOptionVolume = volume(Concat(optionSeriesPrefix, Concat("C", strike)), "DAY");
def callOptionOI = open_interest(Concat(optionSeriesPrefix, Concat("C", strike)), "DAY");

def putOptionVolume1 = if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpacing)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpacing)));
rec cumPutVolume1 = cumPutVolume1[1] + putOptionVolume1;
def totalputOptionVolume1 = volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpacing)), "DAY");
def putOptionOI1 = open_interest(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpacing)), "DAY");
def callOptionVolume1 = if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpacing)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpacing)));
rec cumCallVolume1 = cumCallVolume1[1] + callOptionVolume1;
def totalcallOptionVolume1 = volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpacing)), "DAY");
def callOptionOI1 = open_interest(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpacing)), "DAY");

def putOptionVolume2 = if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpacing)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpacing)));
rec cumPutVolume2 = cumPutVolume2[1] + putOptionVolume2;
def totalputOptionVolume2 = volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpacing)), "DAY");
def putOptionOI2 = open_interest(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpacing)), "DAY");
def callOptionVolume2 = if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpacing)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpacing)));
rec cumCallVolume2 = cumCallVolume2[1] + callOptionVolume2;
def totalcallOptionVolume2 = volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpacing)), "DAY");
def callOptionOI2 = open_interest(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpacing)), "DAY");

def putOptionVolume3 = if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpacing - strikeSpacing)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpacing - strikeSpacing)));
rec cumPutVolume3 = cumPutVolume3[1] + putOptionVolume3;
def totalputOptionVolume3 = volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpacing - strikeSpacing)), "DAY");
def putOptionOI3 = open_interest(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpacing - strikeSpacing)), "DAY");
def callOptionVolume3 = if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpacing - strikeSpacing)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpacing - strikeSpacing)));
rec cumCallVolume3 = cumCallVolume3[1] + callOptionVolume3;
def totalcallOptionVolume3 = volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpacing - strikeSpacing)), "DAY");
def callOptionOI3 = open_interest(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpacing - strikeSpacing)), "DAY");

def putOptionVolume4 = if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpacing + strikeSpacing)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpacing + strikeSpacing)));
rec cumPutVolume4 = cumPutVolume4[1] + putOptionVolume4;
def totalputOptionVolume4 = volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpacing + strikeSpacing)), "DAY");
def putOptionOI4 = open_interest(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpacing + strikeSpacing)), "DAY");
def callOptionVolume4 = if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpacing + strikeSpacing)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpacing + strikeSpacing)));
rec cumCallVolume4 = cumCallVolume4[1] + callOptionVolume4;
def totalcallOptionVolume4 = volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpacing + strikeSpacing)), "DAY");
def callOptionOI4 = open_interest(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpacing + strikeSpacing)), "DAY");

plot zero = 0;
zero.SetDefaultColor(Color.WHITE);
zero.HideTitle();

plot datap4;
plot datac4;
switch (mode){
case volume:
    datap4 = -putOptionVolume4 * showFive;
    datac4 = callOptionVolume4 * showFive;
case totalVolume:
    datap4 = Double.NaN;
    datac4 = Double.NaN;
case openInterest:
    datap4 = Double.NaN;
    datac4 = Double.NaN;
case volumePercentOI:
    datap4 = Double.NaN;
    datac4 = Double.NaN;
}
datap4.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
datac4.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
datap4.SetDefaultColor(Color.GRAY);
datac4.SetDefaultColor(Color.WHITE);
datap4.SetLineWeight(3);
datac4.SetLineWeight(3);
datap4.HideTitle();
datac4.HideTitle();
datap4.HideBubble();
datac4.HideBubble();

plot datap3;
plot datac3;
switch (mode){
case volume:
    datap3 = -putOptionVolume3 * showFive - putOptionVolume4 * showFive;
    datac3 = callOptionVolume3 * showFive + callOptionVolume4 * showFive;
case totalVolume:
    datap3 = Double.NaN;
    datac3 = Double.NaN;
case openInterest:
    datap3 = Double.NaN;
    datac3 = Double.NaN;
case volumePercentOI:
    datap3 = Double.NaN;
    datac3 = Double.NaN;
}
datap3.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
datac3.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

datap3.SetDefaultColor(Color.PINK);
datac3.SetDefaultColor(Color.LIME);

datap3.SetLineWeight(3);
datac3.SetLineWeight(3);
datap3.HideTitle();
datac3.HideTitle();
datap3.HideBubble();
datac3.HideBubble();

plot datap2;
plot datac2;
switch (mode){
case volume:
    datap2 = -putOptionVolume2 * (showThree or showFive) - putOptionVolume3 * showFive - putOptionVolume4 * showFive;
    datac2 = +callOptionVolume2 * (showThree or showFive) + callOptionVolume3 * showFive + callOptionVolume4 * showFive;
case totalVolume:
    datap2 = Double.NaN;
    datac2 = Double.NaN;
case openInterest:
    datap2 = Double.NaN;
    datac2 = Double.NaN;
case volumePercentOI:
    datap2 = Double.NaN;
    datac2 = Double.NaN;
}
datap2.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
datac2.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
datap2.SetDefaultColor(Color.ORANGE);
datac2.SetDefaultColor(Color.BLUE);
datap2.SetLineWeight(3);
datac2.SetLineWeight(3);
datap2.HideTitle();
datac2.HideTitle();
datap2.HideBubble();
datac2.HideBubble();

plot datap1;
plot datac1;
switch (mode){
case volume:
    datap1 = -putOptionVolume1 * (showThree or showFive) - putOptionVolume2 * (showThree or showFive) - putOptionVolume3 * showFive - putOptionVolume4 * showFive;
    datac1 = callOptionVolume1 * (showThree or showFive) + callOptionVolume2 * (showThree or showFive) + callOptionVolume3 * showFive + callOptionVolume4 * showFive;
case totalVolume:
    datap1 = Double.NaN;
    datac1 = Double.NaN;
case openInterest:
    datap1 = Double.NaN;
    datac1 = Double.NaN;
case volumePercentOI:
    datap1 = Double.NaN;
    datac1 = Double.NaN;
}
datap1.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
datac1.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
datap1.SetDefaultColor(Color.MAGENTA);
datac1.SetDefaultColor(Color.CYAN);
datap1.SetLineWeight(3);
datac1.SetLineWeight(3);
datap1.HideTitle();
datac1.HideTitle();
datap1.HideBubble();
datac1.HideBubble();

plot datap;
plot datac;
switch (mode){
case volume:
    datap = -putOptionVolume - putOptionVolume1 * (showThree or showFive) - putOptionVolume2 * (showThree or showFive) - putOptionVolume3 * showFive - putOptionVolume4 * showFive;
    datac = callOptionVolume + callOptionVolume1 * (showThree or showFive) + callOptionVolume2 * (showThree or showFive) + callOptionVolume3 * showFive + callOptionVolume4 * showFive;
case totalVolume:
    datap = -totalputOptionVolume;
    datac = totalcallOptionVolume;
case openInterest:
    datap = -putOptionOI;
    datac = callOptionOI;
case volumePercentOI:
    datap = -putOptionVolume * 100 / putOptionOI;
    datac = callOptionVolume * 100 / callOptionOI;
}
datap.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
datac.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
datap.SetDefaultColor(Color.RED);
datac.SetDefaultColor(Color.GREEN);
datap.SetLineWeight(3);
datac.SetLineWeight(3);
datap.HideTitle();
datac.HideTitle();
datap.HideBubble();
datac.HideBubble();
 
This code, i believe, is coded for monthly & quarterly options. It is posted here for experimental purposes.

Code:
# Option Prices At Close with Open Interest Intraday Charts Only
# Mobius
# V01.03.2017

declare hide_on_daily;

input series = 1;
input show_All_labels = yes;

Assert(series > 0, "'series' must be positive: " + series);

def c = close;
def interest_rate = GetInterestRate();
def yield = GetYield() * 4;
def iv;
if GetAggregationPeriod() < AggregationPeriod.DAY {
    iv = imp_volatility(period = AggregationPeriod.DAY);
} else {
    iv = imp_volatility();
}

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 + 14;
def N3rdF = DaysTillDate(ExpYear * 10000 + ExpMonth2 * 100 + ExpDOM);
def OptionDateString = ExpYear * 10000 + ExpMonth2 * 100 + ExpDOM + 1;
Addlabel(1, "Options Expy. Date: " + ExpMonth2 + "/" + ExpDOM + "/" + AsPrice(ExpYear), color.white);

# Strike Plots
plot Strike = HighestAll(if IsNaN(c[-1])
                         then Round(c, 0)
                         else Double.NaN);
Strike.SetDefaultColor(Color.CYAN);
plot OTM_1_Strike = HighestAll(if IsNaN(c[-1])
                               then Round(c, 0) - 1
                               else Double.NaN);
OTM_1_Strike.SetDefaultColor(Color.CYAN);
plot OTM_2_Strike = HighestAll(if IsNaN(c[-1])
                               then Round(c, 0) - 2
                               else Double.NaN);

OTM_2_Strike.SetDefaultColor(Color.CYAN);
plot ITM_1_Strike = HighestAll(if IsNaN(c[-1])
                               then Round(c, 0) + 1
                               else Double.NaN);

ITM_1_Strike.SetDefaultColor(Color.CYAN);
plot ITM_2_Strike = HighestAll(if IsNaN(c[-1])
                               then Round(c, 0) + 2
                               else Double.NaN);

ITM_2_Strike.SetDefaultColor(Color.CYAN);

# At The Money
def ATMTheoC = OptionPrice(Strike, 0, N3rdF, c, iv, 0, yield, interest_rate);
def ATM_CALL = if IsNaN(ATMTheoC)
               then ATM_CALL[1]
               else ATMTheoC;

def ATM_OI_C = open_interest(GetATMOption(GetUnderlyingSymbol(), OptionDateString, OptionClass.CALL), period = AggregationPeriod.DAY);

def ATMOIC = if IsNaN(ATM_OI_C)
             then ATMOIC[1]
             else ATM_OI_C;

def ATMTheoP = OptionPrice(Strike, 1, N3rdF, c, iv, 0, yield, interest_rate);
def ATM_PUT = if IsNaN(ATMTheoP)
              then ATM_PUT[1]
              else ATMTheoP;

def ATM_OI_P = open_interest(GetATMOption(GetUnderlyingSymbol(), OptionDateString, OptionClass.PUT), period = AggregationPeriod.DAY);

def ATMOIP = if IsNaN(ATM_OI_P)
             then ATMOIP[1]
             else ATM_OI_P;

def bubbleLocation = IsNaN(c[2]) and !IsNaN(c[3]);
AddChartBubble(bubbleLocation, Strike, "CALL = " +
               AsDollars(ATM_CALL) +

            "  OI = " +

               ATMOIC +

              "\nPUT    = " + AsDollars(ATM_PUT) +

            "  OI = " + ATMOIP, 

               Color.CYAN,

               if c > Strike 

               then 0 

               else 1);

# $1.00 Out Of The Money

def OTM_1_TheoC = OptionPrice(OTM_1_Strike, 0, N3rdF, c, iv, 0, yield, interest_rate);

def OTM_1_CALL = if IsNaN(OTM_1_TheoC)
                 then OTM_1_CALL[1]
                 else OTM_1_TheoC;

def OTM_OI_C = open_interest("." + GetUnderlyingSymbol() + (Expyear-2000) + (if Expmonth2 < 10 then 0 else double.nan) + (ExpMonth2) + (N3rdF) + "C" + OTM_1_Strike, period = AggregationPeriod.DAY);

def OTMOIC = if IsNaN(OTM_OI_C)
             then OTMOIC[1]
             else OTM_OI_C;

def OTM_1_TheoP = OptionPrice(OTM_1_Strike, 1, N3rdF, c, iv, 0, yield, interest_rate);

def OTM_1_PUT = if IsNaN(OTM_1_TheoP)
                then OTM_1_PUT[1]
                else OTM_1_TheoP;

def OTM_OI_P = open_interest("." + GetUnderlyingSymbol() + (Expyear-2000) + (if Expmonth2 < 10 then 0 else double.nan) + (ExpMonth2) + (N3rdF) + "P" + OTM_1_Strike, period = AggregationPeriod.DAY);

def OTMOIP = if IsNaN(OTM_OI_P)
             then OTMOIP[1]
             else OTM_OI_P;

AddChartBubble(bubbleLocation, OTM_1_Strike, "CALL = " +

               AsDollars(OTM_1_CALL) +
           "   OI = " + OTMOIC +
              "\nPUT    = " + AsDollars(OTM_1_PUT) +
           "   OI = " + OTMOIP, 
               Color.CYAN,
               if c > OTM_1_Strike 
               then 0 
               else 1);

# $2.00 Out Of The Money

def OTM_2_TheoC = OptionPrice(OTM_2_Strike, 0, N3rdF, c, iv, 0, yield, interest_rate);

def OTM_2_CALL = if IsNaN(OTM_2_TheoC)
                 then OTM_2_CALL[1]
                 else OTM_2_TheoC;

def OTM2_OI_C = open_interest("." + GetUnderlyingSymbol() + (Expyear-2000) + (if Expmonth2 < 10 then 0 else double.nan) + (ExpMonth2) + (N3rdF) + "C" + OTM_2_Strike, period = AggregationPeriod.DAY);

def OTMOIC2 = if IsNaN(OTM2_OI_C)
             then OTMOIC2[1]
             else OTM2_OI_C;

def OTM_2_TheoP = OptionPrice(OTM_2_Strike, 1, N3rdF, c, iv, 0, yield, interest_rate);

def OTM_2_PUT = if IsNaN(OTM_2_TheoP)
                then OTM_2_PUT[1]
                else OTM_2_TheoP;

def OTM2_OI_P = open_interest("." + GetUnderlyingSymbol() + (Expyear-2000) + (if Expmonth2 < 10 then 0 else double.nan) + (ExpMonth2) + (N3rdF) + "P" + OTM_2_Strike, period = AggregationPeriod.DAY);

def OTMOIP2 = if IsNaN(OTM2_OI_P)
             then OTMOIP2[1]
             else OTM2_OI_P;

AddChartBubble(bubbleLocation, OTM_2_Strike, "CALL = " +

               AsDollars(OTM_2_CALL) +

           "   OI = " + OTMOIC2 +

              "\nPUT    = " + AsDollars(OTM_2_PUT) +

           "   OI = " + OTMOIP2, 

               Color.CYAN,

               if c > OTM_2_Strike 

               then 0 

               else 1);

# $1.00 In The Money
def ITM_1_TheoC = OptionPrice(ITM_1_Strike, 0, N3rdF, c, iv, 0, yield, interest_rate);

def ITM_1_CALL = if IsNaN(ITM_1_TheoC)
                 then ITM_1_CALL[1]
                 else ITM_1_TheoC;

def ITM_OI_C = open_interest("." + GetUnderlyingSymbol() + (Expyear-2000) + (if Expmonth2 < 10 then 0 else double.nan) + (ExpMonth2) + (N3rdF) + "C" + ITM_1_Strike, period = AggregationPeriod.DAY);

def ITMOIC = if IsNaN(ITM_OI_C)
             then ITMOIC[1]
             else ITM_OI_C;

def ITM_1_TheoP = OptionPrice(ITM_1_Strike, 1, N3rdF, c, iv, 0, yield, interest_rate);

def ITM_1_PUT = if IsNaN(ITM_1_TheoP)
                then ITM_1_PUT[1]
                else ITM_1_TheoP;

def ITM_OI_P = open_interest("." + GetUnderlyingSymbol() + (Expyear-2000) + (if Expmonth2 < 10 then 0 else double.nan) + (ExpMonth2) + (N3rdF) + "P" + ITM_1_Strike, period = AggregationPeriod.DAY);

def ITMOIP = if IsNaN(ITM_OI_P)
             then ITMOIP[1]
             else ITM_OI_P;

AddChartBubble(bubbleLocation, ITM_1_Strike, "CALL = " +

               AsDollars(ITM_1_CALL) +

            "  OI = " + ITMOIC +

              "\nPUT    = " + AsDollars(ITM_1_PUT) +

            "  OI = " + ITMOIP, 

               Color.CYAN,

               if Strike > ITM_1_Strike 

               then 0 

               else 1);

# $2.00 In The Money
def ITM_2_TheoC = OptionPrice(ITM_2_Strike, 0, N3rdF, c, iv, 0, yield, interest_rate);

def ITM_2_CALL = if IsNaN(ITM_2_TheoC)
                 then ITM_2_CALL[1]
                 else ITM_2_TheoC;

def ITM2_OI_C = open_interest("." + GetUnderlyingSymbol() + (Expyear-2000) + (if Expmonth2 < 10 then 0 else double.nan) + (ExpMonth2) + (N3rdF) + "C" + ITM_2_Strike, period = AggregationPeriod.DAY);

def ITMOIC2 = if IsNaN(ITM2_OI_C)
             then ITMOIC2[1]
             else ITM2_OI_C;

def ITM_2_TheoP = OptionPrice(ITM_2_Strike, 1, N3rdF, c, iv, 0, yield, interest_rate);

def ITM_2_PUT = if IsNaN(ITM_2_TheoP)
                then ITM_2_PUT[1]
                else ITM_2_TheoP;

def ITM2_OI_P = open_interest("." + GetUnderlyingSymbol() + (Expyear-2000) + (if Expmonth2 < 10 then 0 else double.nan) + (ExpMonth2) + (N3rdF) + "P" + ITM_2_Strike, period = AggregationPeriod.DAY);

def ITMOIP2 = if IsNaN(ITM2_OI_P)
             then ITMOIP2[1]
             else ITM2_OI_P;

AddChartBubble(bubbleLocation, ITM_2_Strike, "CALL = " +

               AsDollars(ITM_2_CALL) +

            "  OI = " + ITMOIC2 +

              "\nPUT    = " + AsDollars(ITM_2_PUT) +

            "  OI = " + ITMOIP2, 

               Color.CYAN,

               if Strike > ITM_2_Strike 

               then 0 

               else 1);
# End Code Option Prices and Open interest
 
Hello thinkScript wizards, trying to setup a scan for option volume twice the option open interest for the same strike date. Need a thinkScript to insert into the editor. Any guidance or help would be appreciated. Not code literate.

Thanks in advance.
 
The ToS Options Hacker Module doesn't allow the using of custom scripts to scan against options related data.
Your scan requests can't be scripted into the scanner.
 
thanks for the quick reply. When I insert into editor I get an error message --> No such function: GetATMOption

Also, can it be coded without specifying the DOE and scan all of them. I will use a filter for DOE's less than 60 days.
 
Last edited by a moderator:
@calvingee No, GetATMOption() is not available within the scanner, that's why you see the message as displayed

I have seen studies with code using GetATMOption within a study. Additionally I have also used it in the past within a user defined custom quote within an option chain. That helps me to flag strikes where the volume is greater than the open interest
 
Hello, can someone create a script that scans for options with the highest change in open interest from the previous session e.g. day or hour, 5 min etc. Perhaps a % change may be most suitable.
 
Cindy Faber TOS: Select one of the custom watchlist columns and replace code in it with this. Then open option chain and select your new custom column's name as an option chain column.

IMPORTANT REMINDER: per industry regulation OI is updated only once/day, a few hours after market close.

Unfortunately, fields like Option Volume, Open Interest are not available to scan against. I recently tuned in to the Thinkscript lounge where this specific issue was discussed.

Code:
#HINT: this is a custom watchlist column that can be selected as a column on a watchlist of option symbols and/or as a column on the option chain


plot OI_NetChg = open_interest() - open_interest()[1];
OI_NetChg.SetDefaultColor(color.BLACK);
AssignBackgroundColor(if OI_NetChg > 0 then color.GREEN
                                                                          else if OI_NetChg < 0
                                                                                  then color.RED
                                                                                  else color.GRAY);


Or a more space efficient version:


def OI_NetChg = open_interest() - open_interest()[1];
AddLabel(yes, Round(OI_NetChg, 0), color.BLACK);
AssignBackgroundColor(if OI_NetChg > 0 then color.GREEN
                                                                          else if OI_NetChg < 0                             
                                                                                  then color.RED
                                                                                  else color.GRAY);


here is another way to use one of your custom columns to create an option chain column:


#HINT: this is a custom watchlist column that can be selected as a column on a watchlist of option symbols and/or as a column on the option chain.  It is blank if volume is lower than open_interest allowing it to act as an alert by only appearing when volume is higher than open_interest


def alert = volume > open_interest;
AddLabel(yes, if alert then "volume vs OI" else ".", color.BLACK);
AssignBackgroundColor(if alert == 1 then color.RED else color.LIGHT_GRAY);
 
ATkJjlY.png


Lots of interest at $86 and $87 levels
 
Does anyone has written a script for the options volume analysis indicator? If not, can anyone help to make one which can show in the chart according to the thinkorswim option chain or options statistics or options times and sales? Thanks in advance!
 
I was messing around with the code in the original post, just trying to capture more volume from more strike prices. I separated the Call and Put Strike prices so you can start from ITM a few strikes in on each. The indicator will get the symbol you are on but you still have to make sure the Exp Date and strike spacing is accurate to the stock you are on. As far as I can tell the indicator might give you a heads up if the sentiment is changing for that given expiration (best case and the idea behind it). At worst you might not have relevant information as inputs and get a false reading. If you zoom out to the daily then the total daily for each strike should match each label.

iH7bjAZ.png


Code:
declare lower;
input optionSeriesPrefix = "200214";
input strike = 222.5;
input strikecall = 225;
input strikeSpacing = .5;
#{ ".5", default "1", "2.5", "5", "10", "25" };
input Showput = yes;
input Showput1 = yes;
input Showput2 = yes;
input Showput3 = yes;
input Showput4 = yes;
input Showput5 = yes;
input Showput6 = yes;
input Showput7 = yes;
input Showput8 = yes;
input Showput9 = no;
input Showput10 = no;
input Showput11 = no;
input Showput12 = no;
input  Showcall = yes;
input  Showcall1 = yes;
input  Showcall2 = yes;
input  Showcall3 = yes;
input  Showcall4 = yes;
input  Showcall5 = yes;
input  Showcall6 = yes;
input  Showcall7 = yes;
input  Showcall8 = yes;
input  Showcall9 = no;
input  Showcall10 = no;
input  Showcall11 = no;
input  Showcall12 = no;
addlabel(1, getSymbol()+" Exp:"+ optionSeriesPrefix + " PStrike:" + strike + " CStrike:" + strikecall, color.white);

### Put Option Volume
def putOptionVolume =  if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike)))));
def putOptionVolume1 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing)))));
def putOptionVolume2 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing)))));
def putOptionVolume3 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume4 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume5 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume6 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume7 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume8 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume9 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume10 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume11 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume12 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", Strike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
####Call Option Volume
def callOptionVolume =  if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall)))));
def callOptionVolume1 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing)))));
def callOptionVolume2 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing)))));
def callOptionVolume3 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume4 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume5 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume6 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume7 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume8 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume9 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume10 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume11 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume12 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", Strikecall + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));

plot Putvol = putOptionVolume + putOptionVolume1 + putOptionVolume2 + putOptionVolume3 + putOptionVolume4 + putOptionVolume5 + putOptionVolume6 + putOptionVolume7 + putOptionVolume8 + putOptionVolume9 + putOptionVolume10 + putOptionVolume11 + putOptionVolume12;
plot Callvol = callOptionVolume + callOptionVolume1 + callOptionVolume2 + callOptionVolume3 + callOptionVolume4 + callOptionVolume5 + callOptionVolume6 + callOptionVolume7 + callOptionVolume8 + callOptionVolume9 + callOptionVolume10 + callOptionVolume11 + callOptionVolume12;

Putvol.SetPaintingStrategy(PaintingStrategy.LINE);
Callvol.SetPaintingStrategy(PaintingStrategy.LINE);
Putvol.SetDefaultColor(Color.RED);
Callvol.SetDefaultColor(Color.CYAN);
AddCloud(Callvol, Putvol, Color.CYAN, Color.RED);
plot ZeroLine = 0;
ZeroLine.SetDefaultColor(Color.GRAY);
AddCloud(Callvol, ZeroLine, Color.CYAN, Color.RED);
AddCloud(Putvol, ZeroLine, Color.RED, Color.CYAN);
AddLabel(1, callOptionVolume, Color.CYAN);
AddLabel(1, callOptionVolume1, Color.CYAN);
AddLabel(1, callOptionVolume2, Color.CYAN);
AddLabel(1, callOptionVolume3, Color.CYAN);
AddLabel(1, callOptionVolume4, Color.CYAN);
AddLabel(1, callOptionVolume5, Color.CYAN);
AddLabel(1, callOptionVolume6, Color.CYAN);
AddLabel(1, callOptionVolume7, Color.CYAN);
AddLabel(1, callOptionVolume8, Color.CYAN);
AddLabel(1, callOptionVolume9, Color.CYAN);
AddLabel(1, callOptionVolume10, Color.CYAN);
AddLabel(1, callOptionVolume11, Color.CYAN);
AddLabel(1, callOptionVolume12, Color.CYAN);
AddLabel(1, putOptionVolume);
AddLabel(1, putOptionVolume1);
AddLabel(1, putOptionVolume2);
AddLabel(1, putOptionVolume3);
AddLabel(1, putOptionVolume4);
AddLabel(1, putOptionVolume5);
AddLabel(1, putOptionVolume6);
AddLabel(1, putOptionVolume7);
AddLabel(1, putOptionVolume8);
AddLabel(1, putOptionVolume9);
AddLabel(1, putOptionVolume10);
AddLabel(1, putOptionVolume11);
AddLabel(1, putOptionVolume12);
 
Last edited by a moderator:
@DeusMecanicus What does the below mean?

input strike = 222.5;
input strikecall = 225;

If my spread is a Sell Put spread, input strike would be Put, input strikecall would be Call?
I made a few updates this morning to the code I posted yesterday. It should clear up some confusion.
The Input PutStrike is your starting point for puts from the option chain. From there it will gather the strike points below it (consider starting a few strikes in the money and then it will gather those and then go to OTM strikes).
The Input Callstrike will be the starting point for calls. From the starting point it will gather the volume from the strikes above it.
The strike spacing will determine what other strikes you are pulling from to gather the volume at that strike price.
Looks like somebody was betting on a drop today!
There is two different strike spacing on the indicators in the picture, one is set to 1 and the other .5
I added a more descriptive label so you can see how each strike is aggregating throughout the time frame.

I also borrowed some code from Dilbert_BlockTrade_V1 to compare volume of those strikes to tick count, as indicated by the dot.
This is just a small glimpse of the option chain but I really want something that I can visualize in real time instead of watching the Options Time and Sales. Does anyone have any better methods of pulling data from the Option Chain?

Code:
declare lower;
input optionSeriesPrefix = "200221";
input PutStrike = 340;
input CallStrike = 335;
input strikeSpacing = .5;
#{ ".5", default "1", "2.5", "5", "10", "25" };
input ShowAllLabels = no;
input Showput = no;
input Showput1 = no;
input Showput2 = no;
input Showput3 = no;
input Showput4 = no;
input Showput5 = no;
input Showput6 = no;
input Showput7 = no;
input Showput8 = no;
input Showput9 = no;
input Showput10 = no;
input Showput11 = no;
input Showput12 = no;
input  Showcall = no;
input  Showcall1 = no;
input  Showcall2 = no;
input  Showcall3 = no;
input  Showcall4 = no;
input  Showcall5 = no;
input  Showcall6 = no;
input  Showcall7 = no;
input  Showcall8 = no;
input  Showcall9 = no;
input  Showcall10 = no;
input  Showcall11 = no;
input  Showcall12 = no;
addlabel(1, getSymbol()+" Exp:"+ optionSeriesPrefix + " CStrike:" + CallStrike + " PStrike:" + PutStrike , color.white);

### Put Option Volume
def putOptionVolume =  if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike)))));
def putOptionVolume1 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing)))));
def putOptionVolume2 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing)))));
def putOptionVolume3 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume4 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume5 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume6 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume7 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume8 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume9 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume10 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume11 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume12 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
####Call Option Volume
def callOptionVolume =  if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike)))));
def callOptionVolume1 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing)))));
def callOptionVolume2 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing)))));
def callOptionVolume3 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume4 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume5 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume6 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume7 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume8 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume9 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume10 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume11 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume12 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));

plot Putvol = putOptionVolume + putOptionVolume1 + putOptionVolume2 + putOptionVolume3 + putOptionVolume4 + putOptionVolume5 + putOptionVolume6 + putOptionVolume7 + putOptionVolume8 + putOptionVolume9 + putOptionVolume10 + putOptionVolume11 + putOptionVolume12;
plot Callvol = callOptionVolume + callOptionVolume1 + callOptionVolume2 + callOptionVolume3 + callOptionVolume4 + callOptionVolume5 + callOptionVolume6 + callOptionVolume7 + callOptionVolume8 + callOptionVolume9 + callOptionVolume10 + callOptionVolume11 + callOptionVolume12;

Putvol.SetPaintingStrategy(PaintingStrategy.LINE);
Callvol.SetPaintingStrategy(PaintingStrategy.LINE);
Putvol.SetDefaultColor(Color.RED);
Callvol.SetDefaultColor(Color.CYAN);
AddCloud(Callvol, Putvol, Color.CYAN, Color.RED);
plot ZeroLine = 0;
ZeroLine.SetDefaultColor(Color.GRAY);
AddCloud(Callvol, ZeroLine, Color.CYAN, Color.RED);
AddCloud(Putvol, ZeroLine, Color.RED, Color.CYAN);
AddLabel(Showcall or ShowAllLabels, Concat("C", CallStrike) + ":  " + callOptionVolume, Color.CYAN);
AddLabel(Showcall1 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing) + ":  " + callOptionVolume1, Color.CYAN);
AddLabel(Showcall2 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume2, Color.CYAN);
AddLabel(Showcall3 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume3, Color.CYAN);
AddLabel(Showcall4 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume4, Color.CYAN);
AddLabel(Showcall5 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume5, Color.CYAN);
AddLabel(Showcall6 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume6, Color.CYAN);
AddLabel(Showcall7 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume7, Color.CYAN);
AddLabel(Showcall8 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume8, Color.CYAN);
AddLabel(Showcall9 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume9, Color.CYAN);
AddLabel(Showcall10 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume10, Color.CYAN);
AddLabel(Showcall11 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume11 , Color.CYAN);
AddLabel(Showcall12 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume12, Color.CYAN);
AddLabel(Showput or ShowAllLabels, Concat("P", PutStrike) + ":  " + putOptionVolume);
AddLabel(Showput1 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing) + ":  " + putOptionVolume1);
AddLabel(Showput2 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume2);
AddLabel(Showput3 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume3);
AddLabel(Showput4 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume4);
AddLabel(Showput5 or ShowAllLabels,Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume5);
AddLabel(Showput6 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume6);
AddLabel(Showput7 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume7);
AddLabel(Showput8 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume8);
AddLabel(Showput9 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume9);
AddLabel(Showput10 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume10);
AddLabel(Showput11 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume11);
AddLabel(Showput12 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume12);


### Put Option tick_count
def putOptiontick_count =  if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike)))));
def putOptiontick_count1 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing)))));
def putOptiontick_count2 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing)))));
def putOptiontick_count3 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count4 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count5 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count6 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count7 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count8 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count9 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count10 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count11 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count12 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
####Call Option tick_count
def callOptiontick_count =  if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike)))));
def callOptiontick_count1 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing)))));
def callOptiontick_count2 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing)))));
def callOptiontick_count3 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count4 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count5 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count6 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count7 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count8 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count9 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count10 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count11 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count12 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));

def Puttick = putOptiontick_count + putOptiontick_count1 + putOptiontick_count2 + putOptiontick_count3 + putOptiontick_count4 + putOptiontick_count5 + putOptiontick_count6 + putOptiontick_count7 + putOptiontick_count8 + putOptiontick_count9 + putOptiontick_count10 + putOptiontick_count11 + putOptiontick_count12;
def Calltick = callOptiontick_count + callOptiontick_count1 + callOptiontick_count2 + callOptiontick_count3 + callOptiontick_count4 + callOptiontick_count5 + callOptiontick_count6 + callOptiontick_count7 + callOptiontick_count8 + callOptiontick_count9 + callOptiontick_count10 + callOptiontick_count11 + callOptiontick_count12;

#Puttick.SetPaintingStrategy(PaintingStrategy.LINE);
#Calltick.SetPaintingStrategy(PaintingStrategy.LINE);
#Puttick.SetDefaultColor(Color.light_red);
#Calltick.SetDefaultColor(Color.plum);
#AddCloud(Calltick, Puttick, Color.plum, Color.light_RED);

#AddCloud(Calltick, ZeroLine, Color.CYAN, Color.RED);
#AddCloud(Puttick, ZeroLine, Color.RED, Color.CYAN);

###################################
#StudyName: Dilbert_BlockTrade_V1
#Description:  Identify bars with high volume relative to the tick_count.  Such bars could indicate a block trade, or a possible change in trend. 
#Author: Dilbert
#Requested By:  
# Ver     Date     Auth      Change
# V1      090717   Dilbert   1st code cut
# TOS.mx Link:
# Trading Notes:  Identify bars with high volume relative to the tick_count.  Such bars could indicate a block trade, or a possible change in trend. 


#PUT RATIO
input AvgType = AverageType.EXPONENTIAL;
input MaLength = 20;
def V = Putvol;
def TC = Puttick;
def TradeSize = V / TC;

input displace = 0;
input SdLength = 20;
input Num_Dev_up = 2.0;
input averageType = AverageType.SIMPLE;

def sDev = StDev(data = TradeSize[-displace], length = SdLength);

def MA = MovingAverage(AvgType,  TradeSize, MaLength);
plot Dot = if TradeSize > Ma + (sDev * Num_Dev_up) then Putvol else Double.NaN;
Dot.SetPaintingStrategy(PaintingStrategy.Points);
Dot.SetLineWeight(5);
Dot.AssignValueColor(color.red);

#CALL RATIO
input AvgType1 = AverageType.EXPONENTIAL;
input MaLength1 = 20;
def V1 = Callvol;
def TC1 = Calltick;
def TradeSize1 = V1 / TC1;

input displace1 = 0;
input SdLength1 = 20;
input Num_Dev_up1 = 2.0;
input averageType1 = AverageType.SIMPLE;

def sDev1 = StDev(data = TradeSize1[-displace1], length = SdLength1);

def MA1 = MovingAverage(AvgType1,  TradeSize1, MaLength1);
plot Dot1 = if TradeSize1 > Ma1 + (sDev1 * Num_Dev_up1) then Callvol else Double.NaN;
Dot1.SetPaintingStrategy(PaintingStrategy.Points);
Dot1.SetLineWeight(5);
Dot1.AssignValueColor(color.cyan);
Edit: Fixed all the labels. Forgot to attach them to the input.
 
Last edited:
Great study, thanks for the work.

What do you think of the idea of applying a dollar value to the volume, eg,

def price = close(".SPY200221C337");
plot mfa1 = sum(if price < price[1] then -price * volume else if price > price[1] then price * volume else 0);
etc
and summing the money flow values, for puts and calls separately,
(where volume would be volume as pulled from your script, )to see if options are being bot or sold?

Sometimes I wonder if knowing the dollar values helps .

Anyway, thanks again!
 
@codydog I was actually thinking the same exact thing last night. That and possibly splitting up the some of the strike prices into different groups to see where the volume is coming from. Possibly one group ITM or ATM, one that is just OTM and one that is far OTM. Its something I'll work on when I have a little more time. Here is a rough average of money being spent at these strikes prices.

Code:
declare lower;
input optionSeriesPrefix = "200221";
input PutStrike = 340;
input CallStrike = 335;
input strikeSpacing = .5;
#{ ".5", default "1", "2.5", "5", "10", "25" };
input ShowAllLabels = no;
input Showput = no;
input Showput1 = no;
input Showput2 = no;
input Showput3 = no;
input Showput4 = no;
input Showput5 = no;
input Showput6 = no;
input Showput7 = no;
input Showput8 = no;
input Showput9 = no;
input Showput10 = no;
input Showput11 = no;
input Showput12 = no;
input Showput13 = no;
input Showput14 = no;
input Showput15 = no;
input Showput16 = no;
input Showput17 = no;
input Showput18 = no;
input Showput19 = no;
input Showput20 = no;
input  Showcall = no;
input  Showcall1 = no;
input  Showcall2 = no;
input  Showcall3 = no;
input  Showcall4 = no;
input  Showcall5 = no;
input  Showcall6 = no;
input  Showcall7 = no;
input  Showcall8 = no;
input  Showcall9 = no;
input  Showcall10 = no;
input  Showcall11 = no;
input  Showcall12 = no;
input  Showcall13 = no;
input  Showcall14 = no;
input  Showcall15 = no;
input  Showcall16 = no;
input  Showcall17 = no;
input  Showcall18 = no;
input  Showcall19 = no;
input  Showcall20 = no;
addlabel(1, getSymbol()+" Exp:"+ optionSeriesPrefix + " CStrike:" + CallStrike + " PStrike:" + PutStrike , color.white);

### Put Option Volume
def putOptionVolume =  if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike)))));
def putOptionVolume1 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing)))));
def putOptionVolume2 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing)))));
def putOptionVolume3 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume4 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume5 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume6 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume7 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume8 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume9 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume10 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume11 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume12 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume13 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume14 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume15 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume16 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume17 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume18 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume19 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionVolume20 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));

####Call Option Volume
def callOptionVolume =  if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike)))));
def callOptionVolume1 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing)))));
def callOptionVolume2 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing)))));
def callOptionVolume3 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume4 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume5 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume6 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume7 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume8 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume9 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume10 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume11 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume12 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume13 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume14 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume15 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume16 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume17 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume18 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume19 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionVolume20 = if IsNaN(volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else volume(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
### Put Option ohlc4
def putOptionohlc4 =  if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike)))));
def putOptionohlc41 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing)))));
def putOptionohlc42 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing)))));
def putOptionohlc43 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionohlc44 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionohlc45 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionohlc46 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionohlc47 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionohlc48 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionohlc49 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionohlc410 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionohlc411 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionohlc412 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionohlc413 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionohlc414 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionohlc415 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionohlc416 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionohlc417 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionohlc418 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionohlc419 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptionohlc420 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));

####Call Option ohlc4
def callOptionohlc4 =  if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike)))));
def callOptionohlc41 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing)))));
def callOptionohlc42 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing)))));
def callOptionohlc43 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionohlc44 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionohlc45 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionohlc46 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionohlc47 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionohlc48 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionohlc49 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionohlc410 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionohlc411 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionohlc412 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionohlc413 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionohlc414 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionohlc415 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionohlc416 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionohlc417 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionohlc418 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionohlc419 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptionohlc420 = if IsNaN(ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else ohlc4(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));

plot Putvol = (putOptionVolume*putOptionohlc4*100) + (putOptionVolume1*putOptionohlc41*100) + (putOptionVolume2*putOptionohlc42*100) + (putOptionVolume3*putOptionohlc43*100) + (putOptionVolume4*putOptionohlc44*100) + (putOptionVolume5*putOptionohlc45*100) + (putOptionVolume6*putOptionohlc46*100) + (putOptionVolume7*putOptionohlc47*100) + (putOptionVolume8*putOptionohlc48*100) + (putOptionVolume9*putOptionohlc49*100) + (putOptionVolume10*putOptionohlc410*100) + (putOptionVolume11*putOptionohlc411*100) + (putOptionVolume12*putOptionohlc412*100) + (putOptionVolume13*putOptionohlc413*100) + (putOptionVolume14*putOptionohlc414*100) + (putOptionVolume15*putOptionohlc415*100) + (putOptionVolume16*putOptionohlc416*100) + (putOptionVolume17*putOptionohlc417*100) + (putOptionVolume18*putOptionohlc418*100) + (putOptionVolume19*putOptionohlc419*100) + (putOptionVolume20*putOptionohlc420*100);
plot Callvol = (callOptionVolume*callOptionohlc4*100) + (callOptionVolume1*callOptionohlc41*100) + (callOptionVolume2*callOptionohlc42*100) + (callOptionVolume3*callOptionohlc43*100) + (callOptionVolume4*callOptionohlc44*100) + (callOptionVolume5*callOptionohlc45*100) + (callOptionVolume6*callOptionohlc46*100) + (callOptionVolume7*callOptionohlc47*100) + (callOptionVolume8*callOptionohlc48*100) + (callOptionVolume9*callOptionohlc49*100) + (callOptionVolume10*callOptionohlc410*100) + (callOptionVolume11*callOptionohlc411*100) + (callOptionVolume12*callOptionohlc412*100) + (callOptionVolume13*callOptionohlc413*100) + (callOptionVolume14*callOptionohlc414*100) + (callOptionVolume15*callOptionohlc415*100) + (callOptionVolume16*callOptionohlc416*100) + (callOptionVolume17*callOptionohlc417*100) + (callOptionVolume18*callOptionohlc418*100) + (callOptionVolume19*callOptionohlc419*100) + (callOptionVolume20*callOptionohlc420*100);

Putvol.SetPaintingStrategy(PaintingStrategy.LINE);
Callvol.SetPaintingStrategy(PaintingStrategy.LINE);
Putvol.SetDefaultColor(Color.RED);
Callvol.SetDefaultColor(Color.CYAN);
AddCloud(Callvol, Putvol, Color.CYAN, Color.RED);
plot ZeroLine = 0;
ZeroLine.SetDefaultColor(Color.GRAY);
AddCloud(Callvol, ZeroLine, Color.CYAN, Color.RED);
AddCloud(Putvol, ZeroLine, Color.RED, Color.CYAN);
AddLabel(Showcall or ShowAllLabels, Concat("C", CallStrike) + ":  " + callOptionVolume, Color.CYAN);
AddLabel(Showcall1 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing) + ":  " + callOptionVolume1, Color.CYAN);
AddLabel(Showcall2 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume2, Color.CYAN);
AddLabel(Showcall3 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume3, Color.CYAN);
AddLabel(Showcall4 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume4, Color.CYAN);
AddLabel(Showcall5 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume5, Color.CYAN);
AddLabel(Showcall6 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume6, Color.CYAN);
AddLabel(Showcall7 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume7, Color.CYAN);
AddLabel(Showcall8 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume8, Color.CYAN);
AddLabel(Showcall9 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume9, Color.CYAN);
AddLabel(Showcall10 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume10, Color.CYAN);
AddLabel(Showcall11 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume11 , Color.CYAN);
AddLabel(Showcall12 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume12, Color.CYAN);
AddLabel(Showcall13 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume13, Color.CYAN);
AddLabel(Showcall14 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume14, Color.CYAN);
AddLabel(Showcall15 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume15, Color.CYAN);
AddLabel(Showcall16 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume16, Color.CYAN);
AddLabel(Showcall17 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume17, Color.CYAN);
AddLabel(Showcall18 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume18, Color.CYAN);
AddLabel(Showcall19 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume19, Color.CYAN);
AddLabel(Showcall20 or ShowAllLabels, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing) + ":  " + callOptionVolume20, Color.CYAN);
AddLabel(Showput or ShowAllLabels, Concat("P", PutStrike) + ":  " + putOptionVolume);
AddLabel(Showput1 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing) + ":  " + putOptionVolume1);
AddLabel(Showput2 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume2);
AddLabel(Showput3 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume3);
AddLabel(Showput4 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume4);
AddLabel(Showput5 or ShowAllLabels,Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume5);
AddLabel(Showput6 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume6);
AddLabel(Showput7 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume7);
AddLabel(Showput8 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume8);
AddLabel(Showput9 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume9);
AddLabel(Showput10 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume10);
AddLabel(Showput11 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume11);
AddLabel(Showput12 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume12);
AddLabel(Showput13 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume13);
AddLabel(Showput14 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume14);
AddLabel(Showput15 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume15);
AddLabel(Showput16 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume16);
AddLabel(Showput17 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume17);
AddLabel(Showput18 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume18);
AddLabel(Showput19 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume19);
AddLabel(Showput20 or ShowAllLabels, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing) + ":  " + putOptionVolume20);


### Put Option tick_count
def putOptiontick_count =  if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike)))));
def putOptiontick_count1 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing)))));
def putOptiontick_count2 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing)))));
def putOptiontick_count3 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count4 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count5 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count6 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count7 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count8 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count9 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count10 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count11 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count12 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count13 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count14 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count15 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count16 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count17 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count18 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count19 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));
def putOptiontick_count20 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("P", PutStrike - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing - strikeSpacing)))));

####Call Option tick_count
def callOptiontick_count =  if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike)))));
def callOptiontick_count1 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing)))));
def callOptiontick_count2 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing)))));
def callOptiontick_count3 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count4 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count5 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count6 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count7 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count8 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count9 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count10 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count11 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count12 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count13 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count14 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count15 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count16 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count17 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count18 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count19 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));
def callOptiontick_count20 = if IsNaN(tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))))) then 0 else tick_count(Concat(".", Concat(GetSymbol(), Concat(optionseriesprefix, Concat("C", CallStrike + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing + strikeSpacing)))));

def Puttick = putOptiontick_count + putOptiontick_count1 + putOptiontick_count2 + putOptiontick_count3 + putOptiontick_count4 + putOptiontick_count5 + putOptiontick_count6 + putOptiontick_count7 + putOptiontick_count8 + putOptiontick_count9 + putOptiontick_count10 + putOptiontick_count11 + putOptiontick_count12 + putOptiontick_count13 + putOptiontick_count14 + putOptiontick_count15 + putOptiontick_count16 + putOptiontick_count17 + putOptiontick_count18 + putOptiontick_count19 + putOptiontick_count20;
def Calltick = callOptiontick_count + callOptiontick_count1 + callOptiontick_count2 + callOptiontick_count3 + callOptiontick_count4 + callOptiontick_count5 + callOptiontick_count6 + callOptiontick_count7 + callOptiontick_count8 + callOptiontick_count9 + callOptiontick_count10 + callOptiontick_count11 + callOptiontick_count12 + callOptiontick_count13 + callOptiontick_count14 + callOptiontick_count15 + callOptiontick_count16 + callOptiontick_count17 + callOptiontick_count18 + callOptiontick_count19 + callOptiontick_count20;

#Puttick.SetPaintingStrategy(PaintingStrategy.LINE);
#Calltick.SetPaintingStrategy(PaintingStrategy.LINE);
#Puttick.SetDefaultColor(Color.light_red);
#Calltick.SetDefaultColor(Color.plum);
#AddCloud(Calltick, Puttick, Color.plum, Color.light_RED);

#AddCloud(Calltick, ZeroLine, Color.CYAN, Color.RED);
#AddCloud(Puttick, ZeroLine, Color.RED, Color.CYAN);

###################################
#StudyName: Dilbert_BlockTrade_V1
#Description:  Identify bars with high volume relative to the tick_count.  Such bars could indicate a block trade, or a possible change in trend.
#Author: Dilbert
#Requested By:
# Ver     Date     Auth      Change
# V1      090717   Dilbert   1st code cut
# TOS.mx Link:
# Trading Notes:  Identify bars with high volume relative to the tick_count.  Such bars could indicate a block trade, or a possible change in trend.


#PUT RATIO
input AvgType = AverageType.EXPONENTIAL;
input MaLength = 20;
def V = Putvol;
def TC = Puttick;
def TradeSize = V / TC;

input displace = 0;
input SdLength = 20;
input Num_Dev_up = 2.0;
input averageType = AverageType.SIMPLE;

def sDev = StDev(data = TradeSize[-displace], length = SdLength);

def MA = MovingAverage(AvgType,  TradeSize, MaLength);
plot Dot = if TradeSize > Ma + (sDev * Num_Dev_up) then Putvol else Double.NaN;
Dot.SetPaintingStrategy(PaintingStrategy.Points);
Dot.SetLineWeight(5);
Dot.AssignValueColor(color.red);

#CALL RATIO
input AvgType1 = AverageType.EXPONENTIAL;
input MaLength1 = 20;
def V1 = Callvol;
def TC1 = Calltick;
def TradeSize1 = V1 / TC1;

input displace1 = 0;
input SdLength1 = 20;
input Num_Dev_up1 = 2.0;
input averageType1 = AverageType.SIMPLE;

def sDev1 = StDev(data = TradeSize1[-displace1], length = SdLength1);

def MA1 = MovingAverage(AvgType1,  TradeSize1, MaLength1);
plot Dot1 = if TradeSize1 > Ma1 + (sDev1 * Num_Dev_up1) then Callvol else Double.NaN;
Dot1.SetPaintingStrategy(PaintingStrategy.Points);
Dot1.SetLineWeight(5);
Dot1.AssignValueColor(color.cyan);


There is definitely different signals when comparing just plain volume to the $ being spent.
Edit: Swapped pictures. Original picture didn't have matching expirations so it wasn't accurate.
 
Last edited:
@DeusMecanicus This is a great indicator, fantastic work!

Do you think you can make it easier to work with?

Can we have it retrieve the prefix automatically for the most recent weekly options?

Maybe you can have the call and put input prices automatically be entered by fetching the ATM strikes and working from there? (like by taking the stock price and rounding to the nearest dollar... so when we change companies we don't need to enter the strikes manually

Great work, great indicator... think it will be a lot more powerful if it is easier to use! thanks!
 
Last edited:
@DeusMecanicus

Hi, good morning, was watching this with aapl and spy, works great, so, thank you!

I was having some trouble using it with amzn and googl as well as with cl and some futures. Wondering why you think it is happening, tried some different settings but no luck.

Thanks in advance for any help or direction!
 

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
344 Online
Create Post

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