NOPE Indicator For ThinkOrSwim

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

If you have some time, reading her white paper helps to understand it. She seems to use tos for trading and an options data service for calculation. I've started using it but have limited experience
 
Nope...!!! Did a bit of reading just to see what it was about an it's nowhere near my trading style... I scalp options and I don't need to do a lot of research... I've already researched and selected the Stocks and ETF's that are in my Watchlist... In fact I just added a few and also removed a few I hadn't traded in a while just last night... Perhaps other members may find NOPE interesting, however...
 
Nope...!!! Did a bit of reading just to see what it was about an it's nowhere near my trading style... I scalp options and I don't need to do a lot of research... I've already researched and selected the Stocks and ETF's that are in my Watchlist... In fact I just added a few and also removed a few I hadn't traded in a while just last night... Perhaps other members may find NOPE interesting, however...

Scalping options is literally what NOPE is for...
 
But... But... But how would it possibly help me...??? I've done option analysis for over 30 years, including custom software... What, exactly, am I missing...???
30 years?! Damn dude

Edit: Looked at white paper and this isn't something you can program for TOS. You can't pull most of those option datasets
 
Last edited:
@wtf_dude

I'm out of my realm, but does this script help with the creation of a Thinkscript Nope Indicator.

EDIT: This also looks to have the same (or similar) script
EDIT: Another advanced (to me) look at getting options volume

Code:
# TS_OptionVolume.ts
# RBuckley 5/4/15
# https://github.com/rbuckley/thinkscript/blob/master/TS_OptionVolume.ts

declare lower;

#input strike = 260.0;
input strikeSpacing = 10.0;
input mode = {default volume, totalVolume, openInterest, volumePercentOI};
input totalStrikes = {default Five, Three, One};

def series = 1;
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 dynamicOptionExp = Concat(Concat(ExpYear, ExpMonth2), ExpDOM);

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;

def expiration = 20150515;

def strike = roundDown(close,0);

AddLabel(yes,  Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), 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( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("P", strike)))) then 0 else volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("P", strike)));
rec cumPutVolume = cumPutVolume[1] + putOptionVolume;
def totalputOptionVolume = volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("P", strike)), "DAY");
def putOptionOI = open_interest(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("P", strike)), "DAY");
def callOptionVolume = if IsNaN(volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("C", strike)))) then 0 else volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("C", strike)));
rec cumCallVolume = cumCallVolume[1] + callOptionVolume;
def totalcallOptionVolume = volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("C", strike)), "DAY");
def callOptionOI = open_interest(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("C", strike)), "DAY");

def putOptionVolume1 = if IsNaN(volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("P", strike - strikeSpacing)))) then 0 else volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("P", strike - strikeSpacing)));
rec cumPutVolume1 = cumPutVolume1[1] + putOptionVolume1;
def totalputOptionVolume1 = volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("P", strike - strikeSpacing)), "DAY");
def putOptionOI1 = open_interest(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("P", strike - strikeSpacing)), "DAY");
def callOptionVolume1 = if IsNaN(volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("C", strike - strikeSpacing)))) then 0 else volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("C", strike - strikeSpacing)));
rec cumCallVolume1 = cumCallVolume1[1] + callOptionVolume1;
def totalcallOptionVolume1 = volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("C", strike - strikeSpacing)), "DAY");
def callOptionOI1 = open_interest(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("C", strike - strikeSpacing)), "DAY");

def putOptionVolume2 = if IsNaN(volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("P", strike + strikeSpacing)))) then 0 else volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("P", strike + strikeSpacing)));
rec cumPutVolume2 = cumPutVolume2[1] + putOptionVolume2;
def totalputOptionVolume2 = volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("P", strike + strikeSpacing)), "DAY");
def putOptionOI2 = open_interest(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("P", strike + strikeSpacing)), "DAY");
def callOptionVolume2 = if IsNaN(volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("C", strike + strikeSpacing)))) then 0 else volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("C", strike + strikeSpacing)));
rec cumCallVolume2 = cumCallVolume2[1] + callOptionVolume2;
def totalcallOptionVolume2 = volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("C", strike + strikeSpacing)), "DAY");
def callOptionOI2 = open_interest(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("C", strike + strikeSpacing)), "DAY");

