Options Premium Flow Indicator For ThinkOrSwim

Hi guys,

Just giving back to what I have learnt from this great forum UTS. As below is the code but as usual don't use it in isolation. Based on my past experience great to pair with S/L or gaps.

Let me explain abit the logic of this codes. If anyone of you are doing options trading then you might have a head start. Or you can study the code and figure the logic and foundation behind this indicator. The formula I am using is based on the difference on the 25 above and below Strike Price I have back tested this based on the 5 min TF using on 0DTE - you will need to adjust to the expiration date.

Option Premium FlowI have input the video link - hope that it explains well enough! Cheers

So the difference is above $1m either for Call or Put options. For example, if we have a signal of $1m call option difference now. We are expecting traders/institutional are closing the trades. Therefore, we might be seeing a reversal soon.

I m trying to post more examples soon. Btw, I m no longer using TOS as they have regulated limited to only accredited account in Singapore
https://www.schwab.com.sg/retail-client

Enjoys and all the best!
Code:
### Option Premium_Put&Call
declare lower;
input optionSeriesPrefix = ".QQQ230519";
input strike = 322.0;
def strikeSpace1 = 1.0;
def strikeSpace2 = 2.0;
def strikeSpace3 = 3.0;
def strikeSpace4 = 4.0;
def strikeSpace5 = 5.0;
def strikeSpace6 = 6.0;
def strikeSpace7 = 7.0;
def strikeSpace8 = 8.0;
def strikeSpace9 = 9.0;
def strikeSpace10 = 10.0;
def strikeSpace11 = 11.0;
def strikeSpace12 = 12.0;
def strikeSpace13 = 13.0;
def strikeSpace14 = 14.0;
def strikeSpace15 = 15.0;
def strikeSpace16 = 16.0;
def strikeSpace17 = 17.0;
def strikeSpace18 = 18.0;
def strikeSpace19 = 19.0;
def strikeSpace20 = 20.0;
def strikeSpace21 = 21.0;
def strikeSpace22 = 22.0;
def strikeSpace23 = 23.0;
def strikeSpace24 = 24.0;
def strikeSpace25 = 25.0;
### Put Option Volume
def putOptionVolume =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike)));
def putOptionVolume1 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace1)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace1)));
def putOptionVolume2 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace2)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace2)));
def putOptionVolume3 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace3)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace3)));
def putOptionVolume4 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace4)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace4)));
def putOptionVolume5 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace5)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace5)));
def putOptionVolume6 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace6)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace6)));
def putOptionVolume7 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace7)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace7)));
def putOptionVolume8 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace8)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace8)));
def putOptionVolume9 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace9)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace9)));
def putOptionVolume10 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace10)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace10)));
def putOptionVolume11 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace11)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace11)));
def putOptionVolume12 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace12)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace12)));
def putOptionVolume13 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace13)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace13)));
def putOptionVolume14 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace14)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace1)));
def putOptionVolume15 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace15)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace15)));
def putOptionVolume16 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace16)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace16)));
def putOptionVolume17 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace17)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace17)));
def putOptionVolume18 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace18)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace18)));
def putOptionVolume19 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace19)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace19)));
def putOptionVolume20 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace20)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace20)));
def putOptionVolume21 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace21)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace21)));
def putOptionVolume22 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace22)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace22)));
def putOptionVolume23 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace23)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace23)));
def putOptionVolume24 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace24)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace24)));
def putOptionVolume25 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace25)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace25)));

def putOptionVolume26 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace1)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace1)));
def putOptionVolume27 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace2)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace2)));
def putOptionVolume28 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace3)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace3)));
def putOptionVolume29 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace4)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace4)));
def putOptionVolume30 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace5)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace5)));
def putOptionVolume31 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace6)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace6)));
def putOptionVolume32 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace7)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace7)));
def putOptionVolume33 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace8)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace8)));
def putOptionVolume34 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace9)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace9)));
def putOptionVolume35 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace10)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace10)));
def putOptionVolume36 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace11)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace11)));
def putOptionVolume37 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace12)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace12)));
def putOptionVolume38 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace13)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace13)));
def putOptionVolume39 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace14)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace14)));
def putOptionVolume40 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace15)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace15)));
def putOptionVolume41 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace16)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace16)));
def putOptionVolume42 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace17)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace17)));
def putOptionVolume43 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace18)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace18)));
def putOptionVolume44 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace19)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace19)));
def putOptionVolume45 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace20)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace20)));
def putOptionVolume46 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace21)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace21)));
def putOptionVolume47 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace22)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace22)));
def putOptionVolume48 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace23)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace23)));
def putOptionVolume49 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace24)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace24)));
def putOptionVolume50 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace25)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace25)));

### Call Option Volume
def callOptionVolume =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike)));
def callOptionVolume1 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace1)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace1)));
def callOptionVolume2 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace2)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace2)));
def callOptionVolume3 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace3)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace3)));
def callOptionVolume4 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace4)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace4)));
def callOptionVolume5 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace5)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace5)));
def callOptionVolume6 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace6)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace6)));
def callOptionVolume7 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace7)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace7)));
def callOptionVolume8 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace8)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace8)));
def callOptionVolume9 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace9)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace9)));
def callOptionVolume10 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace10)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace10)));
def callOptionVolume11 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace11)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace11)));
def callOptionVolume12 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace12)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace12)));
def callOptionVolume13 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace13)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace13)));
def callOptionVolume14 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace14)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace1)));
def callOptionVolume15 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace15)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace15)));
def callOptionVolume16 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace16)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace16)));
def callOptionVolume17 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace17)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace17)));
def callOptionVolume18 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace18)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace18)));
def callOptionVolume19 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace19)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace19)));
def callOptionVolume20 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace20)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace20)));
def callOptionVolume21 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace21)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace21)));
def callOptionVolume22 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace22)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace22)));
def callOptionVolume23 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace23)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace23)));
def callOptionVolume24 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace24)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace24)));
def callOptionVolume25 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace25)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace25)));

