Repaints AGAIG Day Trading Chart Set-up For ThinkOrSwim

Repaints
Since you sent no picture I'm not sure...but if headers and not part of indicator place a # before each one and see if it clears things up??
Invalid statement: AGood_TopsBottoms at 33:1
Invalid statement: AsGoodAsItGets_No... at 110:1
Invalid statement: AsGoodTrendColorC... at 140:1

33 AGood_TopsBottoms
34 # Tops \ Bottoms
35 # Mobius modified
36 # Modified C.Ricks 12/22/22
37
38 input Percent_A_to_C = .1;
39 input nP = 13;

line 33 and 38 are highlighted in red. Same with lines 110 and 140.
Sorry I tried to use Tiny Take for screenshot but it wouldnt paste here.
new but I'll figure out how to share properly.

When I added the # to the front of each line, it went through fine.
 

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

It seems ASAIG wil paint a an up arrow at every bottom or down arrow at every top and keep repainting until its correct. Is there a way to lessen the frequency of it constantly repainting?
 
@TDTOS I swing trade and use this on 5 and 15 minute charts with good results but lower time frames are more open to repainting from shake out volatility even the 5 minute gives false signals on occasions.
 
It seems ASAIG wil paint a an up arrow at every bottom or down arrow at every top and keep repainting until its correct. Is there a way to lessen the frequency of it constantly repainting?
Since I use other arrows and don't want duplicates, here is AGAIGs 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+.15, "Short", Color.white, yes);

plot signalrevBot = !isNaN(EIL);