def putOptionVolume3 = if IsNaN(volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("P", strike - strikeSpacing - strikeSpacing)))) then 0 else volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("P", strike - strikeSpacing - strikeSpacing)));
rec cumPutVolume3 = cumPutVolume3[1] + putOptionVolume3;
def totalputOptionVolume3 = volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("P", strike - strikeSpacing - strikeSpacing)), "DAY");
def putOptionOI3 = open_interest(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("P", strike - strikeSpacing - strikeSpacing)), "DAY");
def callOptionVolume3 = if IsNaN(volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("C", strike - strikeSpacing - strikeSpacing)))) then 0 else volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("C", strike - strikeSpacing - strikeSpacing)));
rec cumCallVolume3 = cumCallVolume3[1] + callOptionVolume3;
def totalcallOptionVolume3 = volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("C", strike - strikeSpacing - strikeSpacing)), "DAY");
def callOptionOI3 = open_interest(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("C", strike - strikeSpacing - strikeSpacing)), "DAY");

def putOptionVolume4 = if IsNaN(volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("P", strike + strikeSpacing + strikeSpacing)))) then 0 else volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("P", strike + strikeSpacing + strikeSpacing)));
rec cumPutVolume4 = cumPutVolume4[1] + putOptionVolume4;
def totalputOptionVolume4 = volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("P", strike + strikeSpacing + strikeSpacing)), "DAY");
def putOptionOI4 = open_interest(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("P", strike + strikeSpacing + strikeSpacing)), "DAY");
def callOptionVolume4 = if IsNaN(volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("C", strike + strikeSpacing + strikeSpacing)))) then 0 else volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("C", strike + strikeSpacing + strikeSpacing)));
rec cumCallVolume4 = cumCallVolume4[1] + callOptionVolume4;
def totalcallOptionVolume4 = volume(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), Concat("C", strike + strikeSpacing + strikeSpacing)), "DAY");
def callOptionOI4 = open_interest(Concat( Concat(Concat(".", GetSymbol()), Concat(Concat(ExpYear - 2000, if ExpMonth2 < 10 then Concat("0", ExpMonth2) else Concat("", ExpMonth2)), if ExpDOM < 10 then Concat("0", ExpDOM) else Concat("", ExpDOM))), 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();
 
Last edited by a moderator:
Hi guys,

Much appreciated your help on this NOPE script which return the error " expected double".

As attached the script and image for this error. Thanks again for your advises.

Code:
# Script to get the total volume*delta at a spot for Net Option Pricing Effect
script TotalNope {
input StrikeDepth = 1;
input OpexCode = 1;
input CenterStrike = 1;
input StrikeSpacing = 1;
input IsCall = yes;
input DTE = 1;
input IV = 1;
input r = 1;
input t = 1;
input y = 1;

    def epsilon = 0.001 * close;
    

    def total =
        fold index = -(StrikeDepth) to (StrikeDepth + 1)
        with value = 0
        do
            if !IsNaN(
                volume(("." + GetSymbolPart()) + AsPrice(OpexCode) + (if IsCall then "C" else "P") + AsPrice(CenterStrike + (StrikeSpacing * index)))
            )
            then value +
                volume(("." + GetSymbolPart()) + AsPrice(OpexCode) + (if IsCall then "C" else "P") + AsPrice(CenterStrike + (StrikeSpacing * index))) * 100 *
                (OptionPrice(CenterStrike + StrikeSpacing * index, !isCall, DTE, close + epsilon, IV, no, y, r) - OptionPrice(CenterStrike + StrikeSpacing * index, !isCall, DTE, close, IV, no, y, r)) / epsilon * 100
                # if (1 / (1 + .2316419 * AbsValue(Log(close / (CenterStrike + (StrikeSpacing * index))) + ((r + (Sqr(IV) / 2)) * t)) / (IV * Sqrt(t)))) < 0
                #     then 1 - (1 - 1 / Sqrt(2 * Double.Pi) * Exp(-Power(AbsValue(Log(close / (CenterStrike + (StrikeSpacing * index))) + ((r + (Sqr(IV) / 2)) * t)) / (IV * Sqrt(t)), 2) / 2) *
                #         (.31938153 * 1 / (1 + .2316419 * AbsValue(Log(close / (CenterStrike + (StrikeSpacing * index))) + ((r + (Sqr(IV) / 2)) * t)) / (IV * Sqrt(t))) +
                #         -.356563782  * Power(1 / (1 + .2316419 * AbsValue(Log(close / (CenterStrike + (StrikeSpacing * index))) + ((r + (Sqr(IV) / 2)) * t)) / (IV * Sqrt(t))), 2) +
                #         1.781477937  * Power(1 / (1 + .2316419 * AbsValue(Log(close / (CenterStrike + (StrikeSpacing * index))) + ((r + (Sqr(IV) / 2)) * t)) / (IV * Sqrt(t))), 3) +
                #         -1.821255978 * Power(1 / (1 + .2316419 * AbsValue(Log(close / (CenterStrike + (StrikeSpacing * index))) + ((r + (Sqr(IV) / 2)) * t)) / (IV * Sqrt(t))), 4) +
                #         1.330274429  * Power(1 / (1 + .2316419 * AbsValue(Log(close / (CenterStrike + (StrikeSpacing * index))) + ((r + (Sqr(IV) / 2)) * t)) / (IV * Sqrt(t))), 5)))
                #     else (1 - 1 / Sqrt(2 * Double.Pi) * Exp(-Power(AbsValue(Log(close / (CenterStrike + (StrikeSpacing * index))) + ((r + (Sqr(IV) / 2)) * t)) / (IV * Sqrt(t)), 2) / 2) *
                #         (.31938153 * 1 / (1 + .2316419 * AbsValue(Log(close / (CenterStrike + (StrikeSpacing * index))) + ((r + (Sqr(IV) / 2)) * t)) / (IV * Sqrt(t))) +
                #         -.356563782  * Power(1 / (1 + .2316419 * AbsValue(Log(close / (CenterStrike + (StrikeSpacing * index))) + ((r + (Sqr(IV) / 2)) * t)) / (IV * Sqrt(t))), 2) +
                #         1.781477937  * Power(1 / (1 + .2316419 * AbsValue(Log(close / (CenterStrike + (StrikeSpacing * index))) + ((r + (Sqr(IV) / 2)) * t)) / (IV * Sqrt(t))), 3) +
                #         -1.821255978 * Power(1 / (1 + .2316419 * AbsValue(Log(close / (CenterStrike + (StrikeSpacing * index))) + ((r + (Sqr(IV) / 2)) * t)) / (IV * Sqrt(t))), 4) +
                #         1.330274429  * Power(1 / (1 + .2316419 * AbsValue(Log(close / (CenterStrike + (StrikeSpacing * index))) + ((r + (Sqr(IV) / 2)) * t)) / (IV * Sqrt(t))), 5)))
            else value + 0
    ;
    plot TotalNopeValue = total;
}
def TotalCallNope = TotalNope(StrikeDepth, OpexCode, CenterStrike, StrikeSpacing, yes, DTE, IV, r, t, y);
def TotalPutNope = TotalNope(StrikeDepth, OpexCode, CenterStrike, StrikeSpacing, no, DTE, IV, r, t, y);
# NOPE
plot NOPE = (TotalCallNope + TotalPutNope)/volume();
NOPE.SetHiding(DataType != DataType.NetOptionPricingEffect);
NOPE.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
NOPE.SetDefaultColor(GlobalColor("NOPE"));
AddLabel(ShowLabels and DataType == DataType.NetOptionPricingEffect, "NOPE: " + AbsValue(NOPE), GlobalColor("Nope"));

 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
294 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

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

Frequently Asked Questions

What is useThinkScript?

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

How do I get started?

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

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

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