def callOptionVolume26 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace1)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace1)));
def callOptionVolume27 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace2)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace2)));
def callOptionVolume28 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace3)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace3)));
def callOptionVolume29 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace4)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace4)));
def callOptionVolume30 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace5)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace5)));
def callOptionVolume31 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace6)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace6)));
def callOptionVolume32 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace7)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace7)));
def callOptionVolume33 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace8)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace8)));
def callOptionVolume34 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace9)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace9)));
def callOptionVolume35 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace10)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace10)));
def callOptionVolume36 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace11)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace11)));
def callOptionVolume37 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace12)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace12)));
def callOptionVolume38 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace13)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace13)));
def callOptionVolume39 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace14)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace14)));
def callOptionVolume40 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace15)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace15)));
def callOptionVolume41 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace16)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace16)));
def callOptionVolume42 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace17)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace17)));
def callOptionVolume43 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace18)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace18)));
def callOptionVolume44 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace19)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace19)));
def callOptionVolume45 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace20)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace20)));
def callOptionVolume46 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace21)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace21)));
def callOptionVolume47 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace22)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace22)));
def callOptionVolume48 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace23)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace23)));
def callOptionVolume49 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace24)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace24)));
def callOptionVolume50 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace25)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace25)));

### Put Option Premium
def putOptionPremium =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike)));
def putOptionPremium1 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace1)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace1)));
def putOptionPremium2 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace2)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace2)));
def putOptionPremium3 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace3)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace3)));
def putOptionPremium4 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace4)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace4)));
def putOptionPremium5 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace5)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace5)));
def putOptionPremium6 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace6)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace6)));
def putOptionPremium7 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace7)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace7)));
def putOptionPremium8 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace8)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace8)));
def putOptionPremium9 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace9)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace9)));
def putOptionPremium10 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace10)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace10)));
def putOptionPremium11 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace11)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace11)));
def putOptionPremium12 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace12)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace12)));
def putOptionPremium13 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace13)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace13)));
def putOptionPremium14 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace14)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace1)));
def putOptionPremium15 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace15)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace15)));
def putOptionPremium16 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace16)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace16)));
def putOptionPremium17 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace17)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace17)));
def putOptionPremium18 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace18)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace18)));
def putOptionPremium19 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace19)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace19)));
def putOptionPremium20 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace20)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace20)));
def putOptionPremium21 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace21)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace21)));
def putOptionPremium22 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace22)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace22)));
def putOptionPremium23 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace23)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace23)));
def putOptionPremium24 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace24)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace24)));
def putOptionPremium25 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace25)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike-strikeSpace25)));

def putOptionPremium26 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace1)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace1)));
def putOptionPremium27 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace2)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace2)));
def putOptionPremium28 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace3)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace3)));
def putOptionPremium29 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace4)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace4)));
def putOptionPremium30 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace5)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace5)));
def putOptionPremium31 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace6)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace6)));
def putOptionPremium32 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace7)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace7)));
def putOptionPremium33 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace8)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace8)));
def putOptionPremium34 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace9)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace9)));
def putOptionPremium35 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace10)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace10)));
def putOptionPremium36 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace11)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace11)));
def putOptionPremium37 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace12)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace12)));
def putOptionPremium38 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace13)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace13)));
def putOptionPremium39 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace14)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace14)));
def putOptionPremium40 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace15)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace15)));
def putOptionPremium41 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace16)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace16)));
def putOptionPremium42 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace17)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace17)));
def putOptionPremium43 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace18)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace18)));
def putOptionPremium44 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace19)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace19)));
def putOptionPremium45 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace20)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace20)));
def putOptionPremium46 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace21)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace21)));
def putOptionPremium47 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace22)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace22)));
def putOptionPremium48 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace23)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace23)));
def putOptionPremium49 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace24)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace24)));
def putOptionPremium50 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace25)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike+strikeSpace25)));

### Call Option Premium
def callOptionPremium =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike)));
def callOptionPremium1 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace1)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace1)));
def callOptionPremium2 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace2)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace2)));
def callOptionPremium3 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace3)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace3)));
def callOptionPremium4 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace4)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace4)));
def callOptionPremium5 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace5)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace5)));
def callOptionPremium6 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace6)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace6)));
def callOptionPremium7 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace7)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace7)));
def callOptionPremium8 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace8)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace8)));
def callOptionPremium9 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace9)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace9)));
def callOptionPremium10 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace10)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace10)));
def callOptionPremium11 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace11)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace11)));
def callOptionPremium12 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace12)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace12)));
def callOptionPremium13 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace13)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace13)));
def callOptionPremium14 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace14)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace1)));
def callOptionPremium15 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace15)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace15)));
def callOptionPremium16 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace16)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace16)));
def callOptionPremium17 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace17)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace17)));
def callOptionPremium18 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace18)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace18)));
def callOptionPremium19 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace19)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace19)));
def callOptionPremium20 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace20)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace20)));
def callOptionPremium21 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace21)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace21)));
def callOptionPremium22 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace22)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace22)));
def callOptionPremium23 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace23)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace23)));
def callOptionPremium24 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace24)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace24)));
def callOptionPremium25 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace25)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike-strikeSpace25)));

