Welcome! Log In Create A New Profile

Get Earnings and Seasonal Trends - Subscribe Today!

Advanced

Fun with ThinkScript

Posted by robert 
Re: Fun with ThinkScript
June 16, 2016 07:42AM
Quote
Robert
I recently watched a video by Scott Landers which described a method by which he uses volume to determine significant areas of support / resistance on intra-day charts. His method seemed like it could be a useful tool to add to my intra-day trading strategy, so I wrote some code for it.

robert thank you for sharing this video. ive watched it a couple times now and am intrigued about this concept of the vbox with your script for identify areas of supt/rest with volume. i understand its main purpose is intraday charts, but at around 3:30 in the video scott mentions that this concept can also be applied to daily charts as well but im assuming with a different approach.

i was curious have you seen any information on how this technique is applied to daily charts? i tried googling this topic but haven't had any luck as of yet except for this link from marketguage continueing about intraday charts.

thanks,
mike
Re: Fun with ThinkScript
June 16, 2016 03:15PM
tanman great indicators questions how you can made scans out of net volume and myOBV net indicators?
Re: Fun with ThinkScript
June 17, 2016 12:24AM
hi..i newbie for using thinkscript..im not a programmer who know coding etc...for last 3 years im trading only using thinkorswim, multi time frame , simple indicator EMA 8 - EMA 89....and TTM Squeeze....it works for me and im comfortable using this indicator...recently i am using bollingerbands and keltnerchannel...i`ve tried to combined bollingerband and keltnerchannel with EMA 8 - 89 indicator so i dont need to make new window for bollingerband and keltner channel...which candle change the color when bollingerband upper and lower band inside the keltnerchannel...the problem is...i only can make this color into one color blue for example...so i dont know the candle going up or down when bollingerband upper and lower band inside keltner channel...is it possible to make candle change the color based on price going up or down ??

this is the simple script

Quote
just simple script

plot MA8 = movAvgExponential(length=8);
MA8.SetDefaultColor(color.YELLOW);

plot MA21 = movAvgExponential(length=21);
MA21.SetDefaultColor(color.white);

plot MA34 = movAvgExponential(length=34);
MA34.SetDefaultColor(color.magenta);

plot MA55 = movAvgExponential(length=55);
MA55.SetDefaultColor(color.cyan);

plot MA89 = movAvgExponential(length=89);
MA89.SetDefaultColor(color.blue);

Addcloud(MA8, MA21, color.lime, color.magenta);


#Bollinger Squeeze
plot BBupper = BollingerBands().”Upperband” ;
plot KCupper = KeltnerChannels().”Upper_band” ;
plot BBlower = BollingerBands().”lowerband” ;
plot KClower = KeltnerChannels().”lower_band” ;

bbupper.Hide();
KCupper.Hide();
BBlower.Hide();
KClower.Hide();

bbupper.DefineColor("Sqz", Color.BLUE);
BBlower.DefineColor("sqz", Color.BLUE);

AssignPriceColor(if BBupper < KCupper then bbupper.Color("sqz"winking smiley else Color.CURRENT);

AssignPriceColor(if BBlower > KClower then BBlower.Color("sqz"winking smiley else Color.CURRENT);


thanks before if there is someone can help with my newbie script eye rolling smiley
Re: Fun with ThinkScript
June 17, 2016 01:03PM
im looking to plot the average of the daily highs for volume on any time frame 1,5,10 etc. I just need a line to run across and show me the average of the highs of each day. I have the code below to show the average of the 20,55 and 233 candles but nothing to show the average of the highs for the last X days


declare on_volume;
declare real_size;

input movingAveragePeriod = 20;
input movingAveragePeriod55 = 55;
input movingAveragePeriod233 = 233;
input lookBackPeriod = 20;
input showLegend = no;
input priceBarColor = {default NONE, BV_SPECIAL, BV_ALL};
input showVolumeBars = YES;
input tolerance = .05;
def VolumeMultiplier = 5;



def range = (high - low);
def value1 = volume;
def value2 = volume * range;
def value3 = If(range <> 0 , volume / range, 0);
def value4 = Average(value1, movingAveragePeriod);
def value5 = Average(value1, movingAveragePeriod55);
def value6 = Average(value1, movingAveragePeriod233);

def Condition1 = (value1 <= Lowest(value1, lookBackPeriod) * (1.0 + tolerance));
def Condition2 = (value2 >= Highest(value2, lookBackPeriod) * (1.0 - tolerance));
def Condition3 = (value3 <= Lowest(value3, lookBackPeriod) * (1.0 + tolerance));
def Condition4 = (value3 >= Highest(value3, lookBackPeriod) * (1.0 - tolerance));

def ClimaxChurn = if Condition4 and ((Condition2 and close > open ) or ((Condition2 or Condition3) and close < open)) then 1 else 0;
def Churn = if Condition4 then 1 else 0;
def Climaxdown = if ((Condition3 or Condition2) and close < open)   then 1 else 0;
def ClimaxUp = if Condition2 and close > open then 1 else 0;
def Lowvolume =  if Condition1 then 1 else 0;

plot betterVolume = if showVolumeBars then value1 else Double.NaN;
plot averageVolume = if showVolumeBars then value4 else Double.NaN;
plot averageVolume55 = if showVolumeBars then value5 else Double.NaN;
plot averageVolume233 = if showVolumeBars then value6 else Double.NaN;

averageVolume.SetDefaultColor(Color.RED);
averageVolume55.SetDefaultColor(Color.ORANGE);
averageVolume233.SetDefaultColor(Color.BLACK);

betterVolume.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
betterVolume.SetLineWeight(5);

betterVolume.DefineColor("lowVolumeColor", Color.YELLOW);
betterVolume.DefineColor("climaxUpColor", Color.CYAN);
betterVolume.DefineColor("climaxDownColor", Color.WHITE);
betterVolume.DefineColor("churnColor", Color.VIOLET);
betterVolume.DefineColor("climaxChurnColor", Color.MAGENTA);
betterVolume.DefineColor("defaultColor", Color.DARK_GRAY);

betterVolume.AssignValueColor(
if Condition4 and ((Condition2 and close > open ) or ((Condition2 or Condition3) and close < open)) 
    then betterVolume.Color("climaxChurnColor" ) 
else if Condition4 
    then betterVolume.Color("churnColor" ) 
else
if ((Condition3 or Condition2) and close < open) 
    then betterVolume.Color("climaxDownColor" ) 
else
if Condition2 and close > open 
    then betterVolume.Color("climaxUpColor" ) 
else if Condition1 
    then betterVolume.Color("lowVolumeColor" ) 
else betterVolume.Color("defaultColor" ));

AssignPriceColor(if priceBarColor == priceBarColor.BV_ALL then if Condition4 and ((Condition2 and close > open ) or ((Condition2 or Condition3) and close < open)) 
    then betterVolume.Color("climaxChurnColor" ) 
else if Condition4 
    then betterVolume.Color("churnColor" ) 
else
if ((Condition3 or Condition2) and close < open) 
    then betterVolume.Color("climaxDownColor" ) 
else
if Condition2 and close > open 
    then betterVolume.Color("climaxUpColor" ) 
else if Condition1 
    then betterVolume.Color("lowVolumeColor" ) 
else betterVolume.Color("defaultColor" ) else if priceBarColor == priceBarColor.BV_SPECIAL then if Condition4 and ((Condition2 and close > open ) or ((Condition2 or Condition3) and close < open)) 
    then betterVolume.Color("climaxChurnColor" ) 
else if Condition4 
    then betterVolume.Color("churnColor" ) 
else
if ((Condition3 or Condition2) and close < open) 
    then betterVolume.Color("climaxDownColor" ) 
else
if Condition2 and close > open 
    then betterVolume.Color("climaxUpColor" ) 
else if Condition1 
    then betterVolume.Color("lowVolumeColor" ) 
else Color.CURRENT else Color.CURRENT);

AddLabel(showLegend, "Low Volume", betterVolume.Color("lowVolumeColor" ));
AddLabel(showLegend, "Climax Up", betterVolume.Color("climaxUpColor" ));
AddLabel(showLegend, "Climax Down", betterVolume.Color("climaxDownColor" ));
AddLabel(showLegend, "Churn", betterVolume.Color("churnColor" ));
AddLabel(showLegend, "Climax Churn", betterVolume.Color("climaxChurnColor" ));



Edited 4 time(s). Last edit at 06/17/2016 01:15PM by xilb51x.
TOS Problem with Scan - Help?
June 20, 2016 08:34PM
Hello everyone - I am having problems with my TOS scan. I am trying to do a simple pre-market scan for stocks that are gapping down but I am running into issues. Even running the basic built in scan does not show all stocks that I see are gapping down BEFORE the market opens.

If someone could help create a code to include the following to be run before the market opens ...

1. Stock pre-market price (last) is below the previous day's close (gap down)
2. Stock pre-market price is above the previous day's low
3. Average volume of the stock is above 50k
4. Stock price is above $2

When I try and build this scan it does not work properly - I would appreciate any help here. Thank you
JN
Re: Fun with ThinkScript
June 25, 2016 03:05AM
Hi Bob,
Can upcoming earnings date be plotted by this script?

Regards,
JN
Re: Fun with ThinkScript
June 25, 2016 05:40AM
Quote
JN
Hi Bob,
Can upcoming earnings date be plotted by this script?

Regards,
JN

I assume you are referring to this script. Yes, it can.

- robert


Professional ThinkorSwim indicators for the average Joe
Re: Fun with ThinkScript
June 25, 2016 03:22PM
--- removed ---



Edited 1 time(s). Last edit at 06/25/2016 03:24PM by mntman.
Re: Fun with ThinkScript
June 25, 2016 08:22PM
delete



Edited 1 time(s). Last edit at 07/17/2016 10:13AM by whitepine.
Re: Fun with ThinkScript
July 01, 2016 01:39PM
PaintBar study:

Just a quick question here. The following is a simple paintbar study that will color the price bars white if the RSI(14) is greater than 80.

declare upper;
def rel = reference RSI(14).rsi;
AssignpriceColor (If rel > 80 then color.WHITE else color.current);

However, it's coloring my volume bars white also when the condition is met. I have the volume plotted in it's own pane. Would rather they say the red or green per the chart setting.

How would I fix this? Thanks
Re: Fun with ThinkScript
July 05, 2016 03:57AM
Hi everybody.
I try to program this simple script, it should paint the candle bodies the way I need it but somehow it doesn't at all. Anybody can help to identify the problem ???
---------------------------------------
def body = AbsValue(open-close);
def wrb = if body > body[1] and body > body[2] and
body > body[3] then 1 else 0;
def wrbupper = if wrb > 0 and close > open then 1 else 0;
def wrbdown = if wrb > 0 and close < open then 1 else 0;
def wrbhgupper = if wrbupper > 0 and low[1] > high[-1] then 1 else 0;
def wrbhgdown = if wrbdown > 0 and high[1] < low[-1] then 1 else 0;

plot wrbup = if wrbupper > 0 then 1 else 0;
plot wrbdn = if wrbdown > 0 then 1 else 0;
plot wrbhgup = if wrbhgupper > 0 then 1 else 0;
plot wrbhgdn = if wrbhgdown > 0 then 1 else 0;

wrbup.DefineColor("WRBup", Color.CYAN);
wrbdn.DefineColor("WRBdn", Color.MAGENTA);
wrbhgup.DefineColor("WRBHGup", Color.WHITE);
wrbhgdn.DefineColor("WRBHGdn", Color.BLACK);

AssignPriceColor(if wrbup > 0 then wrbup.color("WRBup"winking smiley else Color.CURRENT);
AssignPriceColor(if wrbdn > 0 then wrbdn.color("WRBdn"winking smiley else Color.CURRENT);
AssignPriceColor(if wrbup > 0 and wrbhgup > 0 then wrbhgup.color("WRBHGUP"winking smiley else Color.CURRENT);
AssignPriceColor(if wrbdn > 0 and wrbhgdn > 0 then wrbhgdn.color("WRBHGDown"winking smiley else Color.CURRENT);
------------------------------------------------------
Thank you in advance.
Re: Fun with ThinkScript
July 05, 2016 04:27PM
I got the cyan and magenta colored bars to show up, but it looks like the black and white conditions aren't happening.

def body = AbsValue(open - close);

def wrb = if body > body[1] and body > body[2] and
body > body[3] then 1 else 0;

def wrbupper = if wrb > 0 and close > open then 1 else 0;
def wrbdown = if wrb > 0 and close < open then 1 else 0;
def wrbhgupper = if wrbupper > 0 and low[1] > high[-1] then 1 else 0;
def wrbhgdown = if wrbdown > 0 and high[1] < low[-1] then 1 else 0;

plot wrbup = if wrbupper > 0 then 1 else 0;
plot wrbdn = if wrbdown > 0 then 1 else 0;
plot wrbhgup = if wrbhgupper > 0 then 1 else 0;
plot wrbhgdn = if wrbhgdown > 0 then 1 else 0;

wrbup.DefineColor("WRBup", Color.CYAN);
wrbdn.DefineColor("WRBdn", Color.MAGENTA);
wrbhgup.DefineColor("WRBHGup", Color.WHITE);
wrbhgdn.DefineColor("WRBHGdn", Color.BLACK);

AssignPriceColor(if wrbup == 0 then wrbup.color("WRBup"winking smiley else
if wrbdn == 0 then wrbdn.color("WRBdn"winking smiley else
if wrbhgup == 0 then wrbhgup.color("WRBHGup"winking smiley else
if wrbhgdn == 0 then wrbhgdn.color("WRBHGdn"winking smiley else
Color.CURRENT);
Re: Fun with ThinkScript
July 05, 2016 07:02PM
devildriver6 Wrote:
-------------------------------------------------------
> I got the cyan and magenta colored bars to show
> up, but it looks like the black and white
> conditions aren't happening.

Thanks for trying, it's looks like the conditions are fighting each other.
Re: Fun with ThinkScript
July 05, 2016 07:14PM
Exactly. Because the first and second conditions are absolute, the 3rd and 4th can't exist. Need a shut down for the 1st and 2nd.

But, for now, the bars are colored.
When using the assignpricecolor, it needs to be one long string of if x then y else if z then a else if a then B....and end it with else color.current.

That way you can see the bars which aren't included in the conditions.
Re: Fun with ThinkScript
July 06, 2016 04:48AM
devildriver6 Wrote:
-------------------------------------------------------
> Exactly. Because the first and second conditions
> are absolute, the 3rd and 4th can't exist. Need a
> shut down for the 1st and 2nd.
>
How can I achieve that ???

> But, for now, the bars are colored.
> When using the assignpricecolor, it needs to be
> one long string of if x then y else if z then a
> else if a then B....and end it with else
> color.current.
>
> That way you can see the bars which aren't
> included in the conditions.
Interesting, thank you.
It does paint except it never returns to normal (current) conditions. It's all the time Cyan or Magenta, but this should be big problem to change.
I try to split it into two scripts but still having the same problem, one wouldn't work, depends wich one is assigned first on the chart.
Re: Fun with ThinkScript
July 06, 2016 06:10AM
Quote
Palmer
Just a quick question here. The following is a simple paintbar study that will color the price bars white if the RSI(14) is greater than 80.

declare upper;
def rel = reference RSI(14).rsi;
AssignpriceColor (If rel > 80 then color.WHITE else color.current);

However, it's coloring my volume bars white also when the condition is met. I have the volume plotted in it's own pane. Would rather they say the red or green per the chart setting.

How would I fix this? Thanks

Palmer, there must be something else going on with a different study that is causing your volume bars to paint white because the following screenshot is taken using the code that you posted above and I do not see a change in volume bar colors.



Quote
knias
Hi everybody.
I try to program this simple script, it should paint the candle bodies the way I need it but somehow it doesn't at all. Anybody can help to identify the problem ???

def body = AbsValue(open - close);
def wrb = body > Highest(body[1], 3);

def wrbupper = wrb and close > open;
def wrbdown = wrb and close < open;

def wrbhgupper = wrbupper and low[1] > high[-1];
def wrbhgdown = wrbdown and high[1] < low[-1];

AssignPriceColor(if wrbhgupper then Color.WHITE else if wrbhgdown then Color.BLACK else if wrbupper then Color.CYAN else if wrbdown then Color.MAGENTA else Color.CURRENT);



- robert


Professional ThinkorSwim indicators for the average Joe
Re: Fun with ThinkScript
July 06, 2016 07:10AM
Wow, thank you Robert its perfect.
Some thank you is on the way.
Re: Fun with ThinkScript
July 07, 2016 04:27PM
I wasn't sure where to ask this question but since it has to do with a potential script, guess i'll ask here. Is there anyway to customize the Time and Sales so that it only shows blocks of 20+ contracts ? Also would it be possible to change the color of an order that was executed above the ask or below the bid (assuming it was slippage on a market order) ? thanks in advance for any answers.
Re: Fun with ThinkScript
July 08, 2016 08:31PM
for some reason my crossover signal arrows on my stochastic are plotting way up above at the price values instead of at the stochastic values. would anyone be able to recognize where in went wrong in my script please? i'd like the arrows to appear lower at the stochastic crossover points.

declare lower;
input over_bought = 75;
input over_sold = 25;
input KPeriod = 7;
input DPeriod = 3;
input priceH = high;
input priceL = low;
input priceC = close;
input averageType = AverageType.Exponential;

# define indicator
def SlowKd = reference StochasticFull(over_bought,over_sold,KPeriod,DPeriod,priceH,priceL,priceC,3,averageType).FullK;
def SlowDd = reference StochasticFull(over_bought,over_sold,KPeriod,DPeriod,priceH,priceL,priceC,3,averageType).FullD;
plot SlowK = SlowKd;
    SlowK.SetStyle(Curve.FIRM);
    SlowK.setDefaultColor(CreateColor(153,204,255));
    SlowK.SetLineWeight(1);
plot SlowD = SlowDd;
    SlowD.SetStyle(Curve.Medium_Dash);
    SlowD.setDefaultColor(CreateColor(255,153,153));
    SlowD.SetLineWeight(1);
    SlowD.HideBubble();
plot OverBought = over_bought;
    OverBought.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
    OverBought.SetDefaultColor(CreateColor(255,204,153));
    OverBought.SetLineWeight(1);
    OverBought.HideBubble();
plot OverSold = over_sold;
    OverSold.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
    OverSold.SetDefaultColor(CreateColor(255,204,153));
    OverSold.SetLineWeight(1);
    OverSold.HideBubble();

# define cross signals
def crossU = slowK crosses above slowD;
def crossD = slowK crosses below slowD;
plot crossUp = crossU;
    crossUp.SetPaintingStrategy(PaintingStrategy.BooleAN_ARROW_UP);
    crossUp.SetDefaultColor(CreateColor(134,202,93));
    crossUp.SetLineWeight(1);
    crossUp.HideBubble();
plot crossDn = crossD;
    crossDn.SetPaintingStrategy(PaintingStrategy.BooleAN_ARROW_DOWN);
    crossDn.SetDefaultColor(CreateColor(232,148,157));
    crossDn.SetLineWeight(1);
    crossDn.HideBubble();

# cloud
DefineGlobalColor("FillColor", CreateColor(160,160,160));
AddCloud(SlowK, SlowD, GlobalColor("FillColor" ));
Re: Fun with ThinkScript
July 08, 2016 08:36PM
mntman Wrote:
-------------------------------------------------------
> for some reason my crossover signal arrows on my
> stochastic are plotting way up above at the price
> values instead of at the stochastic values. would
> anyone be able to recognize where in went wrong in
> my script please? i'd like the arrows to appear
> lower at the stochastic crossover points.
>
>
> declare lower;
> input over_bought = 75;
> input over_sold = 25;
> input KPeriod = 7;
> input DPeriod = 3;
> input priceH = high;
> input priceL = low;
> input priceC = close;
> input averageType = AverageType.Exponential;
>
> # define indicator
> def SlowKd = reference
> StochasticFull(over_bought,over_sold,KPeriod,DPeri
> od,priceH,priceL,priceC,3,averageType).FullK;
> def SlowDd = reference
> StochasticFull(over_bought,over_sold,KPeriod,DPeri
> od,priceH,priceL,priceC,3,averageType).FullD;
> plot SlowK = SlowKd;
> SlowK.SetStyle(Curve.FIRM);
>
> SlowK.setDefaultColor(CreateColor(153,204,255));
> SlowK.SetLineWeight(1);
> plot SlowD = SlowDd;
> SlowD.SetStyle(Curve.Medium_Dash);
>
> SlowD.setDefaultColor(CreateColor(255,153,153));
> SlowD.SetLineWeight(1);
> SlowD.HideBubble();
> plot OverBought = over_bought;
>
> OverBought.SetPaintingStrategy(PaintingStrategy.HO
> RIZONTAL);
>
> OverBought.SetDefaultColor(CreateColor(255,204,153
> ));
> OverBought.SetLineWeight(1);
> OverBought.HideBubble();
> plot OverSold = over_sold;
>
> OverSold.SetPaintingStrategy(PaintingStrategy.HORI
> ZONTAL);
>
> OverSold.SetDefaultColor(CreateColor(255,204,153))
> ;
> OverSold.SetLineWeight(1);
> OverSold.HideBubble();
>
> # define cross signals
> def crossU = slowK crosses above slowD;
> def crossD = slowK crosses below slowD;
> plot crossUp = crossU;
>
> crossUp.SetPaintingStrategy(PaintingStrategy.Boole
> AN_ARROW_UP);
>
> crossUp.SetDefaultColor(CreateColor(134,202,93));
> crossUp.SetLineWeight(1);
> crossUp.HideBubble();
> plot crossDn = crossD;
>
> crossDn.SetPaintingStrategy(PaintingStrategy.Boole
> AN_ARROW_DOWN);
>
> crossDn.SetDefaultColor(CreateColor(232,148,157));
>
> crossDn.SetLineWeight(1);
> crossDn.HideBubble();
>
> # cloud
> DefineGlobalColor("FillColor",
> CreateColor(160,160,160));
> AddCloud(SlowK, SlowD, GlobalColor("FillColor"
> ));
>
> [i.imgur.com]


You have to change them from BOOLEAN arrows to just arrows..... boolean arrows ploy at the price of the chart above.
Re: Fun with ThinkScript
July 08, 2016 09:18PM
Quote
devildriver6
You have to change them from BOOLEAN arrows to just arrows

thanks devildriver6... something like this? however this seems to just plot arrows for every day at value of 0. maybe i need to some how getValue() of the crossover point and then reference it in the plot?

plot crossUp = crossU;
    crossUp.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
    crossUp.SetDefaultColor(CreateColor(134,202,93));
    crossUp.SetLineWeight(1);
    crossUp.HideBubble();
plot crossDn = crossD;
    crossDn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
    crossDn.SetDefaultColor(CreateColor(232,148,157));
    crossDn.SetLineWeight(1);
    crossDn.HideBubble();
Re: Fun with ThinkScript
July 08, 2016 09:27PM
mntman Wrote:
-------------------------------------------------------
> > You have to change them from BOOLEAN arrows to
> just arrows
>
>
> thanks devildriver6... something like this?
> however this seems to just plot arrows for every
> day at value of 0. maybe i need to some how
> getValue() of the crossover point and then
> reference it in the plot?
>
>
> plot crossUp = crossU;
>
> crossUp.SetPaintingStrategy(PaintingStrategy.ARROW
> _UP);
>
> crossUp.SetDefaultColor(CreateColor(134,202,93));
> crossUp.SetLineWeight(1);
> crossUp.HideBubble();
> plot crossDn = crossD;
>
> crossDn.SetPaintingStrategy(PaintingStrategy.ARROW
> _DOWN);
>
> crossDn.SetDefaultColor(CreateColor(232,148,157));
>
> crossDn.SetLineWeight(1);
> crossDn.HideBubble();
>
> [i.imgur.com]


Do the conditions like this.....

def crossU = if slowK crosses above slowD then slowD else double.nan;
def crossD = if slowK crosses below slowD then slowD else double.nan;

This way, you give the level you want the arrow to exist (which is the slowD line itself), or, if you want it offset, put in an input, like this....

Input offset = 5.00;

def crossU = if slowK crosses above slowD then slowD - offset else double.nan;
def crossD = if slowK crosses below slowD then slowD + offset else double.nan;

Something along those lines. You have the cross condition, then a tangible place to place the arrow.

Make sense?
Re: Fun with ThinkScript
July 08, 2016 09:42PM
Quote
devildriver6
You have the cross condition, then a tangible place to place the arrow.

oh! yes makes sense, i gotcha now... thanks dude.. just what i was needing.

Indicator Help-thinkorswim
July 10, 2016 12:08PM
I just had a few questions on indicators that I couldn't find on the thinkorswim help tutorials:

Indicator on a Chart

Shading in between the Bollinger Bands-would I use the Ichimoku cloud for this? If so, how would the formula look and how to edit the formula

Indicator on the Watchlist-monitoring the stock

HOD/LOD-high of day, and low of day in watchlist in real time

ADX of ROC-the ADX (10) with rate of change, also as a side note is the ADX rounded with at least 2 decimal places example instead of 25, it's 25.46 for rate of change to work more effectively
ROC = [(Close - Close n periods ago) / (Close n periods ago)] * 100

Standard Deviation of Volume with this formula
Volume SD=AvgDailyVolume(30)/StDev(30)

If anyone could help out that would be great, thanks
Re: Indicator Help-thinkorswim
July 10, 2016 12:22PM
For the bollinger bands, you could use Robert's script here: [www.researchtrade.com]
Re: Indicator Help-thinkorswim
July 11, 2016 02:30PM
On the bollinger bands I'm actually wanting more shading options such as
.5 SD bands
1 SD bands
2 SD bands

With different shading colors, is this possible? Would I borrow from the I ichimoku cloud shading for this?
Re: Fun with ThinkScript
July 13, 2016 02:18AM
Just wondering if anybody know existing one or can adjust the code for TOS.
It is simple Volume spike analysis study, identifying volume increase based on short, medium and long period of time.
Below is the code in pine script:
study("Volume Spike Analysis [marketsurvivalist]", shorttitle="VSA_MS" )

shortLookback=input(4)
mediumLookback=input(20)
longLookback=input(100)
showMA=input(true)
lengthMA=input(60)

v2 = volume

highestShort = highest(volume, shortLookback)
highestMedium = highest(volume, mediumLookback)
highestLong = highest(volume, longLookback)

c = iff(highestLong == v2, blue, iff(highestMedium == v2, purple, iff(highestShort == v2, red, white)))
    
plot(v2, style=columns, color=c)
plot(showMA?sma(v2, lengthMA):na, color=aqua)
Thank you.
Re: Indicator Help-thinkorswim
July 13, 2016 06:33PM
socialintelligence99 Wrote:
-------------------------------------------------------
> On the bollinger bands I'm actually wanting more
> shading options such as
> .5 SD bands
> 1 SD bands
> 2 SD bands
>
> With different shading colors, is this possible?
> Would I borrow from the I ichimoku cloud shading
> for this?

You need to create 3 sets of inputs and BBs to give each BB a plot value first. Once you visually have 3 sets of BBs, then it's a simple addcloud function like this.....

Addcloud(BBHalf, BBFull, color.light_gray);
** Note, the higher of the 2 should be first, as it reads as such.... addcloud(first value, second value, color if first is above, color if second is above).

As the first value will always be higher than the second, only one color parameter is needed.

Hope that helps.
Re: Fun with ThinkScript
July 13, 2016 06:36PM
LouDiamond Wrote:
-------------------------------------------------------
> I wasn't sure where to ask this question but since
> it has to do with a potential script, guess i'll
> ask here. Is there anyway to customize the Time
> and Sales so that it only shows blocks of 20+
> contracts ? Also would it be possible to change
> the color of an order that was executed above the
> ask or below the bid (assuming it was slippage on
> a market order) ? thanks in advance for any
> answers.

Yeah, on the header for number / qty of contracts, you can filter it to show only > 20.

Not sure about the other.
Re: Fun with ThinkScript
July 14, 2016 04:59AM
-- removed -- sorry, i figured it out.

now i need to figure out if i can "sort" mulitple values and then automatcially have them label from highest to lowest in order.





Edited 1 time(s). Last edit at 07/15/2016 04:43AM by mntman.
Sorry, only registered users may post in this forum.

Click here to login