Re: ZigZag Scan February 22, 2015 12:13PM |
Registered: 10 years ago Posts: 615 |
Quote
stefonk
Thanks very much but apparently it didn't work.
Re: ZigZag Scan February 22, 2015 12:38PM |
Registered: 9 years ago Posts: 11 |
Re: Fun with ThinkScript February 22, 2015 03:28PM |
Registered: 9 years ago Posts: 67 |
declare upper; input price1 = close; input length1 = 8; input displace1 = 0; plot SMA1 = Average(price1[-displace1], length1); SMA1.SetDefaultColor(GetColor(4)); SMA1.SetLineWeight(2); SMA1.SetStyle(Curve.FIRM); SMA1.DefineColor("Up", GetColor(6)); SMA1.DefineColor("Down", GetColor(5)); SMA1.AssignValueColor(if SMA1 > SMA1[1] then SMA1.color("Up" ) else SMA1.color("Down" )); input price2 = close; input length2 = 20; input displace2 = 0; plot SMA2 = Average(price2[-displace2], length2); SMA2.SetDefaultColor(GetColor(1)); SMA2.SetLineWeight(1); SMA2.SetStyle(Curve.FIRM); input price3 = close; input length3 = 50; input displace3 = 0; plot SMA3 = Average(price3[-displace3], length3); SMA3.SetDefaultColor(GetColor(2)); SMA3.SetLineWeight(1); SMA3.SetStyle(Curve.FIRM); input price4 = close; input length4 = 100; input displace4 = 0; plot SMA4 = Average(price4[-displace4], length4); SMA4.SetDefaultColor(GetColor(5)); SMA4.SetLineWeight(2); SMA4.SetStyle(Curve.SHORT_DASH); input price5 = close; input length5 = 200; input displace5 = 0; plot SMA5 = Average(price5[-displace5], length5); SMA5.SetDefaultColor(GetColor(5)); SMA5.SetLineWeight(2); SMA5.SetStyle(Curve.LONG_DASH);
Re: Fun with ThinkScript February 22, 2015 05:56PM |
Registered: 10 years ago Posts: 143 |
Re: Fun with ThinkScript February 23, 2015 05:24AM |
Registered: 12 years ago Posts: 373 |
Re: Fun with ThinkScript February 24, 2015 05:52PM |
Registered: 9 years ago Posts: 67 |
declare upper; input price1 = close; input length1 = 8; input displace1 = 0; input averageType1 = AverageType.SIMPLE; input price2 = close; input length2 = 20; input displace2 = 0; input averageType2 = AverageType.SIMPLE; input price3 = close; input length3 = 50; input displace3 = 0; input averageType3 = AverageType.SIMPLE; input price4 = close; input length4 = 100; input displace4 = 0; input averageType4 = AverageType.SIMPLE; input price5 = close; input length5 = 200; input displace5 = 0; input averageType5 = AverageType.SIMPLE; plot MA1 = MovingAverage(averageType1, price1[-displace1], length1); MA1.SetDefaultColor(GetColor(4)); MA1.SetLineWeight(2); MA1.SetStyle(Curve.FIRM); MA1.DefineColor("Up", GetColor(6)); MA1.DefineColor("Down", GetColor(5)); MA1.AssignValueColor(if MA1 > MA1[1] then MA1.color("Up" ) else MA1.color("Down" )); plot MA2 = MovingAverage(averageType2, price2[-displace2], length2); MA2.SetDefaultColor(GetColor(1)); MA2.SetLineWeight(1); MA2.SetStyle(Curve.FIRM); plot MA3 = MovingAverage(averageType3, price3[-displace3], length3); MA3.SetDefaultColor(GetColor(2)); MA3.SetLineWeight(1); MA3.SetStyle(Curve.FIRM); plot MA4 = MovingAverage(averageType4, price4[-displace4], length4); MA4.SetDefaultColor(GetColor(5)); MA4.SetLineWeight(2); MA4.SetStyle(Curve.SHORT_DASH); plot MA5 = MovingAverage(averageType5, price5[-displace5], length5); MA5.SetDefaultColor(GetColor(5)); MA5.SetLineWeight(2); MA5.SetStyle(Curve.LONG_DASH);
Quote
I think the lookback is associated with longest SMA length, in this case 200 bars, so charts with fewer than 200 bars will be drawn without any SMAs.
Re: Fun with ThinkScript February 25, 2015 08:58AM |
Registered: 10 years ago Posts: 615 |
Quote
netarchitech
I further thought this may have been a problem with the original code, but it is happening with new code as well. I'm stumped and hoping someone might have an insight or solution to this dilemma...
Any thoughts?
Re: Fun with ThinkScript February 25, 2015 11:12PM |
Registered: 9 years ago Posts: 67 |
Re: Fun with ThinkScript February 26, 2015 02:03PM |
Registered: 9 years ago Posts: 11 |
Re: Fun with ThinkScript February 26, 2015 03:28PM |
Registered: 10 years ago Posts: 615 |
Re: Fun with ThinkScript February 26, 2015 04:04PM |
Registered: 9 years ago Posts: 11 |
Re: Fun with ThinkScript February 26, 2015 09:32PM |
Registered: 9 years ago Posts: 3 |
Re: Fun with ThinkScript February 26, 2015 09:58PM |
Registered: 9 years ago Posts: 3 |
Re: Fun with ThinkScript February 28, 2015 05:02PM |
Registered: 10 years ago Posts: 615 |
Quote
stefonk
So how can I display the Heiken Ashi Chart on the lower study.
declare lower; def o = open; def h = high; def l = low; def c = close; def HAclose = ohlc4; def HAopen = CompoundValue(1, (HAopen[1] + HAclose[1]) / 2, (o[1] + c[1]) / 2); def haopen_ = HAopen + 0; def HAhigh = Max(Max(h, HAopen), HAclose); def HAlow = Min(Min(l, HAopen), HAclose); AddChart(fallcolor = color.black, high = HAhigh, low = HAlow, open = haopen_, close = HAclose, type = ChartType.CANDLE);
plot line = haopen_; line.assignvalueColor(if haopen_ > haopen_[1] then color.green else color.red);
addcloud(haopen_, haclose, color.downtick, color.uptick);
declare lower; def o = open; def h = high; def l = low; def c = close; def HAclose = ohlc4; def HAopen = CompoundValue(1, (HAopen[1] + HAclose[1]) / 2, (o[1] + c[1]) / 2); def haopen_ = HAopen + 0; def HAhigh = Max(Max(h, HAopen), HAclose); def HAlow = Min(Min(l, HAopen), HAclose); def openmod = if haopen > haclose then haclose else haopen; def closemod = if haopen > haclose then haopen else haclose; AddChart(fallcolor = color.black, high = HAhigh, low = HAlow, open = openmod, close = closemod, type = ChartType.CANDLE); addcloud(haopen_, haclose, color.downtick, color.uptick);
Re: Fun with ThinkScript February 28, 2015 05:18PM |
Registered: 10 years ago Posts: 615 |
Quote
afoxperson
I found the code for a heikin ashi smoothed indicator in a forum (can't remember which) and apparently a recent update made it so the price bars were all one color. There was an addChart operator (i think) that didn't work anymore and mentioned previously in the tread, and I've actually lost a bit of code trying to do a fix myself (only dealing with color). If possible I'd like them to be red and green, and even better would be the ability to see a lighter version of actual price action candlesticks behind it (however that might work, I have no idea).
Re: Fun with ThinkScript February 28, 2015 05:43PM |
Registered: 9 years ago Posts: 11 |
Re: Fun with ThinkScript March 04, 2015 04:24AM |
Registered: 9 years ago Posts: 60 |
Re: Fun with ThinkScript March 04, 2015 07:22AM |
Registered: 10 years ago Posts: 615 |
Quote
Sara
Does any one know what is that Indicator in this pic !!? it looks great thumbs up
Re: Fun with ThinkScript March 04, 2015 10:33AM |
Registered: 10 years ago Posts: 63 |
Re: Fun with ThinkScript March 04, 2015 03:21PM |
Registered: 9 years ago Posts: 3 |
Re: Fun with ThinkScript March 04, 2015 03:31PM |
Registered: 13 years ago Posts: 216 |
Re: Fun with ThinkScript March 05, 2015 07:56AM |
Registered: 9 years ago Posts: 2 |
Re: Fun with ThinkScript March 05, 2015 08:01AM |
Registered: 9 years ago Posts: 2 |
Re: Fun with ThinkScript March 05, 2015 09:03AM |
Registered: 10 years ago Posts: 615 |
Quote
jackhenryb
Hi! I'm pretty new to using ThinkScript but I'm trying to enter all of Gary's indecators but am I just missing how to enter them correctly? I have the indecators from the 1-5 class. But they don't seem to enter correctly when I plug them in. Any help would be appreciated.
Re: Fun with ThinkScript March 05, 2015 02:58PM |
Registered: 9 years ago Posts: 2 |
Re: Fun with ThinkScript March 05, 2015 07:42PM |
Registered: 10 years ago Posts: 615 |
Quote
isaac
HI all
I'm pretty new to ThinkScript and want to know how can i add a clock (seconds+minutes) countdown for a candle on a chart .
Re: Fun with ThinkScript March 05, 2015 07:51PM |
Registered: 10 years ago Posts: 615 |
# Plot areas of potential support / resistance based on major peaks and valleys. # Changing "magnitude" determines the granularity of detected peaks or valleys. # A low magnitude value will plot minor price swings, while a high magnitude value # will only plot major price swings. # A magnitude value of 2 means that a high must be greater than the 2 candles # before and after it to be considered a peak. Likewise for the lows to be a valley. # # Robert Payne input magnitude = 5; # define and plot the most recent peak def peak = high >= Highest(high[1], magnitude) and high >= Highest(high[-magnitude], magnitude); def peakvalue = if BarNumber() < magnitude then Double.NaN else if peak then high else peakvalue[1]; plot peakline = peakvalue; peakline.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); peakline.SetDefaultColor(Color.GREEN); # extend the current peak line to the right edge of the chart def countp = if IsNaN(peak) and !IsNaN(peak[1]) then 1 else countp[1] + 1; plot peakext = if IsNaN(peak) then GetValue(peakline, countp) else Double.NaN; peakext.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); peakext.SetDefaultColor(Color.GREEN); # continue the previous peak as a dashed line def oldpeak = if BarNumber() < magnitude then Double.NaN else if peak then peakvalue[1] else oldpeak[1]; plot oldpeakline = oldpeak; oldpeakline.SetPaintingStrategy(PaintingStrategy.DASHES); oldpeakline.SetDefaultColor(Color.GREEN); # define and plot the most recent valley def valley = low <= Lowest(low[1], magnitude) and low <= Lowest(low[-magnitude], magnitude); def valleyValue = if BarNumber() < magnitude then Double.NaN else if valley then low else valleyValue[1]; plot valleyline = valleyValue; valleyline.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); valleyline.SetDefaultColor(Color.PINK); # extend the current valley line to the right edge of the chart def countt = if IsNaN(valley) and !IsNaN(valley[1]) then 1 else countt[1] + 1; plot valleyext = if IsNaN(valley) then GetValue(valleyline, countt) else Double.NaN; valleyext.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); valleyext.SetDefaultColor(Color.PINK); # continue the previous valley as a dashed line def oldvalley = if BarNumber() < magnitude then Double.NaN else if valley then valleyValue[1] else oldvalley[1]; plot oldvalleyline = oldvalley; oldvalleyline.SetPaintingStrategy(PaintingStrategy.DASHES); oldvalleyline.SetDefaultColor(Color.PINK);
Re: Fun with ThinkScript March 05, 2015 08:48PM |
Registered: 12 years ago Posts: 321 |
Re: Fun with ThinkScript March 05, 2015 09:06PM |
Registered: 10 years ago Posts: 615 |
Re: Fun with ThinkScript March 06, 2015 02:09AM |
Registered: 9 years ago Posts: 7 |