def callOptionPremium26 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace1)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace1)));
def callOptionPremium27 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace2)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace2)));
def callOptionPremium28 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace3)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace3)));
def callOptionPremium29 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace4)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace4)));
def callOptionPremium30 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace5)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace5)));
def callOptionPremium31 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace6)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace6)));
def callOptionPremium32 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace7)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace7)));
def callOptionPremium33 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace8)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace8)));
def callOptionPremium34 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace9)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace9)));
def callOptionPremium35 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace10)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace10)));
def callOptionPremium36 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace11)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace11)));
def callOptionPremium37 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace12)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace12)));
def callOptionPremium38 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace13)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace13)));
def callOptionPremium39 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace14)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace14)));
def callOptionPremium40 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace15)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace15)));
def callOptionPremium41 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace16)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace16)));
def callOptionPremium42 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace17)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace17)));
def callOptionPremium43 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace18)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace18)));
def callOptionPremium44 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace19)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace19)));
def callOptionPremium45 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace20)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace20)));
def callOptionPremium46 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace21)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace21)));
def callOptionPremium47 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace22)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace22)));
def callOptionPremium48 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace23)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace23)));
def callOptionPremium49 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace24)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace24)));
def callOptionPremium50 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace25)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike+strikeSpace25)));

### Total Put Premium
def totalPutPremium = (putOptionVolume*putOptionPremium)+(putOptionVolume1*putOptionPremium1)
+(putOptionVolume2*putOptionPremium2)+(putOptionVolume3*putOptionPremium3)+(putOptionVolume4*putOptionPremium4)
+(putOptionVolume5*putOptionPremium5)+(putOptionVolume6*putOptionPremium6)+(putOptionVolume7*putOptionPremium7)
+(putOptionVolume8*putOptionPremium8)+(putOptionVolume9*putOptionPremium9)+(putOptionVolume10*putOptionPremium10)
+(putOptionVolume11*putOptionPremium11)+(putOptionVolume12*putOptionPremium12)+(putOptionVolume13*putOptionPremium13)
+(putOptionVolume14*putOptionPremium14)+(putOptionVolume15*putOptionPremium15)+(putOptionVolume16*putOptionPremium16)
+(putOptionVolume17*putOptionPremium17)+(putOptionVolume18*putOptionPremium18)+(putOptionVolume19*putOptionPremium19)
+(putOptionVolume20*putOptionPremium20)+(putOptionVolume21*putOptionPremium21)+(putOptionVolume22*putOptionPremium22)
+(putOptionVolume23*putOptionPremium23)+(putOptionVolume24*putOptionPremium24)+(putOptionVolume25*putOptionPremium25)
+(putOptionVolume26*putOptionPremium26)+(putOptionVolume27*putOptionPremium27)+(putOptionVolume28*putOptionPremium28)
+(putOptionVolume29*putOptionPremium29)+(putOptionVolume30*putOptionPremium30)+(putOptionVolume31*putOptionPremium31)
+(putOptionVolume32*putOptionPremium32)+(putOptionVolume33*putOptionPremium33)+(putOptionVolume34*putOptionPremium34)
+(putOptionVolume35*putOptionPremium35)+(putOptionVolume36*putOptionPremium36)+(putOptionVolume37*putOptionPremium37)
+(putOptionVolume38*putOptionPremium38)+(putOptionVolume39*putOptionPremium39)+(putOptionVolume40*putOptionPremium40)
+(putOptionVolume41*putOptionPremium41)+(putOptionVolume42*putOptionPremium42)+(putOptionVolume43*putOptionPremium43)
+(putOptionVolume44*putOptionPremium44)+(putOptionVolume45*putOptionPremium45)+(putOptionVolume46*putOptionPremium46)
+(putOptionVolume47*putOptionPremium47)+(putOptionVolume48*putOptionPremium48)+(putOptionVolume49*putOptionPremium49)
+(putOptionVolume50*putOptionPremium50) ;


### Total Put Premium
def totalCallPremium = (callOptionVolume*callOptionPremium)+(callOptionVolume1*callOptionPremium1) +(callOptionVolume2*callOptionPremium2)+(callOptionVolume3*callOptionPremium3)+(callOptionVolume4*callOptionPremium4)
+(callOptionVolume5*callOptionPremium5)+(callOptionVolume6*callOptionPremium6)+(callOptionVolume7*callOptionPremium7)
+(callOptionVolume8*callOptionPremium8)+(callOptionVolume9*callOptionPremium9)+(callOptionVolume10*callOptionPremium10)
+(callOptionVolume11*callOptionPremium11)+(callOptionVolume12*callOptionPremium12)+(callOptionVolume13*callOptionPremium13)
+(callOptionVolume14*callOptionPremium14)+(callOptionVolume15*callOptionPremium15)+(callOptionVolume16*callOptionPremium16)
+(callOptionVolume17*callOptionPremium17)+(callOptionVolume18*callOptionPremium18)+(callOptionVolume19*callOptionPremium19)
+(callOptionVolume20*callOptionPremium20)+(callOptionVolume21*callOptionPremium21)+(callOptionVolume22*callOptionPremium22)
+(callOptionVolume23*callOptionPremium23)+(callOptionVolume24*callOptionPremium24)+(callOptionVolume25*callOptionPremium25)
+(callOptionVolume26*callOptionPremium26)+(callOptionVolume27*callOptionPremium27)+(callOptionVolume28*callOptionPremium28)
+(callOptionVolume29*callOptionPremium29)+(callOptionVolume30*callOptionPremium30)+(callOptionVolume31*callOptionPremium31)
+(callOptionVolume32*callOptionPremium32)+(callOptionVolume33*callOptionPremium33)+(callOptionVolume34*callOptionPremium34)
+(callOptionVolume35*callOptionPremium35)+(callOptionVolume36*callOptionPremium36)+(callOptionVolume37*callOptionPremium37)
+(callOptionVolume38*callOptionPremium38)+(callOptionVolume39*callOptionPremium39)+(callOptionVolume40*callOptionPremium40)
+(callOptionVolume41*callOptionPremium41)+(callOptionVolume42*callOptionPremium42)+(callOptionVolume43*callOptionPremium43)
+(callOptionVolume44*callOptionPremium44)+(callOptionVolume45*callOptionPremium45)+(callOptionVolume46*callOptionPremium46)
+(callOptionVolume47*callOptionPremium47)+(callOptionVolume48*callOptionPremium48)+(callOptionVolume49*callOptionPremium49)
+(callOptionVolume50*callOptionPremium50) ;

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

