5/2/23 New Lower Chart Version: https://usethinkscript.com/threads/...art-set-up-for-thinkorswim.13902/#post-124715
mod note: This is a repainting indicator:
https://usethinkscript.com/threads/answers-to-commonly-asked-questions.6006/#post-57833
16975[/ATTACH]']
This is what my chart looks like. These are the Indicators: The pivot points and arrows are offset so if they line up means probable trend reversal - if they line up with the short/long is probable trend bingo?
AsGood_HighLow_TurningPointArrows:
mod note: This is a repainting indicator:
https://usethinkscript.com/threads/answers-to-commonly-asked-questions.6006/#post-57833
16975[/ATTACH]']
This is what my chart looks like. These are the Indicators: The pivot points and arrows are offset so if they line up means probable trend reversal - if they line up with the short/long is probable trend bingo?
AsGood_HighLow_TurningPointArrows:
Ruby:
##AsGood_HighLowPointPivot_Arrows
def bn = BarNumber();
def na = double.nan;
input length = 7;
def lastBar = HighestAll(if IsNaN(close) then 0 else bn);
def offset = Min(length - 1, lastBar - bn);
input ignore_last_bar = yes;
def ignorelast = if (ignore_last_bar and bn == lastbar) then 0 else 1;
def HighPoint = ignorelast and high > highest(high[1], length - 1) and high == GetValue(highest(high, length), -offset);
def Lowpoint = ignorelast and low < Lowest(low[1], length - 1) and low == GetValue(Lowest(low, length), -offset);
input show_Arrows_on_Highpoints_Lowpoints = yes;
def vert = 0.001;
def prange = highPoint – lowPoint;
def plotHighest = highpoint + prange * .3;
def plotLowest = lowpoint - prange * 3.0;
plot BuyCriteria = if LowPoint then Low else double.NaN ;
plot SellCriteria = if HighPoint then High else double.NaN ;
BuyCriteria.SetPaintingStrategy(PaintingStrategy.ARROW_UP) ;
BuyCriteria.SetDefaultColor(color.WHITE);
BuyCriteria.SetLineWeight(5);
SellCriteria.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN) ;
SellCriteria.SetDefaultColor(color.WHITE);
SellCriteria.SetLineWeight(5);
AGood_TopsBottoms
# Tops \ Bottoms
# Mobius modified
# Modified C.Ricks 12/22/22
input Percent_A_to_C = .1;
input nP = 13;
def AC = Percent_A_to_C / 100;
def h = high;
def l = low;
def bar = BarNumber();
def Ps = 1 + AC;
def Ns = 1 - AC;
def hh = fold j = 1 to nP + 1
with q = 1
while q
do h > GetValue(h, -j);
def PivotH = if (bar > nP and
h == Highest(h, nP) and
hh)
then h
else Double.NaN;
def PH1 = if !isNaN(PivotH)
then h
else PH1[1];
def PH2 = if PH1 != PH1[1]
then PH1[1]
else PH2[1];
def CheckH1 = if between(PH2, PH1 * Ns, PH1 * Ps)
then 1
else 0;
plot PivotHDot = PivotH;
PivotHDot.SetDefaultColor(Color.WHITE);
PivotHDot.SetPaintingStrategy(PaintingStrategy.POINTS);
# Double Bottom
def ll = fold jl = 1 to nP + 1
with ql = 1
while ql
do l < GetValue(low, -jl);
def PivotL = if (bar > nP and
l == Lowest(l, nP) and
ll)
then l
else Double.NaN;
def PL1 = if !isNaN(PivotL)
then l
else PL1[1];
def PL2 = if PL1 != PL1[1]
then PL1[1]
else PL2[1];
def Check1 = if between(PL2, PL1 * Ns, PL1 * Ps)
then 1
else 0;
plot PivotLDot = PivotL;
PivotLDot.SetDefaultColor(Color.White);
PivotLDot.SetPaintingStrategy(PaintingStrategy.POINTS);
# End Code
AsGoodAsItGets_NoArrows (this is with no arrows so as not to compete with above indicators)
# AsGoodAsItGets Indicator without Arrows
#CSR Buy/Sell Arrows with Short/Long Bubbles
#Developed 4-9-22 First Edition 8-23-22 Revised
#No Arrow Edition 1/1/23
declare upper;
input atrreversal = 2.0;
def priceh = MovingAverage(AverageType.EXPONENTIAL, high, 5);
def pricel = MovingAverage(AverageType.EXPONENTIAL, low, 5);
def EIL = ZigZagHighLow("price h" = priceh, "price l" = pricel, "percentage reversal" = .01, "absolute reversal" = .05, "atr length" = 5, "atr reversal" = atrreversal).lastL;
def EIH = ZigZagHighLow("price h" = priceh, "price l" = pricel, "percentage reversal" = .01, "absolute reversal" = .05, "atr length" = 5, "atr reversal" = atrreversal).lastH;
plot signaldown = !isNAN(EIH);
AddChartBubble(SignalDown, high+.05, "Short", Color.white, yes);
plot signalrevBot = !isNaN(EIL);
AddChartBubble(Signalrevbot, low-.08, "Long", Color.white
, no);
input usealerts = yes;
alert(usealerts and signaldown[1] == 1, "Short", alert.bar, sound.ring);
alert(usealerts and signalrevbot[1] == 1, "Long", alert.bar, sound.ring);
AsGoodTrendColorCandles_MTFs
###This ASGoodTrendColorCandles_MTFs Indicator looks back 6 periods on each time frame divided by .5 painting the candle trend Green or Red. I use this as continued verification for my AsGoodAsItGets Long/Short Buy/Sell Indicator since it might repaint and I'm looking for further trend verification.
###Inspiration for this from the TTM_Trend Indicator which is a free indicator on TOS but doesn't provide code.
###Charles Ricks v.1 10/31/22 This indicator automatically address most time frames.
input AGP0 = AggregationPeriod.Min;
input AGP = AggregationPeriod.Five_Min;
input AGP1 = AggregationPeriod.Fifteen_Min;
input AGP2 = AggregationPeriod.Thirty_Min;
input AGP3 = AggregationPeriod.Hour;
input AGP4H = AggregationPeriod.FOUR_Hours;
input AGP4 = AggregationPeriod.DAY;
input AGP5 = AggregationPeriod.Week;
input AGP6 = AggregationPeriod.Month;
input TrendPeriods = 6;
def OP = open(period = AGP);
def HI = high(period = AGP);
def LOW = low(period = AGP);
def Close = close(period = AGP);
def HighestHigh = highest(HI, trendPeriods);
def LowestLow = lowest(LOW, trendPeriods);
def CandleTrend = if ((Close - LowestLow) / (HighestHigh - LowestLow)) > .5
then 1
else 0;
AssignPriceColor(if CandleTrend then color.green else color.red);
def OP0 = open(period = AGP0);
def HI0 = high(period = AGP0);
def LOW0 = low(period = AGP0);
def Close0 = close(period = AGP0);
def HighestHigh0 = highest(HI, trendPeriods);
def LowestLow0 = lowest(LOW, trendPeriods);
def trend0 = if ((Close - LowestLow) / (HighestHigh - LowestLow)) > .5
then 1
else 0;
AssignPriceColor(if CandleTrend then color.green else color.red);
def OP1 = open(period = AGP1);
def HI1 = high(period = AGP1);
def LOW1 = low(period = AGP1);
def Close1 = close(period = AGP1);
def HighestHigh1 = highest(HI, trendPeriods);
def LowestLow1 = lowest(LOW, trendPeriods);
def trend1 = if ((Close - LowestLow) / (HighestHigh - LowestLow)) > .5
then 1
else 0;
AssignPriceColor(if CandleTrend then color.green else color.red);
def OP2 = open(period = AGP2);
def HI2 = high(period = AGP2);
def LOW2 = low(period = AGP2);
def Close2 = close(period = AGP2);
def HighestHigh2 = highest(HI, trendPeriods);
def LowestLow2 = lowest(LOW, trendPeriods);
def trend2 = if ((Close - LowestLow) / (HighestHigh - LowestLow)) > .5
then 1
else 0;
AssignPriceColor(if CandleTrend then color.green else color.red);
def OP3 = open(period = AGP3);
def HI3 = high(period = AGP3);
def LOW3 = low(period = AGP3);
def Close3 = close(period = AGP3);
def HighestHigh3 = highest(HI, trendPeriods);
def LowestLow3 = lowest(LOW, trendPeriods);
def trend3 = if ((Close - LowestLow) / (HighestHigh - LowestLow)) > .5
then 1
else 0;
AssignPriceColor(if CandleTrend then color.green else color.red);
def OP4 = open(period = AGP4);
def HI4 = high(period = AGP4);
def LOW4 = low(period = AGP4);
def Close4 = close(period = AGP4);
def HighestHigh4 = highest(HI, trendPeriods);
def LowestLow4 = lowest(LOW, trendPeriods);
def trend4 = if ((Close - LowestLow) / (HighestHigh - LowestLow)) > .5
then 1
else 0;
AssignPriceColor(if CandleTrend then color.green else color.red);
def OP4H = open(period = AGP4H);
def HI4H = high(period = AGP4H);
def LOW4H = low(period = AGP4H);
def Close4H = close(period = AGP4H);
def HighestHigh4H = highest(HI, trendPeriods);
def LowestLow4H = lowest(LOW, trendPeriods);
def trend4H = if ((Close - LowestLow) / (HighestHigh - LowestLow)) > .5
then 1
else 0;
AssignPriceColor(if CandleTrend then color.green else color.red);
def OP5 = open(period = AGP5);
def HI5 = high(period = AGP5);
def LOW5 = low(period = AGP5);
def Close5 = close(period = AGP5);
def HighestHigh5 = highest(HI, trendPeriods);
def LowestLow5 = lowest(LOW, trendPeriods);
def trend5 = if ((Close - LowestLow) / (HighestHigh - LowestLow)) > .5
then 1
else 0;
AssignPriceColor(if CandleTrend then color.green else color.red);
def OP6 = open(period = AGP6);
def HI6 = high(period = AGP6);
def LOW6 = low(period = AGP6);
def Close6 = close(period = AGP6);
def HighestHigh6 = highest(HI, trendPeriods);
def LowestLow6 = lowest(LOW, trendPeriods);
def trend6 = if ((Close - LowestLow) / (HighestHigh - LowestLow)) > .5
then 1
else 0;
AssignPriceColor(if CandleTrend then color.green else color.red);
###End
Attachments
Last edited by a moderator: