Repaints AGAIG Day Trading Chart Set-up For ThinkOrSwim

Repaints

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Hi @csricksdds...How to make the buy/sell label accurate? it seems not getting align with the label indicated..Thanks

AddLabel(yes, " L ", if SignalrevBot[1] == 1 then Color.green else Color.black);
AddLabel(yes, " S ", if signaldown[1] == 1 then Color.red else Color.black);
 
Thanks for your comments. As stated in previous posts my trading is geared towards the SPY (occasionally the QQQ's) and my indicators have been put together, and/or modified, to help increase the probability for success trading those two ETFs. For years I traded the market at large but find the SPY more profitable with less stress on a daily basis. I'm well aware of the repainting issue and only share these indicators in the hope they can be of benefit and/or help raise the probability for success with anyone else.

We moved to The Villages, FL nine years ago (large retirement community) and have found that a Senior Citizen with their left turn signal indicator on has very little to do with whether they actually turn left or not? The probabilities get better if they also slow down and move towards the left lane although I have seen right turns from there as well.

My AGAIG indicators have helped me raise the probability for personal success. When two or three give the same trend change indication is where my trades are placed, or exited. If the market decides something different than indicated I immediately exit the trade. It has been my experience that my AGAIG indicators are much more accurate than what I personally think the market might do!

Since the SPY now has daily expirations my preference is trading the ORB, and trends, until about noon. Past experience tells me that It's easy to make money in the morning and give it all back in the afternoon.

Suggestions on how to improve, or set better parameters, on my AGAIG indicators is always appreciate

Thank you for sharing your indicator. I really like the name too. I’m fairly new to options trading but took the leap to being full time trader and immerse. It’s been a tough journey but finally reached my daily trading profit goals consistently. My next goal is to have the option to trade from my watch. Your indicator fits my day trading setup and grateful for it. Right now, I combine your indicator with golden cross, vwap, pivot trend reversal indicator alerts that monitor and ocr screenshots of the charts and message center gadget window which feed into a custom dashboard excel spreadsheet so I can calculate my entry and exit point and automate my mouse and keyboard actions up to the point to when I do the “submit” of the entry/exit trade. I use ntfy to send custom push notifications to my desktop phone and watch. I’m 90% towards my goal. I seem to get the best results when I see less charts and more number data that I can find patterns then automate using 3rd party tools. I’m not a coder but can integrate tools. That’s why I like your lower indicator and how it displays just a line. Less is not more. Less is better. Thank you again.

/OG
from Texas

Questions:
1. Why and how did you choose the ZigZag formula for AGAIG? How long did it take you?
2. After watching repainting in real-time during live and back dates, I now have a feel of the ones that will and will not repaint and more often I’m right but cant seem to quantify that feeling. Any suggestions? I look forward to repainting signals as it give me a chance to do this.
3. What personal benefits have you had with VIP membership? The cost is still a lot to me and was curious on your view.
 
Last edited by a moderator:
Thank you for sharing your indicator. I really like the name too. I’m fairly new to options trading but took the leap to being full time trader and immerse. It’s been a tough journey but finally reached my daily trading profit goals consistently. My next goal is to have the option to trade from my watch. Your indicator fits my day trading setup and grateful for it. Right now, I combine your indicator with golden cross, vwap, pivot trend reversal indicator alerts that monitor and ocr screenshots of the charts and message center gadget window which feed into a custom dashboard excel spreadsheet so I can calculate my entry and exit point and automate my mouse and keyboard actions up to the point to when I do the “submit” of the entry/exit trade. I use ntfy to send custom push notifications to my desktop phone and watch. I’m 90% towards my goal. I seem to get the best results when I see less charts and more number data that I can find patterns then automate using 3rd party tools. I’m not a coder but can integrate tools. That’s why I like your lower indicator and how it displays just a line. Less is not more. Less is better. Thank you again.

/OG
from Texas

Questions:
1. Why and how did you choose the ZigZag formula for AGAIG? How long did it take you?
2. After watching repainting in real-time during live and back dates, I now have a feel of the ones that will and will not repaint and more often I’m right but cant seem to quantify that feeling. Any suggestions? I look forward to repainting signals as it give me a chance to do this.
3. What personal benefits have you had with VIP membership? The cost is still a lot to me and was curious on your view.
Why the ZigZag...it fit my indicator and is a good tool for reversals? There is a lot of discussion around repaint/doesn't repaint. To me a repaint does show transitions in the market...an indicator that does not repaint isn't as sensitive to these changes (at least in my thinking I don't want something static when the market is constantly changing and not static). Life repaints and so does the market. Unless one has enough money to move the market in the direction they choose, we are subject to the market as it chooses to go, which is why I like multiple indicators suggesting direction and price movement.

I took a course in ThinkScript but certainly not an expert. It takes me hours, and sometimes days, to do scripting (which hopefully keeps my aging brain active and functioning).

As far as VIP membership... I like the added thought that goes into those indicators. I use a separate screen to input EVERY indicator that is shown in useThinkScript to determine if I like and want to use, and or modify, to suit my purposes (retirement has allowed me that ability). UseThinkScript has been one of the best sites I have found in my many years of trading and I enjoy the thoughts and opinions expressed by others.
 
Hi @csricksdds
For some reason the long code for the HighLoPivotPoints does not work when I paste it in my ToS. Do you have share chart link with the indicators that you use? Thanks
Should work - I can't send my chart as it has other proprietary indicators on it - here is the HiLo code turning point arrows:


##AsGood_HighLowPointPivot_Arrows
def bn = BarNumber();
def na = double.nan;

input length = 15;
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);
 
Hi @csricksdds... I like your indicator so far on the daily chart. However, I have a strange problem. The SPX has been up 5 days in a row now but the indicator never displayed in Up Arrow on July 10th or 11th. Would you happen to know why? Much obliged!

1689344807605.png
 
Hi @csricksdds... I like your indicator so far on the daily chart. However, I have a strange problem. The SPX has been up 5 days in a row now but the indicator never displayed in Up Arrow on July 10th or 11th. Would you happen to know why? Much obliged!

View attachment 19148
The input length is 15 so it will show highest/lowest last 15 day (or bars if you set for lower time frame). I currently trade a 3min chart so things show differently -
 
I took a course in ThinkScript but certainly not an expert. It takes me hours, and sometimes days, to do scripting (which hopefully keeps my aging brain active and functioning).
@csricksdds per your comment above, could you link, and share what course in ThinkScript you did take, if it is currently available. I would be grateful, Best Wishes, MagicQuotes. Sounds like we have a good deal in common regards any coding we undertake. I am totally autodidactic and isolated. With appreciation Magicquotes:)
 