#AddLabel(yes, "DTE:" + optionSeriesPrefix, Color.gray);
#AddLabel(yes, "Strike:" + strike, Color.gray);
#AddLabel(yes, ("Put Premium: $" + round(totalputPremium,0)  ), Color.light_orange);
#AddLabel(yes, ("Call Premium: $" + round(totalCallPremium,0)  ), Color.light_green);

#plot PC_ratio = -totalputPremium + totalCallPremium;
#PC_ratio.setPaintingStrategy(PaintingStrategy.Histogram);
#PC_ratio.AssignValueColor(if PC_ratio < 0 then color.pink else color.cyan);

#def PCRatio = round(totalputPremium/ totalCallPremium,2);

#AddLabel(yes, ("PC Diff: " + PC_ratio ), color.white);
#AddLabel(yes, ("PC ratio: " + PCRatio),  color.gray);

plot TPOP = -totalPutPremium;
TPOP.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
TPOP.SetDefaultColor(Color.light_orange);
TPOP.SetLineWeight(3);
TPOP.HideTitle();
TPOP.HideBubble();
AddLabel(yes, "DTE:" + optionSeriesPrefix, Color.gray);
AddLabel(yes, "Strike:" + strike, Color.gray);
AddLabel(yes, ("Put Premium:$ " + round(TPOP,0) ), Color.light_orange);

plot TCOP = totalCallPremium;
TCOP.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
TCOP.SetDefaultColor(Color.light_green);
TCOP.SetLineWeight(3);
TCOP.HideTitle();
TCOP.HideBubble();

AddLabel(yes, ("Call Premium:$ " + round(TCOP,0) ), Color.light_green);

def PC_ratio = round(-totalPutPremium + totalCallPremium,0);
AddLabel(yes, ("Prem Diff: " + PC_ratio ), color.white);

AddLabel(yes, ("Prem ratio: " + round(totalputPremium/totalCallPremium,2) ), color.gray);
 
Last edited by a moderator:
hi, I did not understand "Btw, I m no longer using TOS as they have regulated limited to only accredited account". Could you please explain what is this restriction you mention? Thanks
 
hi, I did not understand "Btw, I m no longer using TOS as they have regulated limited to only accredited account". Could you please explain what is this restriction you mention? Thanks
Hi bro, I m not using ThinkorSwim platform. I have migrated to other platform. No restriction to US users. Cheers
 
Hi guys,

Sharing the upper chart code so that it creates a signal and draw a line whenever there is a signal. You can play around the numbers for the signal for example I am using $1m for the dots and $2m for the line. Remember the more you study the codes the better you can build/create what you want. All the best!

Option Premium Flow Here the video link. Hope its has explained clearly!

Code:
input optionSeriesPrefix = ".QQQ230717";
def strike = Floor(close);
#def strike = 363;
def strikeSpace1 = 1.0;
def strikeSpace2 = 2.0;
def strikeSpace3 = 3.0;
def strikeSpace4 = 4.0;
def strikeSpace5 = 5.0;
def strikeSpace6 = 6.0;
def strikeSpace7 = 7.0;
def strikeSpace8 = 8.0;
def strikeSpace9 = 9.0;
def strikeSpace10 = 10.0;
def strikeSpace11 = 11.0;
def strikeSpace12 = 12.0;
def strikeSpace13 = 13.0;
def strikeSpace14 = 14.0;
def strikeSpace15 = 15.0;
def strikeSpace16 = 16.0;
def strikeSpace17 = 17.0;
def strikeSpace18 = 18.0;
def strikeSpace19 = 19.0;
def strikeSpace20 = 20.0;
def strikeSpace21 = 21.0;
def strikeSpace22 = 22.0;
def strikeSpace23 = 23.0;
def strikeSpace24 = 24.0;
def strikeSpace25 = 25.0;
### Put Option Volume
def putOptionVolume =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike)));
def putOptionVolume1 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace1)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace1)));
def putOptionVolume2 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace2)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace2)));
def putOptionVolume3 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace3)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace3)));
def putOptionVolume4 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace4)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace4)));
def putOptionVolume5 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace5)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace5)));
def putOptionVolume6 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace6)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace6)));
def putOptionVolume7 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace7)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace7)));
def putOptionVolume8 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace8)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace8)));
def putOptionVolume9 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace9)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace9)));
def putOptionVolume10 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace10)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace10)));
def putOptionVolume11 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace11)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace11)));
def putOptionVolume12 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace12)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace12)));
def putOptionVolume13 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace13)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace13)));
def putOptionVolume14 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace14)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace1)));
def putOptionVolume15 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace15)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace15)));
def putOptionVolume16 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace16)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace16)));
def putOptionVolume17 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace17)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace17)));
def putOptionVolume18 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace18)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace18)));
def putOptionVolume19 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace19)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace19)));
def putOptionVolume20 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace20)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace20)));
def putOptionVolume21 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace21)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace21)));
def putOptionVolume22 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace22)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace22)));
def putOptionVolume23 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace23)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace23)));
def putOptionVolume24 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace24)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace24)));
def putOptionVolume25 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace25)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace25)));

