Re: Fun with ThinkScript May 21, 2014 02:45PM |
Registered: 9 years ago Posts: 78 |
Re: Fun with ThinkScript May 22, 2014 09:13AM |
Registered: 9 years ago Posts: 10 |
Re: Fun with ThinkScript May 23, 2014 07:48AM |
Registered: 9 years ago Posts: 78 |
Re: Fun with ThinkScript May 24, 2014 09:15AM |
Registered: 11 years ago Posts: 41 |
Re: Fun with ThinkScript May 24, 2014 05:57PM |
Registered: 10 years ago Posts: 615 |
Quote
mkaltenborn
I've learned quite a bit reading your code Robert. There is a nagging feeling in my head that I(we) should be paying you.
Quote
mkaltenborn
There are other things that I watch that would be easier to read when trying to make snap decisions. I like the AddLabel functionality. I've been using your TheEdge code.
1) I watch $ADVN-$DECN on a chart. Is it possible to have a label that indicates the trend of this indicator?
2) I watch $TICK on a chart looking for extremes of +800 and -800
3) I watch TRAN on a chart. Is it possible to have a label that indicates the trend of this indicator?
4) I watch XLF on a chart. Is it possible to have a label that indicates the trend of this indicator?
# $ADVN - $DECN input AD_Trend_Length = 1; def AD = close("$ADVN" ) - close("$DECN" ); def ADtrend = Average(AD[1], 1); AddLabel(AD > ADtrend, "A/D: " + Round(AD, 2), Color.GREEN); AddLabel(AD <= ADtrend, "A/D: " + Round(AD, 2), Color.PINK); # $TICK def tick = close("$TICK" ); def overbought = tick > 800; def oversold = tick < -800; AddLabel(overbought, "$TICK: " + Round(tick, 2), Color.PINK); AddLabel(oversold, "$TICK: " + Round(tick, 2), Color.GREEN); AddLabel(!overbought and !oversold, "$TICK: " + Round(tick, 2), Color.LIGHT_GRAY); # TRAN input TRAN_Trend_Length = 1; def TRAN = close("TRAN" ); def TRANtrend = Average(TRAN[1], 1); AddLabel(TRAN > TRANtrend, "TRAN: " + Round(TRAN, 2), Color.GREEN); AddLabel(TRAN <= TRANtrend, "TRAN: " + Round(TRAN, 2), Color.PINK); # XLF input XLF_Trend_Length = 1; def XLF = close("XLF" ); def XLFtrend = Average(XLF[1], 1); AddLabel(XLF > XLFtrend, "XLF: " + Round(XLF, 2), Color.GREEN); AddLabel(XLF <= XLFtrend, "XLF: " + Round(XLF, 2), Color.PINK);
Re: Fun with ThinkScript May 24, 2014 06:03PM |
Registered: 10 years ago Posts: 615 |
Re: Fun with ThinkScript May 24, 2014 06:24PM |
Registered: 9 years ago Posts: 10 |
Re: Fun with ThinkScript May 24, 2014 06:32PM |
Registered: 10 years ago Posts: 615 |
Quote
linter
robert: thanks again for all you do. now, could you help me modify this script? the only part of it I use is the show-ADX label business, but i'd like to add to it, if possible:
1 / make the color turn from green to red once the ADX crosses beneath 20 (variable) and again to green when it goes back above.
2/ put two arrows next to it. arrow one would be up or down (and green or red) depending on whether ADX is up or down re the previous bar. arrow two would behave the same way except that it would be in relation to a user-set number of previous bars -- ie, 2 or 3 or whatever.
input ADX_length = 14; input LookBack = 3; def ADX = DMI(ADX_length).ADX; # ADX label AddLabel(ADX > 20, "ADX: " + Round(ADX, 2), Color.GREEN); AddLabel(ADX < 20, "ADX: " + Round(ADX, 2), Color.PINK); # Compare ADX to previous value AddLabel(ADX > ADX[1], " ⇑ ", Color.GREEN); AddLabel(ADX < ADX[1], " ⇓ ", Color.PINK); # Compare ADX to previous X bars AddLabel(ADX > Highest(ADX[1], LookBack), " ⇑ ", Color.GREEN); AddLabel(ADX < Lowest(ADX[1], LookBack), " ⇓ ", Color.PINK);
Re: Fun with ThinkScript May 24, 2014 06:47PM |
Registered: 10 years ago Posts: 615 |
Re: Fun with ThinkScript May 24, 2014 08:22PM |
Registered: 10 years ago Posts: 143 |
Re: Fun with ThinkScript May 24, 2014 09:35PM |
Registered: 10 years ago Posts: 615 |
Quote
tanman
Reference the ADX code you wrote for linter, how can it be modified to show the 60 minute ADX while on a shorter time frame chart? You don't have to write the full code again but just the def ADX part and I'll modify the rest. Thanks!
input ADX_length = 14; def agg = AggregationPeriod.HOUR; def data = close(period = agg); def hiDiff = high(period = agg) - high(period = agg)[1]; def loDiff = low(period = agg)[1] - low(period = agg); def plusDM = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0; def minusDM = if loDiff > hiDiff and loDiff > 0 then loDiff else 0; def ATR = WildersAverage(TrueRange(high(period = agg), close(period = agg), low(period = agg)), ADX_length); def "DI+" = 100 * WildersAverage(plusDM, ADX_length) / ATR; def "DI-" = 100 * WildersAverage(minusDM, ADX_length) / ATR; def DX = if ("DI+" + "DI-" > 0) then 100 * AbsValue("DI+" - "DI-" ) / ("DI+" + "DI-" ) else 0; def ADX = WildersAverage(DX, ADX_length);
Re: Fun with ThinkScript May 25, 2014 07:00AM |
Registered: 9 years ago Posts: 78 |
Re: Fun with ThinkScript May 25, 2014 01:36PM |
Registered: 9 years ago Posts: 78 |
Re: Fun with ThinkScript May 25, 2014 05:48PM |
Registered: 9 years ago Posts: 10 |
Re: Fun with ThinkScript May 25, 2014 07:40PM |
Registered: 9 years ago Posts: 78 |
Re: Fun with ThinkScript May 26, 2014 12:47PM |
Registered: 11 years ago Posts: 41 |
Re: Fun with ThinkScript May 26, 2014 01:32PM |
Registered: 10 years ago Posts: 143 |
Re: Fun with ThinkScript May 26, 2014 05:43PM |
Registered: 10 years ago Posts: 615 |
Quote
tanman
Is def data necessary because I didn't see "data" used in the rest of code or maybe I'm missing something?
Re: Fun with ThinkScript June 01, 2014 03:42AM |
Registered: 9 years ago Posts: 9 |
Re: Fun with ThinkScript June 01, 2014 07:46PM |
Registered: 9 years ago Posts: 9 |
Re: Fun with ThinkScript June 02, 2014 08:20AM |
Registered: 10 years ago Posts: 615 |
Quote
wiineedmore
I don't even know half of the stuff you guys are talking about lol, I basically deal with Binary Options...
Quote
wiineedmore
Does any of these indicators have alerts and color change when a new and low is hit for the day?
def dayHigh = if GetDay() != GetDay()[1] then high else if high > dayHigh[1] then high else high[1]; def dayLow = if GetDay() != GetDay()[1] then low else if low < dayLow[1] then low else low[1]; AssignBackgroundColor(if high > dayHigh[1] then CreateColor(213, 237, 198) else if low < dayLow[1] then CreateColor(253, 210, 210) else Color.CURRENT); Alert(high > dayHigh[1], Concat(GetSymbolPart(), " has a new intraday high." ), Alert.BAR, Sound.Ring); Alert(low < dayLow[1], Concat(GetSymbolPart(), " has a new intraday low." ), Alert.BAR, Sound.Ring);
Re: Fun with ThinkScript June 04, 2014 03:37PM |
Registered: 10 years ago Posts: 143 |
Re: Fun with ThinkScript June 04, 2014 03:58PM |
Registered: 10 years ago Posts: 615 |
Re: Fun with ThinkScript June 04, 2014 04:17PM |
Registered: 10 years ago Posts: 143 |
Re: Fun with ThinkScript June 04, 2014 04:20PM |
Registered: 10 years ago Posts: 615 |
Re: Fun with ThinkScript June 04, 2014 05:03PM |
Registered: 10 years ago Posts: 143 |
Re: Fun with ThinkScript June 05, 2014 06:59AM |
Registered: 10 years ago Posts: 615 |
Re: Fun with ThinkScript June 05, 2014 04:51PM |
Registered: 10 years ago Posts: 615 |
Re: Fun with ThinkScript June 05, 2014 07:59PM |
Registered: 10 years ago Posts: 17 |
Re: Fun with ThinkScript June 06, 2014 03:06PM |
Registered: 9 years ago Posts: 78 |