@csricksdds per your comment above, could you link, and share what course in ThinkScript you did take, if it is currently available. I would be grateful, Best Wishes, MagicQuotes. Sounds like we have a good deal in common regards any coding we undertake. I am totally autodidactic and isolated. With appreciation Magicquotes:)
I took the course from thinkscripter.com (I don't think site still works). Eric Purdy from SimplerTrading taught the course but it is no longer in their store. You might email them and see if they can get it for you. I lost it when my hard drive crashed two years ago.
 
AsGood_HighLowPointPivot_Arrows
Code:
##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);

Tops \ Bottoms

Code:
# 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

Code:
# 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 Indicator without Arrows
Code:
# 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

Code:
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);
I placed this on a 1 min chart and nothing is showing up. Can you show a screenshot of what it should look like please?
 
I placed this on a 1 min chart and nothing is showing up. Can you show a screenshot of what it should look like please?
It looks like you have combined multiple indicators without ## separations? Here is the combined codes (and they do show on the 1 min):

##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);

#Tops \ Bottoms

# 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

# 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 Indicator without Arrows
# 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

#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);
 
AsGood_HighLowPointPivot_Arrows
Code:
##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);

Tops \ Bottoms

Code:
# 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

Code:
# 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 Indicator without Arrows
Code:
# 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

Code:
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);

I use a 1 minute and 5 minute charts for day trading. Open your "Added studies and strategies" (beaker on chart view to left of time drop down and wheel then beaker. Click on beaker. Your studies will drop down. Click on wheel to right of study and change np to 9 on Top/Bottoms Indicator.

Same process on TurningPointArrows and set length to 15.

You can set these parameters how you wish...these are the settings I use.
@csricksdds[/USER], is there a delay on Top/Bottoms Indicator? Does it appear after so many bars? The other two indicators appear to be in real time. Thanks
 
Hello. This indicator overall doesn't seem to be working on TOS Mobile for me. Is this just for the desktop version? TIA
 
Several of you have used my AsGoodAsItGets indicator. This is a new version for the lower. It uses a Squared.Histogram to show Short/Long Entries. I use it above the Modified Laguerre_Momentum posted a few minutes ago (Remember this repaints)!

Here is the code:

# AsGoodAsItGets Lower Indicator
#CSR Buy/Sell Arrows with Short/Long Bubbles
#Developed 4-23-23 First Edition 8-23-22 Revised

declare lower;

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);
signaldown.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);


plot signalrevBot = !isNaN(EIL);

Signalrevbot.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);



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);
Sorry but neither the older upper and the newer lower, both come up red and don't work. I've been installing code on tos for many years and I can't see anything I'm doing wrong. What say?
 
Sorry but neither the older upper and the newer lower, both come up red and don't work. I've been installing code on tos for many years and I can't see anything I'm doing wrong. What say?
Go to your indicator dropdown beaker - right click on the wheel at the end of the indicator - and color your plots - signaldown, numerical, draw as block and color red. Then signalrevBot, numerical, draw as block and color Green. If problems let me know?
 
Go to your indicator dropdown beaker - right click on the wheel at the end of the indicator - and color your plots - signaldown, numerical, draw as block and color red. Then signalrevBot, numerical, draw as block and color Green. If problems let me know?
Or try this code and see if it works:

# AsGoodAsItGets Lower Indicator
#CSR Buy/Sell Arrows with Short/Long Bubbles
#Developed 4-23-23 First Edition 8-23-22 Revised

declare lower;

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);
signaldown.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
signaldown.DefineColor("signaldown", Color.Red);


plot signalrevBot = !isNaN(EIL);

Signalrevbot.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
signalrevBot.DefineColor("signalrevBot", Color.GREEN);



input usealerts = yes;
alert(usealerts and signaldown[1] == 1, "Short", alert.bar, sound.ding);
alert(usealerts and signalrevbot[1] == 1, "Long", alert.bar, sound.ding);
 
Or try this code and see if it works:

# AsGoodAsItGets Lower Indicator
#CSR Buy/Sell Arrows with Short/Long Bubbles
#Developed 4-23-23 First Edition 8-23-22 Revised

declare lower;

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);
signaldown.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
signaldown.DefineColor("signaldown", Color.Red);


plot signalrevBot = !isNaN(EIL);

Signalrevbot.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
signalrevBot.DefineColor("signalrevBot", Color.GREEN);



input usealerts = yes;
alert(usealerts and signaldown[1] == 1, "Short", alert.bar, sound.ding);
alert(usealerts and signalrevbot[1] == 1, "Long", alert.bar, sound.ding);
Just WOW, the recommended lower version worked, and it does look As Good As it Gets. Thank you. I will try to make the upper work now.
 

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
350 Online
Create Post

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top