def putOptionVolume26 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace1)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace1)));
def putOptionVolume27 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace2)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace2)));
def putOptionVolume28 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace3)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace3)));
def putOptionVolume29 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace4)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace4)));
def putOptionVolume30 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace5)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace5)));
def putOptionVolume31 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace6)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace6)));
def putOptionVolume32 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace7)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace7)));
def putOptionVolume33 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace8)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace8)));
def putOptionVolume34 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace9)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace9)));
def putOptionVolume35 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace10)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace10)));
def putOptionVolume36 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace11)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace11)));
def putOptionVolume37 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace12)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace12)));
def putOptionVolume38 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace13)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace13)));
def putOptionVolume39 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace14)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace14)));
def putOptionVolume40 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace15)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace15)));
def putOptionVolume41 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace16)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace16)));
def putOptionVolume42 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace17)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace17)));
def putOptionVolume43 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace18)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace18)));
def putOptionVolume44 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace19)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace19)));
def putOptionVolume45 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace20)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace20)));
def putOptionVolume46 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace21)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace21)));
def putOptionVolume47 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace22)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace22)));
def putOptionVolume48 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace23)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace23)));
def putOptionVolume49 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace24)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace24)));
def putOptionVolume50 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace25)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace25)));

### Call Option Volume
def callOptionVolume =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike)));
def callOptionVolume1 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace1)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace1)));
def callOptionVolume2 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace2)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace2)));
def callOptionVolume3 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace3)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace3)));
def callOptionVolume4 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace4)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace4)));
def callOptionVolume5 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace5)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace5)));
def callOptionVolume6 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace6)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace6)));
def callOptionVolume7 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace7)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace7)));
def callOptionVolume8 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace8)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace8)));
def callOptionVolume9 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace9)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace9)));
def callOptionVolume10 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace10)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace10)));
def callOptionVolume11 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace11)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace11)));
def callOptionVolume12 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace12)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace12)));
def callOptionVolume13 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace13)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace13)));
def callOptionVolume14 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace14)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace1)));
def callOptionVolume15 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace15)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace15)));
def callOptionVolume16 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace16)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace16)));
def callOptionVolume17 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace17)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace17)));
def callOptionVolume18 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace18)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace18)));
def callOptionVolume19 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace19)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace19)));
def callOptionVolume20 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace20)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace20)));
def callOptionVolume21 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace21)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace21)));
def callOptionVolume22 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace22)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace22)));
def callOptionVolume23 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace23)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace23)));
def callOptionVolume24 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace24)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace24)));
def callOptionVolume25 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace25)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace25)));

def callOptionVolume26 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace1)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace1)));
def callOptionVolume27 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace2)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace2)));
def callOptionVolume28 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace3)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace3)));
def callOptionVolume29 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace4)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace4)));
def callOptionVolume30 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace5)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace5)));
def callOptionVolume31 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace6)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace6)));
def callOptionVolume32 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace7)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace7)));
def callOptionVolume33 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace8)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace8)));
def callOptionVolume34 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace9)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace9)));
def callOptionVolume35 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace10)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace10)));
def callOptionVolume36 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace11)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace11)));
def callOptionVolume37 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace12)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace12)));
def callOptionVolume38 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace13)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace13)));
def callOptionVolume39 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace14)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace14)));
def callOptionVolume40 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace15)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace15)));
def callOptionVolume41 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace16)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace16)));
def callOptionVolume42 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace17)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace17)));
def callOptionVolume43 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace18)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace18)));
def callOptionVolume44 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace19)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace19)));
def callOptionVolume45 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace20)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace20)));
def callOptionVolume46 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace21)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace21)));
def callOptionVolume47 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace22)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace22)));
def callOptionVolume48 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace23)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace23)));
def callOptionVolume49 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace24)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace24)));
def callOptionVolume50 =  if IsNaN(volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace25)))) then 0 else volume(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace25)));

### Put Option Premium
def putOptionPremium =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike)));
def putOptionPremium1 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace1)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace1)));
def putOptionPremium2 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace2)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace2)));
def putOptionPremium3 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace3)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace3)));
def putOptionPremium4 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace4)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace4)));
def putOptionPremium5 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace5)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace5)));
def putOptionPremium6 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace6)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace6)));
def putOptionPremium7 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace7)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace7)));
def putOptionPremium8 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace8)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace8)));
def putOptionPremium9 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace9)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace9)));
def putOptionPremium10 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace10)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace10)));
def putOptionPremium11 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace11)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace11)));
def putOptionPremium12 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace12)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace12)));
def putOptionPremium13 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace13)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace13)));
def putOptionPremium14 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace14)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace1)));
def putOptionPremium15 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace15)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace15)));
def putOptionPremium16 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace16)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace16)));
def putOptionPremium17 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace17)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace17)));
def putOptionPremium18 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace18)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace18)));
def putOptionPremium19 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace19)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace19)));
def putOptionPremium20 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace20)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace20)));
def putOptionPremium21 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace21)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace21)));
def putOptionPremium22 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace22)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace22)));
def putOptionPremium23 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace23)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace23)));
def putOptionPremium24 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace24)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace24)));
def putOptionPremium25 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace25)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike - strikeSpace25)));

