price movement range indicator

esvafromdc

New member
I am attempting to create an hourly upper indicator similar to the "volatility box". I used BenTen's "Average Price Movements" as a guide (I'm not a programmer).

In this case, I am looking back each hour for 60 hourly periods, taking an average of the range and the high of each period and then projecting them. I feel like my calculations are correct but it clearly isn't displaying correctly. What it should do is find the low for the current 60-minute candle and add the average and upper price movement number to project the high. Conversely, it should find the high for the current 60-minute candle, and subtract the average and the upper price movement range for that hour to project the low. If anyone has any insight into this it would be greatly appreciated! Thank you in advance. Sorry I don't see where to insert an image without referencing a website. I have screenshots of this.

Code is as follows:

Code:
# HPMR 60-Period look-back

input aggregationPeriod = AggregationPeriod.HOUR;
def hourhigh = high(period = aggregationPeriod);
def hourlow = low(period = aggregationPeriod);
def houropen = open(period = aggregationPeriod);
def range = (hourhigh - hourlow);

# Median number of the range

def t1 = range[23]/2;
def t2 = range[46]/2;
def t3 = range[69]/2;
def t4 = range[92]/2;
def t5 = range[115]/2;
def t6 = range[138]/2;
def t7 = range[161]/2;
def t8 = range[184]/2;
def t9 = range[207]/2;
def t10 = range[230]/2;
def t11 = range[253]/2;
def t12 = range[276]/2;
def t13 = range[299]/2;
def t14 = range[322]/2;
def t15 = range[345]/2;
def t16 = range[368]/2;
def t17 = range[391]/2;
def t18 = range[414]/2;
def t19 = range[437]/2;
def t20 = range[460]/2;
def t21 = range[483]/2;
def t22 = range[506]/2;
def t23 = range[529]/2;
def t24 = range[552]/2;
def t25 = range[575]/2;
def t26 = range[598]/2;
def t27 = range[621]/2;
def t28 = range[644]/2;
def t29 = range[667]/2;
def t30 = range[690]/2;
def t31 = range[713]/2;
def t32 = range[736]/2;
def t33 = range[759]/2;
def t34 = range[782]/2;
def t35 = range[805]/2;
def t36 = range[828]/2;
def t37 = range[851]/2;
def t38 = range[874]/2;
def t39 = range[897]/2;
def t40 = range[920]/2;
def t41 = range[943]/2;
def t42 = range[966]/2;
def t43 = range[989]/2;
def t44 = range[1002]/2;
def t45 = range[1035]/2;
def t46 = range[1058]/2;
def t47 = range[1081]/2;
def t48 = range[1104]/2;
def t49 = range[1127]/2;
def t50 = range[1150]/2;
def t51 = range[1173]/2;
def t52 = range[1196]/2;
def t53 = range[1219]/2;
def t54 = range[1242]/2;
def t55 = range[1265]/2;
def t56 = range[1288]/2;
def t57 = range[1311]/2;
def t58 = range[1334]/2;
def t59 = range[1357]/2;
def t60 = range[1380]/2;

# Highs each period

def s1 = t1 * 2;
def s2 = t2 * 2;
def s3 = t3 * 2;
def s4 = t4 * 2;
def s5 = t5 * 2;
def s6 = t6 * 2;
def s7 = t7 * 2;
def s8 = t8 * 2;
def s9 = t9 * 2;
def s10 = t10 * 2;
def s11 = t11 * 2;
def s12 = t12 * 2;
def s13 = t13 * 2;
def s14 = t14 * 2;
def s15 = t15 * 2;
def s16 = t16 * 2;
def s17 = t17 * 2;
def s18 = t18 * 2;
def s19 = t19 * 2;
def s20 = t20 * 2;
def s21 = t21 * 2;
def s22 = t22 * 2;
def s23 = t23 * 2;
def s24 = t24 * 2;
def s25 = t25 * 2;
def s26 = t26 * 2;
def s27 = t27 * 2;
def s28 = t28 * 2;
def s29 = t29 * 2;
def s30 = t30 * 2;
def s31 = t31 * 2;
def s32 = t32 * 2;
def s33 = t33 * 2;
def s34 = t34 * 2;
def s35 = t35 * 2;
def s36 = t36 * 2;
def s37 = t37 * 2;
def s38 = t38 * 2;
def s39 = t39 * 2;
def s40 = t40 * 2;
def s41 = t41 * 2;
def s42 = t42 * 2;
def s43 = t43 * 2;
def s44 = t44 * 2;
def s45 = t45 * 2;
def s46 = t46 * 2;
def s47 = t47 * 2;
def s48 = t48 * 2;
def s49 = t49 * 2;
def s50 = t50 * 2;
def s51 = t51 * 2;
def s52 = t52 * 2;
def s53 = t53 * 2;
def s54 = t54 * 2;
def s55 = t55 * 2;
def s56 = t56 * 2;
def s57 = t57 * 2;
def s58 = t58 * 2;
def s59 = t59 * 2;
def s60 = t60 * 2;


