Re: Fun with ThinkScript June 16, 2016 07:42AM |
Registered: 7 years ago Posts: 63 |
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.
Re: Fun with ThinkScript June 16, 2016 03:15PM |
Registered: 7 years ago Posts: 1 |
Re: Fun with ThinkScript June 17, 2016 12:24AM |
Registered: 7 years ago Posts: 1 |
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" else Color.CURRENT);
AssignPriceColor(if BBlower > KClower then BBlower.Color("sqz" else Color.CURRENT);
Re: Fun with ThinkScript June 17, 2016 01:03PM |
Registered: 8 years ago Posts: 7 |
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" ));
TOS Problem with Scan - Help? June 20, 2016 08:34PM |
Registered: 7 years ago Posts: 1 |
Re: Fun with ThinkScript June 25, 2016 03:05AM |
Registered: 7 years ago Posts: 1 |
Re: Fun with ThinkScript June 25, 2016 05:40AM |
Registered: 10 years ago Posts: 615 |
Quote
JN
Hi Bob,
Can upcoming earnings date be plotted by this script?
Regards,
JN
Re: Fun with ThinkScript June 25, 2016 03:22PM |
Registered: 7 years ago Posts: 63 |
Re: Fun with ThinkScript June 25, 2016 08:22PM |
Registered: 7 years ago Posts: 1 |
Re: Fun with ThinkScript July 01, 2016 01:39PM |
Registered: 9 years ago Posts: 53 |
Re: Fun with ThinkScript July 05, 2016 03:57AM |
Registered: 7 years ago Posts: 6 |
Re: Fun with ThinkScript July 05, 2016 04:27PM |
Registered: 8 years ago Posts: 54 |
Re: Fun with ThinkScript July 05, 2016 07:02PM |
Registered: 7 years ago Posts: 6 |
Re: Fun with ThinkScript July 05, 2016 07:14PM |
Registered: 8 years ago Posts: 54 |
Re: Fun with ThinkScript July 06, 2016 04:48AM |
Registered: 7 years ago Posts: 6 |
Re: Fun with ThinkScript July 06, 2016 06:10AM |
Registered: 10 years ago Posts: 615 |
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
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);
Re: Fun with ThinkScript July 06, 2016 07:10AM |
Registered: 7 years ago Posts: 6 |
Re: Fun with ThinkScript July 07, 2016 04:27PM |
Registered: 7 years ago Posts: 1 |
Re: Fun with ThinkScript July 08, 2016 08:31PM |
Registered: 7 years ago Posts: 63 |
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 |
Registered: 8 years ago Posts: 54 |
Re: Fun with ThinkScript July 08, 2016 09:18PM |
Registered: 7 years ago Posts: 63 |
Quote
devildriver6
You have to change them from BOOLEAN arrows to just arrows
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 |
Registered: 8 years ago Posts: 54 |
Re: Fun with ThinkScript July 08, 2016 09:42PM |
Registered: 7 years ago Posts: 63 |
Indicator Help-thinkorswim July 10, 2016 12:08PM |
Registered: 8 years ago Posts: 4 |
Re: Indicator Help-thinkorswim July 10, 2016 12:22PM |
Registered: 10 years ago Posts: 35 |
Re: Indicator Help-thinkorswim July 11, 2016 02:30PM |
Registered: 8 years ago Posts: 4 |
Re: Fun with ThinkScript July 13, 2016 02:18AM |
Registered: 7 years ago Posts: 6 |
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 |
Registered: 8 years ago Posts: 54 |
Re: Fun with ThinkScript July 13, 2016 06:36PM |
Registered: 8 years ago Posts: 54 |
Re: Fun with ThinkScript July 14, 2016 04:59AM |
Registered: 7 years ago Posts: 63 |