def putOptionPremium26 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace1)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace1)));
def putOptionPremium27 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace2)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace2)));
def putOptionPremium28 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace3)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace3)));
def putOptionPremium29 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace4)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace4)));
def putOptionPremium30 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace5)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace5)));
def putOptionPremium31 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace6)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace6)));
def putOptionPremium32 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace7)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace7)));
def putOptionPremium33 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace8)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace8)));
def putOptionPremium34 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace9)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace9)));
def putOptionPremium35 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace10)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace10)));
def putOptionPremium36 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace11)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace11)));
def putOptionPremium37 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace12)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace12)));
def putOptionPremium38 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace13)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace13)));
def putOptionPremium39 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace14)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace14)));
def putOptionPremium40 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace15)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace15)));
def putOptionPremium41 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace16)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace16)));
def putOptionPremium42 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace17)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace17)));
def putOptionPremium43 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace18)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace18)));
def putOptionPremium44 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace19)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace19)));
def putOptionPremium45 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace20)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace20)));
def putOptionPremium46 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace21)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace21)));
def putOptionPremium47 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace22)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace22)));
def putOptionPremium48 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace23)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace23)));
def putOptionPremium49 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace24)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace24)));
def putOptionPremium50 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace25)))) then 0 else close(Concat(optionSeriesPrefix, Concat("P", strike + strikeSpace25)));

### Call Option Premium
def callOptionPremium =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike)));
def callOptionPremium1 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace1)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace1)));
def callOptionPremium2 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace2)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace2)));
def callOptionPremium3 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace3)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace3)));
def callOptionPremium4 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace4)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace4)));
def callOptionPremium5 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace5)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace5)));
def callOptionPremium6 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace6)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace6)));
def callOptionPremium7 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace7)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace7)));
def callOptionPremium8 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace8)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace8)));
def callOptionPremium9 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace9)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace9)));
def callOptionPremium10 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace10)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace10)));
def callOptionPremium11 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace11)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace11)));
def callOptionPremium12 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace12)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace12)));
def callOptionPremium13 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace13)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace13)));
def callOptionPremium14 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace14)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace1)));
def callOptionPremium15 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace15)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace15)));
def callOptionPremium16 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace16)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace16)));
def callOptionPremium17 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace17)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace17)));
def callOptionPremium18 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace18)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace18)));
def callOptionPremium19 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace19)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace19)));
def callOptionPremium20 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace20)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace20)));
def callOptionPremium21 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace21)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace21)));
def callOptionPremium22 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace22)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace22)));
def callOptionPremium23 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace23)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace23)));
def callOptionPremium24 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace24)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace24)));
def callOptionPremium25 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace25)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike - strikeSpace25)));

def callOptionPremium26 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace1)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace1)));
def callOptionPremium27 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace2)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace2)));
def callOptionPremium28 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace3)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace3)));
def callOptionPremium29 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace4)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace4)));
def callOptionPremium30 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace5)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace5)));
def callOptionPremium31 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace6)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace6)));
def callOptionPremium32 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace7)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace7)));
def callOptionPremium33 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace8)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace8)));
def callOptionPremium34 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace9)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace9)));
def callOptionPremium35 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace10)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace10)));
def callOptionPremium36 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace11)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace11)));
def callOptionPremium37 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace12)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace12)));
def callOptionPremium38 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace13)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace13)));
def callOptionPremium39 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace14)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace14)));
def callOptionPremium40 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace15)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace15)));
def callOptionPremium41 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace16)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace16)));
def callOptionPremium42 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace17)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace17)));
def callOptionPremium43 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace18)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace18)));
def callOptionPremium44 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace19)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace19)));
def callOptionPremium45 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace20)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace20)));
def callOptionPremium46 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace21)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace21)));
def callOptionPremium47 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace22)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace22)));
def callOptionPremium48 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace23)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace23)));
def callOptionPremium49 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace24)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace24)));
def callOptionPremium50 =  if IsNaN(close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace25)))) then 0 else close(Concat(optionSeriesPrefix, Concat("C", strike + strikeSpace25)));

### Total Put Premium
def totalPutPremium = (putOptionVolume * putOptionPremium) + (putOptionVolume1 * putOptionPremium1)
+ (putOptionVolume2 * putOptionPremium2) + (putOptionVolume3 * putOptionPremium3) + (putOptionVolume4 * putOptionPremium4)
+ (putOptionVolume5 * putOptionPremium5) + (putOptionVolume6 * putOptionPremium6) + (putOptionVolume7 * putOptionPremium7)
+ (putOptionVolume8 * putOptionPremium8) + (putOptionVolume9 * putOptionPremium9) + (putOptionVolume10 * putOptionPremium10)
+ (putOptionVolume11 * putOptionPremium11) + (putOptionVolume12 * putOptionPremium12) + (putOptionVolume13 * putOptionPremium13)
+ (putOptionVolume14 * putOptionPremium14) + (putOptionVolume15 * putOptionPremium15) + (putOptionVolume16 * putOptionPremium16)
+ (putOptionVolume17 * putOptionPremium17) + (putOptionVolume18 * putOptionPremium18) + (putOptionVolume19 * putOptionPremium19)
+ (putOptionVolume20 * putOptionPremium20) + (putOptionVolume21 * putOptionPremium21) + (putOptionVolume22 * putOptionPremium22)
+ (putOptionVolume23 * putOptionPremium23) + (putOptionVolume24 * putOptionPremium24) + (putOptionVolume25 * putOptionPremium25)
+ (putOptionVolume26 * putOptionPremium26) + (putOptionVolume27 * putOptionPremium27) + (putOptionVolume28 * putOptionPremium28)
+ (putOptionVolume29 * putOptionPremium29) + (putOptionVolume30 * putOptionPremium30) + (putOptionVolume31 * putOptionPremium31)
+ (putOptionVolume32 * putOptionPremium32) + (putOptionVolume33 * putOptionPremium33) + (putOptionVolume34 * putOptionPremium34)
+ (putOptionVolume35 * putOptionPremium35) + (putOptionVolume36 * putOptionPremium36) + (putOptionVolume37 * putOptionPremium37)
+ (putOptionVolume38 * putOptionPremium38) + (putOptionVolume39 * putOptionPremium39) + (putOptionVolume40 * putOptionPremium40)
+ (putOptionVolume41 * putOptionPremium41) + (putOptionVolume42 * putOptionPremium42) + (putOptionVolume43 * putOptionPremium43)
+ (putOptionVolume44 * putOptionPremium44) + (putOptionVolume45 * putOptionPremium45) + (putOptionVolume46 * putOptionPremium46)
+ (putOptionVolume47 * putOptionPremium47) + (putOptionVolume48 * putOptionPremium48) + (putOptionVolume49 * putOptionPremium49)
+ (putOptionVolume50 * putOptionPremium50) ;