def hpmr_avg = (t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 + t11 + t12 + t13 + t14 + t15 + t16 + t17 + t18 + t19 + t20 + t21 + t22 + t23 + t24 + t25 + t26 + t27 + t28 + t29 + t30 + t31 + t32 + t33 + t34 + t35 + t36 + t37 + t38 + t39 + t40 + t41 + t42 + t43 + t44 + t45 + t46 + t47 + t48 + t49 + t50 + t51 + t52 + t53 + t54 + t55 + t56 + t57 + t58 + t59 + t60) / 60;
def hpmr_high = (s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10 + s11 + s12 + s13 + s14 + s15 + s16 + s17 + s18 + s19 + s20 + s21 + s22 + s23 + s24 + s25 + s26 + s27 + s28 + s29 + s30 + s31 + s32 + s33 + s34 + s35 + s36 + s37 + s38 + s39 + s40 + s41 + s42 + s43 + s44 + s45 + s46 + s47 + s48 + s49 + s50 + s51 + s52 + s53 + s54 + s55 + s56 + s57 + s58 + s59 + s60) / 60;

def uppertopline = (hourlow + hpmr_high);
def upperlowerline = (hourlow + hpmr_avg);
def lowertopline = (hourhigh - hpmr_high);
def lowerlowerline = (hourhigh - hpmr_avg);

plot upperhigh = uppertopline;
plot upperlow = upperlowerline;
plot lowerhigh = lowertopline;
plot lowerlow = lowerlowerline;

addCloud(upperhigh, upperlow, color.RED, color.RED);
addCloud(lowerhigh, lowerlow, color.GREEN, color.GREEN);

upperhigh.SetDefaultColor(Color.red);
upperlow.SetDefaultColor(Color.red);
lowerhigh.SetDefaultColor(Color.green);
lowerlow.SetDefaultColor(Color.green);
 
Solution
I am attempting to create an hourly upper indicator similar to the "volatility box". I used BenTen's "Average Price Movements" as a guide (I'm not a programmer).

In this case, I am looking back each hour for 60 hourly periods, taking an average of the range and the high of each period and then projecting them. I feel like my calculations are correct but it clearly isn't displaying correctly. What it should do is find the low for the current 60-minute candle and add the average and upper price movement number to project the high. Conversely, it should find the high for the current 60-minute candle, and subtract the average and the upper price movement range for that hour to project the low. If anyone has any insight into this...

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

See what you think of this code that is hourly. http://tos.mx/20Z4Tkn
Hi @chewie76, it looks like this code makes it so you have to manually hand enter the different price levels (hi, lo, etc.).

Do you know if there's a way in ThinkScript to have these price levels automatically pulled in, and then calculated? In other words, no manual entry?

Thank you so much for your thoughts and help with this.

Code:
#inputs
input alertsOn = no;
input showBorderOnCloud = yes;