AddChartBubble(Signalrevbot, low-.15, "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);
 
Hey there thanks for your indicators still trying to get use to them. Question I noticed the Tops and Bottoms don't paint in realtime is that just my system or is it just the behavior of the indicator. I on the one min chart.
 
Hey there thanks for your indicators still trying to get use to them. Question I noticed the Tops and Bottoms don't paint in realtime is that just my system or is it just the behavior of the indicator. I on the one min chart.
I have the pinot number set at 9...some of the other indicators are set at different bars/times so you could change it to 7 or some other number if you wish
 
@csricksdds

Hey thanks for adding this indicator I just added your code and it looks great on SPY and the QQQs. I did have a few questions though:

(For any non-coders out there like me, I did have to add the # in front of the code that was highlighted red and that fixed the errors I was getting. Other than that, I did go into the study settings under plot and uncheck signaldown and signalrevbot so I don't have to zoom in every time I switch back to and that's been really nice)

Can you clarify which settings you changed? I was confused by the 9 and 15 you mentioned you had adjusted earlier.

I'm assuming those settings are changed under the Inputs and Options section in Studys. I'll attach two screenshots showing the default settings and if you could let me know which options you adjusted that would be awesome!!! I will do some back testing too because the default settings already look really good, but I wanted to see what it's like with the settings you use.

Other than that I was also curious if you could explain what the arrow indicators mean? Also, the long and short entries seem simply enough, but where have you been exiting/whats your target and also where to do set your stop losses?

Thanks!
Tanner



Okay I cant get it to add pictures but here are my default settings:

Inputs-
Length: 7
ignore last bar: yes
show arrows on highpoints lowpoints: yes
perent a to c: 0.1
np: 13
atrreversal: 2.0
usealerts: yes
(a bunch of timeframe options)
trend periods: 6
 
On my original AsGoodAsItGets I added arrows which showed at the same time as the bubbles...in my no arrow version I eliminated the arrows to not show with those bubbles so that other arrows I use would not be blocked by them.
 
Hi again thanks for the reply... so just to clarify the tops and bottoms are delayed as far as painting on the chart? On the one min chart? In other words they seem to be appearing after the fact. If I could get these to appear in realtime it would be gang busters. I do not want to change the settings as they are perfect for the one min chart, I just see them paint about 15 mins there after. Is this normal? I don't see how this would help if they don't paint in realtime.
So it looks like I have to refresh the screen to make them appear... is this normal? Thanks again for your help!
 
So it looks like I have to refresh the screen to make them appear... is this normal? Thanks again for your help!
To my knowledge Bars paint at the close of a bar but because they also repaint if there is a change in direction it might disappear and repaint at the actual top/bottom that shows up (usually a short time later)
 
So it looks like I have to refresh the screen to make them appear... is this normal? Thanks again for your help!
@Jedvi i went through the code to check for any delays for you. @csrickdds code is well written and does not have any delays past the usual close and signal. (repainting is a different issue. It kicks in with zig zag).

Having said that, the delay of 15 mins and especially refreshing the screen points to your environment and other scripts. Since this script was the last one, it broke the proverbial camels back. But it is not the straw that you are looking for.

Java and a host of other issues become relevant to really mess things up. Additionally we don't know which one of the scripts in your environment is causing it. You might want to save your environment and screen configurations. Blow away the environment and take a fresh start. Start only with this script. After it works you can add the other scripts, and screens. Rebuild but don't use your saved styles/screens...
 
@Jedvi i went through the code to check for any delays for you. @csrickdds code is well written and does not have any delays past the usual close and signal. (repainting is a different issue. It kicks in with zig zag).

Having said that, the delay of 15 mins and especially refreshing the screen points to your environment and other scripts. Since this script was the last one, it broke the proverbial camels back. But it is not the straw that you are looking for.

Java and a host of other issues become relevant to really mess things up. Additionally we don't know which one of the scripts in your environment is causing it. You might want to save your environment and screen configurations. Blow away the environment and take a fresh start. Start only with this script. After it works you can add the other scripts, and screens. Rebuild but don't use your saved styles/screens...
I was wonder if the repainting of the bubbles was normal. How do you guys trade this?? Do you take starters at the first bubbles and add if there are repaints?

And where are you taking profits? do you wait for a short bubble if you're going long?

And if someone could explain the arrows i would really appreciate it. Right now i'm assuming they're showing possible signs of the trend reversing but they arent as strong as the bubbles.?

Just trying to figure out how to best utilize this tool because it seems powerful. Any input is super appreciated
 
I was wonder if the repainting of the bubbles was normal. How do you guys trade this?? Do you take starters at the first bubbles and add if there are repaints?

And where are you taking profits? do you wait for a short bubble if you're going long?

And if someone could explain the arrows i would really appreciate it. Right now i'm assuming they're showing possible signs of the trend reversing but they arent as strong as the bubbles.?

Just trying to figure out how to best utilize this tool because it seems powerful. Any input is super appreciated
@TerryPotter right this second 2/15/2023 starting 0736 or 7:36 the market (/ES) is sinking. I am not using the script under discussion. i just looked at 1 min chart. It is sinking. so there is no reversal lining up.

The markets are designed by its keepers to take money from you. But with experience, starting with discipline to protect your capital and extremely important "understanding each individual study to its core" you can make money.

Putting a study up on the chart is not the end it is just the beginning.

It is fairly difficult to point to one indicator or one chart to tell you that use that particular one for you. What I use and understand is not what you use and understand. When market(your fav symbol) start issuing conflicting messages then experience walks in. Zig Zag is one of them (as it changes) and fairly mundane averages can wreck havoc on your portfolio (an average is a rear view mirror but it can be very useful)

The admins on this site work very hard to analyze and sort the studies and tell you if the study repaints (which in simple words is be careful or use with other indicators). They also have marked sections for trends and trading strategies.

Use the search to get to charts other traders have posted and analyze them to see what works for you. Analyze them before committing your hard earned dollars and you will be successful!

PS: Use this study with other indicators prior to trading with it. Just because it repaints it is not off limits. It is a good study
 
Last edited:
Still having troubel with the Tops and Bottoms printing, I have to make an adjustment to the indicator press apply then i see the dots. I have to do this everytime as the timeline continues during the day. Very strange can't figure out why this is.
 
Long/Short Labels Indicator: http://tos.mx/Xq61zzq
I appreciate the elegance and non-intrusiveness of the study and your code- it's non intrusive, unlike the ATR reversal trailing stop and it has a strong correlation with intraday VWAP, $Tick, and Linear Slope studies the intraday chart. As I understand the script , it's alerting at 2 x average ATR Reversal of a Low or High price Exponential 5 period MA reversal . The code is really elegant and creative: def EIH = ZigZagHighLow("price h" = priceh, "price l" = pricel, "percentage reversal" = .01, "absolute reversal" = .05, "atr length" = 5, "atr reversal" = atrreversal).lastH;
(and vice/versa for the resverse signal. also since your shared the open code as I understand it the user can effectively alter the settings depending on their preferences and circumstances ) Thank you very much, I am grateful for your sharing your work.

Sincerely,
MagicQuotes
 
I appreciate the elegance and non-intrusiveness of the study and your code- it's non intrusive, unlike the ATR reversal trailing stop and it has a strong correlation with intraday VWAP, $Tick, and Linear Slope studies the intraday chart. As I understand the script , it's alerting at 2 x average ATR Reversal of a Low or High price Exponential 5 period MA reversal . The code is really elegant and creative: def EIH = ZigZagHighLow("price h" = priceh, "price l" = pricel, "percentage reversal" = .01, "absolute reversal" = .05, "atr length" = 5, "atr reversal" = atrreversal).lastH;
(and vice/versa for the resverse signal. also since your shared the open code as I understand it the user can effectively alter the settings depending on their preferences and circumstances ) Thank you very much, I am grateful for your sharing your work.

Sincerely,
MagicQuotes
Thanks for your feedback...enjoy!
 
Hi @csricksdds , been following from a distance for a while now and wanted to ask if you could direct me to a post that summarizes your current set of indicators and/or chart set up. Thanks!
 
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);
 
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);
can you please explain why the multiplier for Plothighest and plotlowest is different? should it be 3.0 for both?

def plotHighest = highpoint + prange * .3;
def plotLowest = lowpoint - prange * 3.0;
 

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
329 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