### Total Put Premium
def totalCallPremium = (callOptionVolume * callOptionPremium) + (callOptionVolume1 * callOptionPremium1) + (callOptionVolume2 * callOptionPremium2) + (callOptionVolume3 * callOptionPremium3) + (callOptionVolume4 * callOptionPremium4)
+ (callOptionVolume5 * callOptionPremium5) + (callOptionVolume6 * callOptionPremium6) + (callOptionVolume7 * callOptionPremium7)
+ (callOptionVolume8 * callOptionPremium8) + (callOptionVolume9 * callOptionPremium9) + (callOptionVolume10 * callOptionPremium10)
+ (callOptionVolume11 * callOptionPremium11) + (callOptionVolume12 * callOptionPremium12) + (callOptionVolume13 * callOptionPremium13)
+ (callOptionVolume14 * callOptionPremium14) + (callOptionVolume15 * callOptionPremium15) + (callOptionVolume16 * callOptionPremium16)
+ (callOptionVolume17 * callOptionPremium17) + (callOptionVolume18 * callOptionPremium18) + (callOptionVolume19 * callOptionPremium19)
+ (callOptionVolume20 * callOptionPremium20) + (callOptionVolume21 * callOptionPremium21) + (callOptionVolume22 * callOptionPremium22)
+ (callOptionVolume23 * callOptionPremium23) + (callOptionVolume24 * callOptionPremium24) + (callOptionVolume25 * callOptionPremium25)
+ (callOptionVolume26 * callOptionPremium26) + (callOptionVolume27 * callOptionPremium27) + (callOptionVolume28 * callOptionPremium28)
+ (callOptionVolume29 * callOptionPremium29) + (callOptionVolume30 * callOptionPremium30) + (callOptionVolume31 * callOptionPremium31)
+ (callOptionVolume32 * callOptionPremium32) + (callOptionVolume33 * callOptionPremium33) + (callOptionVolume34 * callOptionPremium34)
+ (callOptionVolume35 * callOptionPremium35) + (callOptionVolume36 * callOptionPremium36) + (callOptionVolume37 * callOptionPremium37)
+ (callOptionVolume38 * callOptionPremium38) + (callOptionVolume39 * callOptionPremium39) + (callOptionVolume40 * callOptionPremium40)
+ (callOptionVolume41 * callOptionPremium41) + (callOptionVolume42 * callOptionPremium42) + (callOptionVolume43 * callOptionPremium43)
+ (callOptionVolume44 * callOptionPremium44) + (callOptionVolume45 * callOptionPremium45) + (callOptionVolume46 * callOptionPremium46)
+ (callOptionVolume47 * callOptionPremium47) + (callOptionVolume48 * callOptionPremium48) + (callOptionVolume49 * callOptionPremium49)
+ (callOptionVolume50 * callOptionPremium50) ;

AddLabel(yes, "DTE:" + optionSeriesPrefix, Color.CYAN);
AddLabel(yes, "Strike:" + strike, Color.GRAY);
AddLabel(yes, ("Put Premium: -$" + Round(totalPutPremium*100, 0)  ), Color.LIGHT_ORANGE);
AddLabel(yes, ("Call Premium: $" + Round(totalCallPremium*100, 0)  ), Color.LIGHT_GREEN);

def offset = sqrt ((high - low)) * 0.2;
def Prem_diff = Round(-totalPutPremium + totalCallPremium, 0)*100;
def greenCandle = close > open;
def redCandle = open > close;
plot sellArrow = if Prem_diff > 1000000 then high + offset else Double.NaN;
sellArrow.setpaintingstrategy(paintingstrategy.points);
sellArrow.setdefaultcolor(color.white);
sellArrow.setlineweight(1);
sellArrow.hidebubble();
sellArrow.hidetitle();
plot sellArrow2 = if Prem_diff > 1000000 and redCandle then high + offset*5 else Double.NaN;
sellArrow2.setpaintingstrategy(paintingstrategy.points);
sellArrow2.setdefaultcolor(color.cyan);
sellArrow2.setlineweight(1);
sellArrow2.hidebubble();
sellArrow2.hidetitle();
def sellCall = if Prem_diff > 2000000 then high else double.nan;
def sellCallExt = if isnan(sellCall) then sellCallExt[1] else sellCall;
plot sell_call  = if !isnan(sellCall) then double.nan else sellCallExt;
sell_call.setdefaultcolor(color.pink);
sell_call.setlineweight(1);

plot sellArrow1 = if Prem_diff > 2000000 then high + offset*3 else Double.NaN;
sellArrow1.setpaintingstrategy(paintingstrategy.points);
sellArrow1.setdefaultcolor(color.pink);
sellArrow1.setlineweight(1);

plot buyArrow = if Prem_diff < -1000000 then low - offset else Double.NaN;
buyArrow.setpaintingstrategy(paintingstrategy.points);
buyArrow.setdefaultcolor(color.white);
buyArrow.setlineweight(1);
plot buyArrow2 = if Prem_diff < -1000000 and greencandle then low - offset*5 else Double.NaN;
buyArrow2.setpaintingstrategy(paintingstrategy.points);
buyArrow2.setdefaultcolor(color.cyan);
buyArrow2.setlineweight(1);
def sellPut = if Prem_diff < -2000000 then low else double.nan;
def sellPutExt = if isnan(sellPut) then sellPutExt[1] else sellPut;
plot sell_Put  = if !isnan(sellPut) then double.nan else sellPutExt;
sell_put.setdefaultcolor(color.light_green);
sell_put.setlineweight(1);
plot buyArrow1 = if Prem_diff < -2000000 then low - offset*3 else Double.NaN;
buyArrow1.setpaintingstrategy(paintingstrategy.points);
buyArrow1.setdefaultcolor(color.green);
buyArrow1.setlineweight(1);