#define variables
def hour = Floor(SecondsTillTime(0) / -3600);
def pdLow = low(period = AggregationPeriod.HOUR);
def pdHigh = high(period = AggregationPeriod.HOUR);
def state = {default init, run};
def low0; def high0;
def low1; def high1;
def low2; def high2;
def low3; def high3;
def low4; def high4;
def low5; def high5;
def low6; def high6;
def low7; def high7;
def low8; def high8;
def low9; def high9;
def low10; def high10;
def low11; def high11;
def low12; def high12;
def low13; def high13;
def low14; def high14;
def low15; def high15;
def low16; def high16;
def low17; def high17;
def low18; def high18;
def low19; def high19;
def low20; def high20;
def low21; def high21;
def low22; def high22;
def low23; def high23;
switch (state[1]) {
case init:
if (GetSymbol() == "/6A:XCME" or GetSymbol()=="/M6A:XCME")  then {
 low0=0.0008381511;
high0=0.0018915364;
low1=0.0011574248;
high1=0.0017675752;
low2=0.0013430569;
high2=0.0020428806;
low3=0.0015695061;
high3=0.0023461189;
low4=0.0013765315;
high4=0.0020742498;
low5=0.0011523555;
high5=0.0017335820;
low6=0.0010877775;
high6=0.0015880037;
low7=0.0011871236;
high7=0.0018316264;
low8=0.0015140589;
high8=0.0027203161;
low9=0.0017423951;
high9=0.0025465813;
low10=0.0021304107;
high10=0.0031930268;
low11=0.0015062054;
high11=0.0023102008;
low12=0.0011709637;
high12=0.0019743488;
low13=0.0010386247;
high13=0.0018043441;
low14=0.0010613155;
high14=0.0023134877;
low15=0.0009893252;
high15=0.0018317685;
low16=0.0005474541;
high16=0.0008556709;
low17=Double.NaN;
high17=Double.NaN;
low18=0.0008112174;
high18=0.0013294076;
low19=0.0009171309;
high19=0.0015383378;
low20=0.0013954650;
high20=0.0021037538;
low21=0.0013238764;
high21=0.0021183111;
low22=0.0010661918;
high22=0.0019353707;
low23=0.0008444904;
high23=0.0014867596;

#---I cut out the rest of the other ticker symbols
# to make this code sample shorter ---

}else
if (GetSymbol() == "/ZN:XCBT" or GetSymbol()=="/10Y:XCBT")  then {
 low0=0.0744835935;
high0=0.1235144534;
low1=0.0861705779;
high1=0.1499134065;
low2=0.1432383485;
high2=0.2232167296;
low3=0.1722964860;
high3=0.2739925765;
low4=0.1410357601;
high4=0.2141888493;
low5=0.1143919269;
high5=0.1993287762;
low6=0.1155843669;
high6=0.1768961018;
low7=0.1406217185;
high7=0.2373079690;
low8=0.2411987602;
high8=0.4338500679;
low9=0.2359022222;
high9=0.3773790278;
low10=0.2099242789;
high10=0.3387961936;
low11=0.1693928504;
high11=0.2595622277;
low12=0.1279466263;
high12=0.2038404830;
low13=0.1305868257;
high13=0.2214797065;
low14=0.1195482349;
high14=0.2715807973;
low15=0.1347963437;
high15=0.2376834950;
low16=0.1145325562;
high16=0.1735218793;
low17=Double.NaN;
high17=Double.NaN;
low18=0.1125183905;
high18=0.2033995782;
low19=0.0940194630;
high19=0.1493368362;
low20=0.1374800020;
high20=0.2443559355;
low21=0.1145883689;
high21=0.1937612405;
low22=0.0824252339;
high22=0.1766079692;
low23=0.0677384075;
high23=0.1280623737;

#--- End code snippet
 
Hi @chewie76, it looks like this code makes it so you have to manually hand enter the different price levels (hi, lo, etc.).

Do you know if there's a way in ThinkScript to have these price levels automatically pulled in, and then calculated? In other words, no manual entry?

Thank you so much for your thoughts and help with this.

Code:
#inputs
input alertsOn = no;
input showBorderOnCloud = yes;

#define variables
def hour = Floor(SecondsTillTime(0) / -3600);
def pdLow = low(period = AggregationPeriod.HOUR);
def pdHigh = high(period = AggregationPeriod.HOUR);
def state = {default init, run};
def low0; def high0;
def low1; def high1;
def low2; def high2;
def low3; def high3;
def low4; def high4;
def low5; def high5;
def low6; def high6;
def low7; def high7;
def low8; def high8;
def low9; def high9;
def low10; def high10;
def low11; def high11;
def low12; def high12;
def low13; def high13;
def low14; def high14;
def low15; def high15;
def low16; def high16;
def low17; def high17;
def low18; def high18;
def low19; def high19;
def low20; def high20;
def low21; def high21;
def low22; def high22;
def low23; def high23;
switch (state[1]) {
case init:
if (GetSymbol() == "/6A:XCME" or GetSymbol()=="/M6A:XCME")  then {
 low0=0.0008381511;
high0=0.0018915364;
low1=0.0011574248;
high1=0.0017675752;
low2=0.0013430569;
high2=0.0020428806;
low3=0.0015695061;
high3=0.0023461189;
low4=0.0013765315;
high4=0.0020742498;
low5=0.0011523555;
high5=0.0017335820;
low6=0.0010877775;
high6=0.0015880037;
low7=0.0011871236;
high7=0.0018316264;
low8=0.0015140589;
high8=0.0027203161;
low9=0.0017423951;
high9=0.0025465813;
low10=0.0021304107;
high10=0.0031930268;
low11=0.0015062054;
high11=0.0023102008;
low12=0.0011709637;
high12=0.0019743488;
low13=0.0010386247;
high13=0.0018043441;
low14=0.0010613155;
high14=0.0023134877;
low15=0.0009893252;
high15=0.0018317685;
low16=0.0005474541;
high16=0.0008556709;
low17=Double.NaN;
high17=Double.NaN;
low18=0.0008112174;
high18=0.0013294076;
low19=0.0009171309;
high19=0.0015383378;
low20=0.0013954650;
high20=0.0021037538;
low21=0.0013238764;
high21=0.0021183111;
low22=0.0010661918;
high22=0.0019353707;
low23=0.0008444904;
high23=0.0014867596;

#---I cut out the rest of the other ticker symbols
# to make this code sample shorter ---

}else
if (GetSymbol() == "/ZN:XCBT" or GetSymbol()=="/10Y:XCBT")  then {
 low0=0.0744835935;
high0=0.1235144534;
low1=0.0861705779;
high1=0.1499134065;
low2=0.1432383485;
high2=0.2232167296;
low3=0.1722964860;
high3=0.2739925765;
low4=0.1410357601;
high4=0.2141888493;
low5=0.1143919269;
high5=0.1993287762;
low6=0.1155843669;
high6=0.1768961018;
low7=0.1406217185;
high7=0.2373079690;
low8=0.2411987602;
high8=0.4338500679;
low9=0.2359022222;
high9=0.3773790278;
low10=0.2099242789;
high10=0.3387961936;
low11=0.1693928504;
high11=0.2595622277;
low12=0.1279466263;
high12=0.2038404830;
low13=0.1305868257;
high13=0.2214797065;
low14=0.1195482349;
high14=0.2715807973;
low15=0.1347963437;
high15=0.2376834950;
low16=0.1145325562;
high16=0.1735218793;
low17=Double.NaN;
high17=Double.NaN;
low18=0.1125183905;
high18=0.2033995782;
low19=0.0940194630;
high19=0.1493368362;
low20=0.1374800020;
high20=0.2443559355;
low21=0.1145883689;
high21=0.1937612405;
low22=0.0824252339;
high22=0.1766079692;
low23=0.0677384075;
high23=0.1280623737;

#--- End code snippet
I don't think it's possible.
 
Hi @chewie76, it looks like this code makes it so you have to manually hand enter the different price levels (hi, lo, etc.).

Do you know if there's a way in ThinkScript to have these price levels automatically pulled in, and then calculated? In other words, no manual entry?

Thank you so much for your thoughts and help with this.

Code:
#inputs
input alertsOn = no;
input showBorderOnCloud = yes;

#define variables
def hour = Floor(SecondsTillTime(0) / -3600);
def pdLow = low(period = AggregationPeriod.HOUR);
def pdHigh = high(period = AggregationPeriod.HOUR);
def state = {default init, run};
def low0; def high0;
def low1; def high1;
def low2; def high2;
def low3; def high3;
def low4; def high4;
def low5; def high5;
def low6; def high6;
def low7; def high7;
def low8; def high8;
def low9; def high9;
def low10; def high10;
def low11; def high11;
def low12; def high12;
def low13; def high13;
def low14; def high14;
def low15; def high15;
def low16; def high16;
def low17; def high17;
def low18; def high18;
def low19; def high19;
def low20; def high20;
def low21; def high21;
def low22; def high22;
def low23; def high23;
switch (state[1]) {
case init:
if (GetSymbol() == "/6A:XCME" or GetSymbol()=="/M6A:XCME")  then {
 low0=0.0008381511;
high0=0.0018915364;
low1=0.0011574248;
high1=0.0017675752;
low2=0.0013430569;
high2=0.0020428806;
low3=0.0015695061;
high3=0.0023461189;
low4=0.0013765315;
high4=0.0020742498;
low5=0.0011523555;
high5=0.0017335820;
low6=0.0010877775;
high6=0.0015880037;
low7=0.0011871236;
high7=0.0018316264;
low8=0.0015140589;
high8=0.0027203161;
low9=0.0017423951;
high9=0.0025465813;
low10=0.0021304107;
high10=0.0031930268;
low11=0.0015062054;
high11=0.0023102008;
low12=0.0011709637;
high12=0.0019743488;
low13=0.0010386247;
high13=0.0018043441;
low14=0.0010613155;
high14=0.0023134877;
low15=0.0009893252;
high15=0.0018317685;
low16=0.0005474541;
high16=0.0008556709;
low17=Double.NaN;
high17=Double.NaN;
low18=0.0008112174;
high18=0.0013294076;
low19=0.0009171309;
high19=0.0015383378;
low20=0.0013954650;
high20=0.0021037538;
low21=0.0013238764;
high21=0.0021183111;
low22=0.0010661918;
high22=0.0019353707;
low23=0.0008444904;
high23=0.0014867596;

#---I cut out the rest of the other ticker symbols
# to make this code sample shorter ---

}else
if (GetSymbol() == "/ZN:XCBT" or GetSymbol()=="/10Y:XCBT")  then {
 low0=0.0744835935;
high0=0.1235144534;
low1=0.0861705779;
high1=0.1499134065;
low2=0.1432383485;
high2=0.2232167296;
low3=0.1722964860;
high3=0.2739925765;
low4=0.1410357601;
high4=0.2141888493;
low5=0.1143919269;
high5=0.1993287762;
low6=0.1155843669;
high6=0.1768961018;
low7=0.1406217185;
high7=0.2373079690;
low8=0.2411987602;
high8=0.4338500679;
low9=0.2359022222;
high9=0.3773790278;
low10=0.2099242789;
high10=0.3387961936;
low11=0.1693928504;
high11=0.2595622277;
low12=0.1279466263;
high12=0.2038404830;
low13=0.1305868257;
high13=0.2214797065;
low14=0.1195482349;
high14=0.2715807973;
low15=0.1347963437;
high15=0.2376834950;
low16=0.1145325562;
high16=0.1735218793;
low17=Double.NaN;
high17=Double.NaN;
low18=0.1125183905;
high18=0.2033995782;
low19=0.0940194630;
high19=0.1493368362;
low20=0.1374800020;
high20=0.2443559355;
low21=0.1145883689;
high21=0.1937612405;
low22=0.0824252339;
high22=0.1766079692;
low23=0.0677384075;
high23=0.1280623737;

#--- End code snippet
I used to used autochartist to pull those number and adjust high/low number in the code every month if there is any change in volatility. Hope this helps.
 
Last edited:
That is correct. I have been using a version that was simplified by Halcyonguy, only I've been using it for limited periods of 8-12 day look backs to avoid holidays screwing up the look back periods. It's actually working very well. It's certainly providing as many entry opportunities in choppy markets as I've seen with the similar volatility box indicator from TOS and Raghee Horner's HPMR. I would attach a picture of it to show some examples, but don't know how to attach a jpg. The image attachment button here wants a web address.

It does rewrite, but so does TOS' and Raghee Horner's HPMR indicator. It also BARELY rewrites, meaning that when either the half hour or hour open (depending on how it's set - I use both) they barely move from their initial opening positions. If they do move significantly. you wouldn't used them anyway because price is running away and they are no longer relevant. But it's astonishing how accurate they've been for me the past two weeks. When they correspond with any other significant support or resistance such as value area high/low of volume profile, pivot levels, VWAP, or 200 EMA, they're a slam dunk.

For one hour, the "step" is 23. for half hour, it gets changed to 46. The look back period for both is changed from 60 to between 8 and 12, again, to stay away from holidays that would disrupt the pattern. I actually think they seem more accurate between those number of days compared to looking far back. I'm using them entirely on /ES futures and as I said, it's worked surprisingly well, mainly during periods of consolidation or in an overall tighter, choppy market (which we've recently had a few days of).

This is the code I'm using for it, and thanks again to Halcyonguy for simplifying it:

# HPMR 60-Period look-back

input aggregationPeriod = AggregationPeriod.HOUR;
def hourhigh = high(period = aggregationPeriod);
def hourlow = low(period = aggregationPeriod);
def houropen = open(period = aggregationPeriod);
def range = (hourhigh - hourlow);

# Get range for each hour over the last 60 days

input bars_back = 60;
input step = 23;
def x = fold i = 1 to bars_back+1
with p
do p + getvalue(range, ( i * step) );

def s = x / bars_back;
def t = s / 2;

def hpmr_avg = t;
def hpmr_range = s;

def uppertopline = (hourlow + hpmr_range);
def upperlowerline = uppertopline + 2;
def lowerlowerline = (hourhigh - hpmr_range);
def lowertopline = lowerlowerline - 2;

plot upperhigh = uppertopline;
plot upperlow = upperlowerline;
plot lowerhigh = lowertopline;
plot lowerlow = lowerlowerline;

addCloud(upperhigh, upperlow, color.CYAN, color.CYAN);
addCloud(lowerhigh, lowerlow, color.ORANGE, color.ORANGE);
hi there....i am trying to use this on stock charts.....so you use step 23 for futures but what we should use as step for stock charts? any idea? thanks !
 
@bborman The codes in this thread are attempting to replicate Volatility Boxes and the PMRs by calculating the average ranges over a look-back period (usually 60 days; this what AutoChartist and RH both say they use), so they should apply to any asset. RH says it's too taxing for TOS to calculate all of these values, so they hard-code the values for a limited set of assets. They also break them into three different scripts--Futures, ETFs, and Stocks--to help with performance. Because of this, the scripts will not generate clouds for a ticker that isn't already hard-coded in. (I also suspect this was largely a business decision by Simpler. They'd rather you were forced to stay subscribed for updates than have a code that you can pay for once and use forever for any asset.)


To try to help clear up some confusion about the PMRs, here's what I've gleaned:

The PMRs calculate two values for the PMR--high, low, and the average of H+L. It uses these to plot three potential entry points. On the charts, you'll see a dotted line closest to price, which is the low PMR-low; it is not part of the cloud and is only used in a strongly-trending market. The bottom of the cloud is (H+L)/2, and is the most common entry point. The upper bound of the cloud is the PMR-high value. (They also plot 1-STDV and 2-STDV lines outside the cloud, but at that point it seems to me similar to plotting fibs of fibs... if you plot enough lines you'll eventually find one that hits.)

A basic concept behind PMRs (and and VBs is that the volatility range can vary significantly depending on hour of the day or day of the week.

HPMR: It doesn't make sense to calculate an average that gives equal weight to the very volatile opening hour, the slower lunch hour, and the dead overnight hours. So you don't calculate an average range for all bars going back 6 months, you calculate the average for the 9-10am bar going back 6 months, and a different average for the 10-11 hour, the 11-12, etc.. this is how you end up with 23 inputs in the code for futures, which trade 23 hours per day.

DPMR: Just like different hours of the day can have drastically different VRs, the days of the week can as well (Monday is generally less volatile than Thursday, for example). DPMRs calculate the daily volatility for all Mondays going back six months, all Tuesday, etc... The DPMR for futures would have values for six days--all but Saturday.
 
I used to used autochartist to pull those number and adjust high/low number in the code every month if there is any change in volatility. Hope this helps.
Hey yoojay. You mentioned pulling numbers from autochartist monthly to adjust high/low numbers in the code. What are those numbers called on the autochartist website? I'd like to try my hand at this.
Thanks, Phillip

@bborman The codes in this thread are attempting to replicate Volatility Boxes and the PMRs by calculating the average ranges over a look-back period (usually 60 days; this what AutoChartist and RH both say they use), so they should apply to any asset. RH says it's too taxing for TOS to calculate all of these values, so they hard-code the values for a limited set of assets. They also break them into three different scripts--Futures, ETFs, and Stocks--to help with performance. Because of this, the scripts will not generate clouds for a ticker that isn't already hard-coded in. (I also suspect this was largely a business decision by Simpler. They'd rather you were forced to stay subscribed for updates than have a code that you can pay for once and use forever for any asset.)


To try to help clear up some confusion about the PMRs, here's what I've gleaned:

The PMRs calculate two values for the PMR--high, low, and the average of H+L. It uses these to plot three potential entry points. On the charts, you'll see a dotted line closest to price, which is the low PMR-low; it is not part of the cloud and is only used in a strongly-trending market. The bottom of the cloud is (H+L)/2, and is the most common entry point. The upper bound of the cloud is the PMR-high value. (They also plot 1-STDV and 2-STDV lines outside the cloud, but at that point it seems to me similar to plotting fibs of fibs... if you plot enough lines you'll eventually find one that hits.)

A basic concept behind PMRs (and and VBs is that the volatility range can vary significantly depending on hour of the day or day of the week.

HPMR: It doesn't make sense to calculate an average that gives equal weight to the very volatile opening hour, the slower lunch hour, and the dead overnight hours. So you don't calculate an average range for all bars going back 6 months, you calculate the average for the 9-10am bar going back 6 months, and a different average for the 10-11 hour, the 11-12, etc.. this is how you end up with 23 inputs in the code for futures, which trade 23 hours per day.

DPMR: Just like different hours of the day can have drastically different VRs, the days of the week can as well (Monday is generally less volatile than Thursday, for example). DPMRs calculate the daily volatility for all Mondays going back six months, all Tuesday, etc... The DPMR for futures would have values for six days--all but Saturday.
Hey Spesh. Thanks for explaining the PMR's. Where might I find sample code for an hourly PMR and daily PMR?
Thanks, Phillip
 
I used to used autochartist to pull those number and adjust high/low number in the code every month if there is any change in volatility. Hope this helps.
Hello youjay. How did you get the autochartist data? How does a person sign up and then download the hourly or daily PMR data?
Thanks, Phillip Miller
 
Hello youjay. How did you get the autochartist data? How does a person sign up and then download the hourly or daily PMR data?
Thanks, Phillip Miller
You can get the data from ChartViper (probably chartviper.com, but you can google it). I think they charge $13/month.

As for code, you can buy a subscription for the indicator for $700-1400 per year, depending on what package you get, but I wouldn't recommend it. There are similar indicators on this site, built on the same principles, for free. I couldn't say if one works better then another.
 
Thank you!
You can get the data from ChartViper (probably chartviper.com, but you can google it). I think they charge $13/month.

As for code, you can buy a subscription for the indicator for $700-1400 per year, depending on what package you get, but I wouldn't recommend it. There are similar indicators on this site, built on the same principles, for free. I couldn't say if one works better then another.
 
Hi @chewie76, it looks like this code makes it so you have to manually hand enter the different price levels (hi, lo, etc.).

Do you know if there's a way in ThinkScript to have these price levels automatically pulled in, and then calculated? In other words, no manual entry?

Thank you so much for your thoughts and help with this.

Code:
#inputs
input alertsOn = no;
input showBorderOnCloud = yes;

#define variables
def hour = Floor(SecondsTillTime(0) / -3600);
def pdLow = low(period = AggregationPeriod.HOUR);
def pdHigh = high(period = AggregationPeriod.HOUR);
def state = {default init, run};
def low0; def high0;
def low1; def high1;
def low2; def high2;
def low3; def high3;
def low4; def high4;
def low5; def high5;
def low6; def high6;
def low7; def high7;
def low8; def high8;
def low9; def high9;
def low10; def high10;
def low11; def high11;
def low12; def high12;
def low13; def high13;
def low14; def high14;
def low15; def high15;
def low16; def high16;
def low17; def high17;
def low18; def high18;
def low19; def high19;
def low20; def high20;
def low21; def high21;
def low22; def high22;
def low23; def high23;
switch (state[1]) {
case init:
if (GetSymbol() == "/6A:XCME" or GetSymbol()=="/M6A:XCME")  then {
 low0=0.0008381511;
high0=0.0018915364;
low1=0.0011574248;
high1=0.0017675752;
low2=0.0013430569;
high2=0.0020428806;
low3=0.0015695061;
high3=0.0023461189;
low4=0.0013765315;
high4=0.0020742498;
low5=0.0011523555;
high5=0.0017335820;
low6=0.0010877775;
high6=0.0015880037;
low7=0.0011871236;
high7=0.0018316264;
low8=0.0015140589;
high8=0.0027203161;
low9=0.0017423951;
high9=0.0025465813;
low10=0.0021304107;
high10=0.0031930268;
low11=0.0015062054;
high11=0.0023102008;
low12=0.0011709637;
high12=0.0019743488;
low13=0.0010386247;
high13=0.0018043441;
low14=0.0010613155;
high14=0.0023134877;
low15=0.0009893252;
high15=0.0018317685;
low16=0.0005474541;
high16=0.0008556709;
low17=Double.NaN;
high17=Double.NaN;
low18=0.0008112174;
high18=0.0013294076;
low19=0.0009171309;
high19=0.0015383378;
low20=0.0013954650;
high20=0.0021037538;
low21=0.0013238764;
high21=0.0021183111;
low22=0.0010661918;
high22=0.0019353707;
low23=0.0008444904;
high23=0.0014867596;

#---I cut out the rest of the other ticker symbols
# to make this code sample shorter ---

}else
if (GetSymbol() == "/ZN:XCBT" or GetSymbol()=="/10Y:XCBT")  then {
 low0=0.0744835935;
high0=0.1235144534;
low1=0.0861705779;
high1=0.1499134065;
low2=0.1432383485;
high2=0.2232167296;
low3=0.1722964860;
high3=0.2739925765;
low4=0.1410357601;
high4=0.2141888493;
low5=0.1143919269;
high5=0.1993287762;
low6=0.1155843669;
high6=0.1768961018;
low7=0.1406217185;
high7=0.2373079690;
low8=0.2411987602;
high8=0.4338500679;
low9=0.2359022222;
high9=0.3773790278;
low10=0.2099242789;
high10=0.3387961936;
low11=0.1693928504;
high11=0.2595622277;
low12=0.1279466263;
high12=0.2038404830;
low13=0.1305868257;
high13=0.2214797065;
low14=0.1195482349;
high14=0.2715807973;
low15=0.1347963437;
high15=0.2376834950;
low16=0.1145325562;
high16=0.1735218793;
low17=Double.NaN;
high17=Double.NaN;
low18=0.1125183905;
high18=0.2033995782;
low19=0.0940194630;
high19=0.1493368362;
low20=0.1374800020;
high20=0.2443559355;
low21=0.1145883689;
high21=0.1937612405;
low22=0.0824252339;
high22=0.1766079692;
low23=0.0677384075;
high23=0.1280623737;

#--- End code snippet
Hello cloud1802. Did you create this code snippet? Or if is available for download from usethinkscript?
Thanks
Phillip
 

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
404 Online
Create Post

The Market Trading Game Changer

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

Frequently Asked Questions

What is useThinkScript?

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

How do I get started?

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

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

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