def PCRatio = Round(totalPutPremium / totalCallPremium, 2);

AddLabel(yes, ("Prem Diff: $" + Prem_diff ), Color.WHITE);
AddLabel(yes, ("Prem ratio: " + PCRatio),  Color.GRAY);

def SigUp = Prem_diff < -1000000;
def SigDn = Prem_diff > 1000000;
Alert(SigDn, "Buy Put", Alert.BAR, Sound.Chimes);
Alert(SigUp, "Buy Call", Alert.BAR, Sound.Bell);

#def totalPutOptionVolume = putOptionVolume + putOptionVolume1 + putOptionVolume2 + putOptionVolume3 + putOptionVolume4 + putOptionVolume5 + putOptionVolume6 + putOptionVolume7 + putOptionVolume8 + putOptionVolume9 + putOptionVolume10 + putOptionVolume11 + putOptionVolume12 + putOptionVolume13 + putOptionVolume14 + putOptionVolume15 + putOptionVolume16 + putOptionVolume17 + putOptionVolume18 + putOptionVolume19 + putOptionVolume20 + putOptionVolume21 + putOptionVolume22 + putOptionVolume23 + putOptionVolume24 + putOptionVolume25 + putOptionVolume26 + putOptionVolume27 + putOptionVolume28 + putOptionVolume29 + putOptionVolume30 + putOptionVolume31 + putOptionVolume32 + putOptionVolume33 + putOptionVolume34 + putOptionVolume35 + putOptionVolume36 + putOptionVolume37 + putOptionVolume38 + putOptionVolume39 + putOptionVolume40 + putOptionVolume41 + putOptionVolume42 + putOptionVolume43 + putOptionVolume44 + putOptionVolume45 + putOptionVolume46 + putOptionVolume47 + putOptionVolume48 + putOptionVolume49 + putOptionVolume50;

#def totalCallOptionVolume = callOptionVolume + callOptionVolume1 + callOptionVolume2 + callOptionVolume3 + callOptionVolume4 + callOptionVolume5 + callOptionVolume6 + callOptionVolume7 + callOptionVolume8 + callOptionVolume9 + callOptionVolume10 + callOptionVolume11 + callOptionVolume12 + callOptionVolume13 + callOptionVolume14 + callOptionVolume15 + callOptionVolume16 + callOptionVolume17 + callOptionVolume18 + callOptionVolume19 + callOptionVolume20 + callOptionVolume21 + callOptionVolume22 + callOptionVolume23 + callOptionVolume24 + callOptionVolume25 + callOptionVolume26 + callOptionVolume27 + callOptionVolume28 + callOptionVolume29 + callOptionVolume30 + callOptionVolume31 + callOptionVolume32 + callOptionVolume33 + callOptionVolume34 + callOptionVolume35 + callOptionVolume36 + callOptionVolume37 + callOptionVolume38 + callOptionVolume39 + callOptionVolume40 + callOptionVolume41 + callOptionVolume42 + callOptionVolume43 + callOptionVolume44 + callOptionVolume45 + callOptionVolume46 + callOptionVolume47 + callOptionVolume48 + callOptionVolume49 + callOptionVolume50;

#input vol = no;
#AddLabel(vol, ("Put Volume: -" + Round(totalPutOptionVolume, 0)  ), Color.MAGENTA);
#AddLabel(vol, ("Call Volume: " + Round(totalCallOptionVolume, 0)  ), Color.CYAN);

#def Vol_diff = Round(-totalPutOptionVolume + totalCallOptionVolume, 0);
#def Vol_ratio = Round(totalPutOptionVolume / totalCallOptionVolume, 2);
#AddLabel(vol, ("Vol Diff: " + Vol_diff ), Color.WHITE);
#AddLabel(vol, ("Vol ratio: " + Vol_ratio),  Color.GRAY);

input Daily_IV = 1;
input dailyExpectedPriceMove = 2.255;
def dailyIV = SeriesVolatility(series = Daily_IV);
AddLabel(yes, ("Daily IV: " + aspercent(dailyIV)), Color.white);

def TradePrice = Open(period = aggregationPeriod.DAY);
def upMove = TradePrice + DailyExpectedPriceMove;
def downMove = TradePrice - DailyExpectedPriceMove;
def upMoveExt = if isnan(upMove) then upMoveExt[1] else upMove;
plot up_Move   = if !isnan(upMove) then double.nan else upMoveExt;
up_Move.setdefaultcolor(color.gray);
up_Move.setlineweight(1);

def downMoveExt = if isnan(downMove) then downMoveExt[1] else downMove;
plot down_Move   = if !isnan(downMove) then double.nan else downMoveExt;
down_Move.setdefaultcolor(color.gray);
down_Move.setlineweight(1);
AddLabel(yes, "Daily Expected Price Range = +/-$" + round(DailyExpectedPriceMove,3) , Color.Pink);
AddLabel(yes, "Daily Expected UpMove =  $" + round(upMove,2) , Color.light_green);
AddLabel(yes, "Daily Expected DownMove =  $" + round(downMove,2) , Color.light_orange);
 
Hi guys,

Lastly, you can build the Option Premium Flow Indicator in multiple ways. For instance, the first indicator can use $25 above and below the current strike price and the second indicator can use $5 above and below the current strike price. If there is a great difference between these two indicators. Therefore, it shows that trader/institutions might be buying way in the money. Most of the time, "they" know the market direction however, they need time to be by their side. Hence, the way ITM options.

In addition, Options Premium Flow Indicator sometime acts as a very good S/R line.

Option Premium Flow You can refer to the video to these examples.

As mentioned, the more you understand and study the codes. The more you will use it to your advantage.

All the best and trade safe!
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
264 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