Repaints Important Note for MTF Studies utilizing script() for Secondary Aggs

Repaints

tomsk

Well-known member
VIP
Just a heads up for those that have MTF studies that use script() to handle secondary aggregations do not work
This was discussed at length in the TSL yesterday as well as about a week ago.
Mobius eluded to the fact that secondary aggs using script() do not work
Hence if your MTF study displays strange results, this would be the underlying cause
 
thanks @tomsk I've never had an issue with secondary inside scripts. can you the summary of the discussion and issue?

this is how I always have done it, and I spent time comparing the results over the last year or so, and scripts seem to always have work fine for me.

Here is an example on how I've used them:

hSDkYF1.png


in this example notice the comment (label to right), compare the values to the 5MIN in the left/lower inside the 3 scripts.

Any insight or examples would be greatly appreciated. this revelation might have me go back and retest a bunch of code now :|

aggTestScript
Ruby:
script Superfast {
    input useCurrentAggPeriod = yes;
    input AggPeriod = AggregationPeriod.FIVE_MIN;
    input superfast_length = 8;
    input fast_length = 13;
    input slow_length = 21;
    input displace = 0;
    def agg = If(useCurrentAggPeriod, GetAggregationPeriod(), AggPeriod);

    def h = high(period = agg);
    def l = low(period = agg);
    def o = open(period = agg);
    def c = close(period = agg);
    def v = volume(period = agg);
    def price = close(period = agg);

    plot Superfast = ExpAverage(price[-displace], superfast_length);
}

script Fast {
    input useCurrentAggPeriod = yes;
    input AggPeriod = AggregationPeriod.FIVE_MIN;
    input superfast_length = 8;
    input fast_length = 13;
    input slow_length = 21;
    input displace = 0;
    def agg = If(useCurrentAggPeriod, GetAggregationPeriod(), AggPeriod);

    def h = high(period = agg);
    def l = low(period = agg);
    def o = open(period = agg);
    def c = close(period = agg);
    def v = volume(period = agg);
    def price = close(period = agg);

    plot Fast = ExpAverage(price[-displace], fast_length);
}

script Slow {
    input useCurrentAggPeriod = yes;
    input AggPeriod = AggregationPeriod.FIVE_MIN;
    input superfast_length = 8;
    input fast_length = 13;
    input slow_length = 21;
    input displace = 0;
    def agg = If(useCurrentAggPeriod, GetAggregationPeriod(), AggPeriod);

    def h = high(period = agg);
    def l = low(period = agg);
    def o = open(period = agg);
    def c = close(period = agg);
    def v = volume(period = agg);
    def price = close(period = agg);

    plot Slow = ExpAverage(price[-displace], slow_length);
}

plot Superfast = SuperFast(no, "FIVE_MIN");
plot Fast = Fast(no, "FIVE_MIN");
plot Slow = Slow(no, "FIVE_MIN");

aggTestNoScript
Ruby:
input useCurrentAggPeriod = yes;
input AggPeriod = AggregationPeriod.FIVE_MIN;
input superfast_length = 8;
input fast_length = 13;
input slow_length = 21;
input displace = 0;
def agg = If(useCurrentAggPeriod,getAggregationPeriod(),AggPeriod);

def h = high(period = agg);
def l = low(period = agg);
def o = open(period = agg);
def c = close(period = agg);
def v = volume(period = agg);
def price = close(period = agg);

AddLabel(yes,"using current: " + useCurrentAggPeriod, COLOR.WHITE);

plot Superfast = ExpAverage(price[-displace], superfast_length);
plot Fast = ExpAverage(price[-displace], fast_length);
plot Slow = ExpAverage(price[-displace], slow_length);
 

Attachments

  • hSDkYF1.png
    hSDkYF1.png
    259.7 KB · Views: 210
Confusing to me. This looks simpler.

input AggPeriod = AggregationPeriod.FIVE_MIN;
input superfast_length = 8;
input fast_length = 13;
input slow_length = 21;
input displace = 0;
def price = close(period = aggperiod);
plot Superfast = ExpAverage(price[-displace], superfast_length);
plot Fast = ExpAverage(price[-displace], fast_length);
plot Slow = ExpAverage(price[-displace], slow_length);


2019-11-02-TOS-CHARTS.png
 
I was given this by Mobius but I have found that it did not plot accurately in the higher time frames. Something glitchy with ToS.
it will blink back and forth red to green. also it is just inaccurate when you actually compare to the real time chart in the higher time frame.
let me know your thoughts or corrections

https://tos.mx/iRDiduk
 
@SmellyCat Yes, this is precisely the reason I sounded the alert when I posted this thread several days ago. In the study you posted, notice the use of a script function that uses a secondary aggregation. Thus as noted earlier in my post, this will not yield the results you seek and will not work. The workaround is to revamp the code and avoid using the using script() function for secondary aggregation
 
thanks @SmellyCat and @tomsk

yZSP990.png


what is the issue? rendering, data results, expect values wrong, NaN?

I do a lot of secondary aggregation in scripts and I have validated the results; haven't run into significant issues when calling multiple aggregations in scripts.

thanks for bring attention to this!
 

Attachments

  • yZSP990.png
    yZSP990.png
    176 KB · Views: 194
I was curious, so took it a part to quickly test, I think it's working correctly.

the only difference that I made, is made the current time aggregation run inside the script, and made a few modifications to reduce functions that could be causing issues during testing and removed the back lookup of [1] on the aggregations and was able to match it exactly on the secondary 5 minute chart see example:

BZG8lng.png


Ruby:
### TEST VERSION TO TEST OUT THE MULTIPLE AGGREGATION ###

# SuperTrend Multiple Time Frames
# Mobius
# V03.01.2016

declare lower;

script ST{
input agg = AggregationPeriod.Five_Min;
input AtrMult = .70;
input nATR = 4;
input AvgType = AverageType.HULL;
def h = high(period = agg);
def l = low(period = agg);
def c = close(period = agg);
def hl = hl2(period = agg);
def ATR = MovingAverage(AvgType, TrueRange(h, c, l), nATR);
def UP = hl + (AtrMult * ATR);
def DN = hl + (-AtrMult * ATR);
def S = if c < S[1]
        then Round(UP / tickSize(), 0) * tickSize()
        else Round(DN / tickSize(), 0) * tickSize();
plot ST = if c > S then 1 else 0;
}

#INPUT
input AtrMult = .70;
input nATR = 4;
input AvgType = AverageType.HULL;

#LOGIC

def FirstAgg = ST(agg = "min", AtrMult = AtrMult, nATR = nATR, AvgType = AvgType);
plot FirstAggPlot = if isNaN(close) then double.nan else 1;
FirstAggPlot.SetStyle(Curve.Points);
FirstAggPlot.SetLineWeight(3);
FirstAggPlot.AssignValueColor(if FirstAgg == 1 then color.green else color.red);

def SecondAgg = ST(agg = "FIVE_MIN", AtrMult = AtrMult, nATR = nATR, AvgType = AvgType);
plot SecondAggPlot = if isNaN(close) then double.nan else 2;
SecondAggPlot.SetStyle(Curve.Points);
SecondAggPlot.SetLineWeight(3);
SecondAggPlot.AssignValueColor(if SecondAgg == 1 then color.green else color.red);

def ThirdAgg = ST(agg = "Ten_Min", AtrMult = AtrMult, nATR = nATR, AvgType = AvgType);
plot ThirdAggPlot = if isNaN(close) then double.nan else 3;
ThirdAggPlot.SetStyle(Curve.Points);
ThirdAggPlot.SetLineWeight(3);
ThirdAggPlot.AssignValueColor(if ThirdAgg == 1 then color.green else color.red);

def FourthAgg = ST(agg = "Fifteen_Min", AtrMult = AtrMult, nATR = nATR, AvgType = AvgType);
plot FourthAggPlot = if isNaN(close) then double.nan else 4;
FourthAggPlot.SetStyle(Curve.Points);
FourthAggPlot.SetLineWeight(3);
FourthAggPlot.AssignValueColor(if FourthAgg == 1 then color.green else color.red);

def FifthAgg = ST(agg = "Hour", AtrMult = AtrMult, nATR = nATR, AvgType = AvgType);
plot FifthAggPlot = if isNaN(close) then double.nan else 5;
FifthAggPlot.SetStyle(Curve.Points);
FifthAggPlot.SetLineWeight(3);
FifthAggPlot.AssignValueColor(if FifthAgg == 1 then color.green else color.red);
 

Attachments

  • BZG8lng.png
    BZG8lng.png
    177.6 KB · Views: 198
Folks, given the recent interest in the MTF SuperTrend, I have modified the study that @SmellyCat posted earlier
Essentially removed the script function component and replaced it with what I term "standard" code
Ran it on a 1 min chart of MSFT and it does yield different results.

Code:
# SuperTrend Multiple Time Frames
# Mobius with mods by tomsk to replace the script() function for secondary aggs with "standard" code
# V03.01.2016
# 11.4.2019

declare lower;

input agg1 = AggregationPeriod.Five_Min;
input agg2 = AggregationPeriod.Ten_Min;
input agg3 = AggregationPeriod.Fifteen_Min;
input agg4 = AggregationPeriod.Thirty_Min;
input agg5 = AggregationPeriod.Hour;
input AtrMult = .70;
input nATR = 4;
input AvgType = AverageType.HULL;

def Fh = FundamentalType.High;
def Fl = FundamentalType.Low;
def Fc = FundamentalType.Close;
def Fhl2 = FundamentalType.HL2;

def cl = close;
def x = isNaN(cl[2]) and !isNaN(cl[3]);
def ATR = MovingAverage(AvgType, TrueRange(high, close, low), nATR);
def UP = hl2 + (AtrMult * ATR);
def DN = hl2 + (-AtrMult * ATR);
def S = if close < S[1]
        then Round(UP / tickSize(), 0) * tickSize()
        else Round(DN / tickSize(), 0) * tickSize();
def FirstAgg = if close > S then 1 else 0;
plot FirstAggPlot = if isNaN(cl)
                    then double.nan
                    else 1;
FirstAggPlot.SetStyle(Curve.Points);
FirstAggPlot.SetLineWeight(3);
FirstAggPlot.AssignValueColor(if FirstAgg == 1
                              then color.green
                              else color.red);
AddChartBubble(x, 1, (GetAggregationPeriod()/1000/60) + " min", color.white, yes);

# SecondAgg
def h2 = Fundamental(Fh, period = agg2)[1];
def l2 = Fundamental(Fl, period = agg2)[1];
def c2 = Fundamental(Fc, period = agg2)[1];
def hl2 = Fundamental(Fhl2, period = agg2)[1];
def ATR2 = MovingAverage(AvgType, TrueRange(h2, c2, l2), nATR);
def UP2 = hl2 + (AtrMult * ATR2);
def DN2 = hl2 + (-AtrMult * ATR2);
def S2 = if c2 < S2[1]
         then Round(UP2 / tickSize(), 0) * tickSize()
         else Round(DN2 / tickSize(), 0) * tickSize();
def SecondAgg = if c2 > S2 then 1 else 0;
plot SecondAggPlot = if isNaN(cl)
                     then double.nan
                     else 2;
SecondAggPlot.SetStyle(Curve.Points);
SecondAggPlot.SetLineWeight(3);
SecondAggPlot.AssignValueColor(if SecondAgg == 1
                               then color.green
                               else color.red);
AddChartBubble(x, 2, (agg2/1000/60) + " min", color.white, yes);

# ThirdAgg
def h3 = Fundamental(Fh, period = agg3)[1];
def l3 = Fundamental(Fl, period = agg3)[1];
def c3 = Fundamental(Fc, period = agg3)[1];
def hl3 = Fundamental(Fhl2, period = agg3)[1];
def ATR3 = MovingAverage(AvgType, TrueRange(h3, c3, l3), nATR);
def UP3 = hl3 + (AtrMult * ATR3);
def DN3 = hl3 + (-AtrMult * ATR3);
def S3 = if c3 < S3[1]
         then Round(UP3 / tickSize(), 0) * tickSize()
         else Round(DN3 / tickSize(), 0) * tickSize();
def ThirdAgg = if c3 > S3 then 1 else 0;
plot ThirdAggPlot = if isNaN(cl)
                    then double.nan
                    else 3;
ThirdAggPlot.SetStyle(Curve.Points);
ThirdAggPlot.SetLineWeight(3);
ThirdAggPlot.AssignValueColor(if ThirdAgg == 1
                              then color.green
                              else color.red);
AddChartBubble(x, 3, (agg3/1000/60) + " min", color.white, yes);

# FourthAgg
def h4 = Fundamental(Fh, period = agg4)[1];
def l4 = Fundamental(Fl, period = agg4)[1];
def c4 = Fundamental(Fc, period = agg4)[1];
def hl4 = Fundamental(Fhl2, period = agg4)[1];
def ATR4 = MovingAverage(AvgType, TrueRange(h4, c4, l4), nATR);
def UP4 = hl4 + (AtrMult * ATR4);
def DN4 = hl4 + (-AtrMult * ATR4);
def S4 = if c4 < S4[1]
         then Round(UP4 / tickSize(), 0) * tickSize()
         else Round(DN4 / tickSize(), 0) * tickSize();
def FourthAgg = if c4 > S4 then 1 else 0;
plot FourthAggPlot = if isNaN(cl)
                     then double.nan
                     else 4;
FourthAggPlot.SetStyle(Curve.Points);
FourthAggPlot.SetLineWeight(3);
FourthAggPlot.AssignValueColor(if FourthAgg == 1
                               then color.green
                               else color.red);
AddChartBubble(x, 4, (agg4/1000/60) + " min", color.white, yes);

# FifthAgg
def h5 = Fundamental(Fh, period = agg5)[1];
def l5 = Fundamental(Fl, period = agg5)[1];
def c5 = Fundamental(Fc, period = agg5)[1];
def hl5 = Fundamental(Fhl2, period = agg5)[1];
def ATR5 = MovingAverage(AvgType, TrueRange(h5, c5, l5), nATR);
def UP5 = hl5 + (AtrMult * ATR5);
def DN5 = hl5 + (-AtrMult * ATR5);
def S5 = if c5 < S5[1]
         then Round(UP5 / tickSize(), 0) * tickSize()
         else Round(DN5 / tickSize(), 0) * tickSize();
def FifthAgg = if c5 > S5 then 1 else 0;
plot FifthAggPlot = if isNaN(cl)
                    then double.nan
                    else 5;
FifthAggPlot.SetStyle(Curve.Points);
FifthAggPlot.SetLineWeight(3);
FifthAggPlot.AssignValueColor(if FifthAgg == 1
                              then color.green
                              else color.red);
AddChartBubble(x, 5, (agg5/1000/60)+ " min", color.white, yes);
plot Six = if isNaN(cl)
           then double.nan
           else 6;
Six.SetStyle(Curve.Points);
Six.SetLineWeight(3);
Six.AssignValueColor(if FirstAgg and
                        SecondAgg and
                        ThirdAgg and
                        FourthAgg and
                        FifthAgg
                     then color.green
                     else if !FirstAgg and
                             !SecondAgg and
                             !ThirdAgg and
                             !FourthAgg and
                             !FifthAgg
                          then color.red
                     else color.black);
# End Code ST MTF
 
Folks, given the recent interest in the MTF SuperTrend, I have modified the study that @SmellyCat posted earlier
Essentially removed the script function component and replaced it with what I term "standard" code
Ran it on a 1 min chart of MSFT and it does yield different results.

# SuperTrend Multiple Time Frames
# Mobius with mods by tomsk to replace the script() function for secondary aggs with "standard" code
# V03.01.2016
# 11.4.2019

declare lower;

input agg1 = AggregationPeriod.Five_Min;
input agg2 = AggregationPeriod.Ten_Min;
input agg3 = AggregationPeriod.Fifteen_Min;
input agg4 = AggregationPeriod.Thirty_Min;
input agg5 = AggregationPeriod.Hour;
input AtrMult = .70;
input nATR = 4;
input AvgType = AverageType.HULL;

def Fh = FundamentalType.High;
def Fl = FundamentalType.Low;
def Fc = FundamentalType.Close;
def Fhl2 = FundamentalType.HL2;

def cl = close;
def x = isNaN(cl[2]) and !isNaN(cl[3]);
def ATR = MovingAverage(AvgType, TrueRange(high, close, low), nATR);
def UP = hl2 + (AtrMult * ATR);
def DN = hl2 + (-AtrMult * ATR);
def S = if close < S[1]
then Round(UP / tickSize(), 0) * tickSize()
else Round(DN / tickSize(), 0) * tickSize();
def FirstAgg = if close > S then 1 else 0;
plot FirstAggPlot = if isNaN(cl)
then double.nan
else 1;
FirstAggPlot.SetStyle(Curve.Points);
FirstAggPlot.SetLineWeight(3);
FirstAggPlot.AssignValueColor(if FirstAgg == 1
then color.green
else color.red);
AddChartBubble(x, 1, (GetAggregationPeriod()/1000/60) + " min", color.white, yes);

# SecondAgg
def h2 = Fundamental(Fh, period = agg2)[1];
def l2 = Fundamental(Fl, period = agg2)[1];
def c2 = Fundamental(Fc, period = agg2)[1];
def hl2 = Fundamental(Fhl2, period = agg2)[1];
def ATR2 = MovingAverage(AvgType, TrueRange(h2, c2, l2), nATR);
def UP2 = hl2 + (AtrMult * ATR2);
def DN2 = hl2 + (-AtrMult * ATR2);
def S2 = if c2 < S2[1]
then Round(UP2 / tickSize(), 0) * tickSize()
else Round(DN2 / tickSize(), 0) * tickSize();
def SecondAgg = if c2 > S2 then 1 else 0;
plot SecondAggPlot = if isNaN(cl)
then double.nan
else 2;
SecondAggPlot.SetStyle(Curve.Points);
SecondAggPlot.SetLineWeight(3);
SecondAggPlot.AssignValueColor(if SecondAgg == 1
then color.green
else color.red);
AddChartBubble(x, 2, (agg2/1000/60) + " min", color.white, yes);

# ThirdAgg
def h3 = Fundamental(Fh, period = agg3)[1];
def l3 = Fundamental(Fl, period = agg3)[1];
def c3 = Fundamental(Fc, period = agg3)[1];
def hl3 = Fundamental(Fhl2, period = agg3)[1];
def ATR3 = MovingAverage(AvgType, TrueRange(h3, c3, l3), nATR);
def UP3 = hl3 + (AtrMult * ATR3);
def DN3 = hl3 + (-AtrMult * ATR3);
def S3 = if c3 < S3[1]
then Round(UP3 / tickSize(), 0) * tickSize()
else Round(DN3 / tickSize(), 0) * tickSize();
def ThirdAgg = if c3 > S3 then 1 else 0;
plot ThirdAggPlot = if isNaN(cl)
then double.nan
else 3;
ThirdAggPlot.SetStyle(Curve.Points);
ThirdAggPlot.SetLineWeight(3);
ThirdAggPlot.AssignValueColor(if ThirdAgg == 1
then color.green
else color.red);
AddChartBubble(x, 3, (agg3/1000/60) + " min", color.white, yes);

# FourthAgg
def h4 = Fundamental(Fh, period = agg4)[1];
def l4 = Fundamental(Fl, period = agg4)[1];
def c4 = Fundamental(Fc, period = agg4)[1];
def hl4 = Fundamental(Fhl2, period = agg4)[1];
def ATR4 = MovingAverage(AvgType, TrueRange(h4, c4, l4), nATR);
def UP4 = hl4 + (AtrMult * ATR4);
def DN4 = hl4 + (-AtrMult * ATR4);
def S4 = if c4 < S4[1]
then Round(UP4 / tickSize(), 0) * tickSize()
else Round(DN4 / tickSize(), 0) * tickSize();
def FourthAgg = if c4 > S4 then 1 else 0;
plot FourthAggPlot = if isNaN(cl)
then double.nan
else 4;
FourthAggPlot.SetStyle(Curve.Points);
FourthAggPlot.SetLineWeight(3);
FourthAggPlot.AssignValueColor(if FourthAgg == 1
then color.green
else color.red);
AddChartBubble(x, 4, (agg4/1000/60) + " min", color.white, yes);

# FifthAgg
def h5 = Fundamental(Fh, period = agg5)[1];
def l5 = Fundamental(Fl, period = agg5)[1];
def c5 = Fundamental(Fc, period = agg5)[1];
def hl5 = Fundamental(Fhl2, period = agg5)[1];
def ATR5 = MovingAverage(AvgType, TrueRange(h5, c5, l5), nATR);
def UP5 = hl5 + (AtrMult * ATR5);
def DN5 = hl5 + (-AtrMult * ATR5);
def S5 = if c5 < S5[1]
then Round(UP5 / tickSize(), 0) * tickSize()
else Round(DN5 / tickSize(), 0) * tickSize();
def FifthAgg = if c5 > S5 then 1 else 0;
plot FifthAggPlot = if isNaN(cl)
then double.nan
else 5;
FifthAggPlot.SetStyle(Curve.Points);
FifthAggPlot.SetLineWeight(3);
FifthAggPlot.AssignValueColor(if FifthAgg == 1
then color.green
else color.red);
AddChartBubble(x, 5, (agg5/1000/60)+ " min", color.white, yes);
plot Six = if isNaN(cl)
then double.nan
else 6;
Six.SetStyle(Curve.Points);
Six.SetLineWeight(3);
Six.AssignValueColor(if FirstAgg and
SecondAgg and
ThirdAgg and
FourthAgg and
FifthAgg
then color.green
else if !FirstAgg and
!SecondAgg and
!ThirdAgg and
!FourthAgg and
!FifthAgg
then color.red
else color.black);
# End Code ST MTF
thanks - I think the issue is the "[1] in the Fundamental(Fh, period = agg3)[1];" lines - can you try the it without [1]. the displacer I think it's what is causing the mismatch. the first agg never had any displacer in the original script.
 
@diazlaz can you direct me to the original script all are talking about? I use one quite often but I have many. I wanted to see if the script I use is the one you guys are talking about. The one above I posted. Thanks
 
@MBF the tos.mx link you posted above does not have any script() function embedded in the code, so is a non issue in your case
 
  • Like
Reactions: MBF
@MBF the tos.mx link you posted above does not have any script() function embedded in the code, so is a non issue in your case
@diazlaz can you direct me to the original script all are talking about? I use one quite often but I have many. I wanted to see if the script I use is the one you guys are talking about. The one above I posted. Thanks
Hi @MBF, its the same script as above :) - I was troubleshooting the use of agg when leveraging the thinkscript function keyword "script". Best!
 
  • Like
Reactions: MBF
@MBF If your study does not have the code as shown below with the agg condition inside the script brackets it will not have this problem.

script Superfast {
input useCurrentAggPeriod = yes;
input AggPeriod = AggregationPeriod.FIVE_MIN;
 
  • Like
Reactions: MBF
Folks, given the recent interest in the MTF SuperTrend, I have modified the study that @SmellyCat posted earlier
Essentially removed the script function component and replaced it with what I term "standard" code
Ran it on a 1 min chart of MSFT and it does yield different results.

# SuperTrend Multiple Time Frames
# Mobius with mods by tomsk to replace the script() function for secondary aggs with "standard" code
# V03.01.2016
# 11.4.2019

declare lower;

input agg1 = AggregationPeriod.Five_Min;
input agg2 = AggregationPeriod.Ten_Min;
input agg3 = AggregationPeriod.Fifteen_Min;
input agg4 = AggregationPeriod.Thirty_Min;
input agg5 = AggregationPeriod.Hour;
input AtrMult = .70;
input nATR = 4;
input AvgType = AverageType.HULL;

def Fh = FundamentalType.High;
def Fl = FundamentalType.Low;
def Fc = FundamentalType.Close;
def Fhl2 = FundamentalType.HL2;

def cl = close;
def x = isNaN(cl[2]) and !isNaN(cl[3]);
def ATR = MovingAverage(AvgType, TrueRange(high, close, low), nATR);
def UP = hl2 + (AtrMult * ATR);
def DN = hl2 + (-AtrMult * ATR);
def S = if close < S[1]
then Round(UP / tickSize(), 0) * tickSize()
else Round(DN / tickSize(), 0) * tickSize();
def FirstAgg = if close > S then 1 else 0;
plot FirstAggPlot = if isNaN(cl)
then double.nan
else 1;
FirstAggPlot.SetStyle(Curve.Points);
FirstAggPlot.SetLineWeight(3);
FirstAggPlot.AssignValueColor(if FirstAgg == 1
then color.green
else color.red);
AddChartBubble(x, 1, (GetAggregationPeriod()/1000/60) + " min", color.white, yes);

# SecondAgg
def h2 = Fundamental(Fh, period = agg2)[1];
def l2 = Fundamental(Fl, period = agg2)[1];
def c2 = Fundamental(Fc, period = agg2)[1];
def hl2 = Fundamental(Fhl2, period = agg2)[1];
def ATR2 = MovingAverage(AvgType, TrueRange(h2, c2, l2), nATR);
def UP2 = hl2 + (AtrMult * ATR2);
def DN2 = hl2 + (-AtrMult * ATR2);
def S2 = if c2 < S2[1]
then Round(UP2 / tickSize(), 0) * tickSize()
else Round(DN2 / tickSize(), 0) * tickSize();
def SecondAgg = if c2 > S2 then 1 else 0;
plot SecondAggPlot = if isNaN(cl)
then double.nan
else 2;
SecondAggPlot.SetStyle(Curve.Points);
SecondAggPlot.SetLineWeight(3);
SecondAggPlot.AssignValueColor(if SecondAgg == 1
then color.green
else color.red);
AddChartBubble(x, 2, (agg2/1000/60) + " min", color.white, yes);

# ThirdAgg
def h3 = Fundamental(Fh, period = agg3)[1];
def l3 = Fundamental(Fl, period = agg3)[1];
def c3 = Fundamental(Fc, period = agg3)[1];
def hl3 = Fundamental(Fhl2, period = agg3)[1];
def ATR3 = MovingAverage(AvgType, TrueRange(h3, c3, l3), nATR);
def UP3 = hl3 + (AtrMult * ATR3);
def DN3 = hl3 + (-AtrMult * ATR3);
def S3 = if c3 < S3[1]
then Round(UP3 / tickSize(), 0) * tickSize()
else Round(DN3 / tickSize(), 0) * tickSize();
def ThirdAgg = if c3 > S3 then 1 else 0;
plot ThirdAggPlot = if isNaN(cl)
then double.nan
else 3;
ThirdAggPlot.SetStyle(Curve.Points);
ThirdAggPlot.SetLineWeight(3);
ThirdAggPlot.AssignValueColor(if ThirdAgg == 1
then color.green
else color.red);
AddChartBubble(x, 3, (agg3/1000/60) + " min", color.white, yes);

# FourthAgg
def h4 = Fundamental(Fh, period = agg4)[1];
def l4 = Fundamental(Fl, period = agg4)[1];
def c4 = Fundamental(Fc, period = agg4)[1];
def hl4 = Fundamental(Fhl2, period = agg4)[1];
def ATR4 = MovingAverage(AvgType, TrueRange(h4, c4, l4), nATR);
def UP4 = hl4 + (AtrMult * ATR4);
def DN4 = hl4 + (-AtrMult * ATR4);
def S4 = if c4 < S4[1]
then Round(UP4 / tickSize(), 0) * tickSize()
else Round(DN4 / tickSize(), 0) * tickSize();
def FourthAgg = if c4 > S4 then 1 else 0;
plot FourthAggPlot = if isNaN(cl)
then double.nan
else 4;
FourthAggPlot.SetStyle(Curve.Points);
FourthAggPlot.SetLineWeight(3);
FourthAggPlot.AssignValueColor(if FourthAgg == 1
then color.green
else color.red);
AddChartBubble(x, 4, (agg4/1000/60) + " min", color.white, yes);

# FifthAgg
def h5 = Fundamental(Fh, period = agg5)[1];
def l5 = Fundamental(Fl, period = agg5)[1];
def c5 = Fundamental(Fc, period = agg5)[1];
def hl5 = Fundamental(Fhl2, period = agg5)[1];
def ATR5 = MovingAverage(AvgType, TrueRange(h5, c5, l5), nATR);
def UP5 = hl5 + (AtrMult * ATR5);
def DN5 = hl5 + (-AtrMult * ATR5);
def S5 = if c5 < S5[1]
then Round(UP5 / tickSize(), 0) * tickSize()
else Round(DN5 / tickSize(), 0) * tickSize();
def FifthAgg = if c5 > S5 then 1 else 0;
plot FifthAggPlot = if isNaN(cl)
then double.nan
else 5;
FifthAggPlot.SetStyle(Curve.Points);
FifthAggPlot.SetLineWeight(3);
FifthAggPlot.AssignValueColor(if FifthAgg == 1
then color.green
else color.red);
AddChartBubble(x, 5, (agg5/1000/60)+ " min", color.white, yes);
plot Six = if isNaN(cl)
then double.nan
else 6;
Six.SetStyle(Curve.Points);
Six.SetLineWeight(3);
Six.AssignValueColor(if FirstAgg and
SecondAgg and
ThirdAgg and
FourthAgg and
FifthAgg
then color.green
else if !FirstAgg and
!SecondAgg and
!ThirdAgg and
!FourthAgg and
!FifthAgg
then color.red
else color.black);
# End Code ST MTF


tomsk - Yes, your code now plots accurately as far as I can tell. Thanks for clarifying it! Very nice and helpful.
 
@MBF If your study does not have the code as shown below with the agg condition inside the script brackets it will not have this problem.

script Superfast {
input useCurrentAggPeriod = yes;
input AggPeriod = AggregationPeriod.FIVE_MIN;
Thank you!
 
Folks, given the recent interest in the MTF SuperTrend, I have modified the study that @SmellyCat posted earlier
Essentially removed the script function component and replaced it with what I term "standard" code
Ran it on a 1 min chart of MSFT and it does yield different results.

# SuperTrend Multiple Time Frames
# Mobius with mods by tomsk to replace the script() function for secondary aggs with "standard" code
# V03.01.2016
# 11.4.2019

declare lower;

input agg1 = AggregationPeriod.Five_Min;
input agg2 = AggregationPeriod.Ten_Min;
input agg3 = AggregationPeriod.Fifteen_Min;
input agg4 = AggregationPeriod.Thirty_Min;
input agg5 = AggregationPeriod.Hour;
input AtrMult = .70;
input nATR = 4;
input AvgType = AverageType.HULL;

def Fh = FundamentalType.High;
def Fl = FundamentalType.Low;
def Fc = FundamentalType.Close;
def Fhl2 = FundamentalType.HL2;

def cl = close;
def x = isNaN(cl[2]) and !isNaN(cl[3]);
def ATR = MovingAverage(AvgType, TrueRange(high, close, low), nATR);
def UP = hl2 + (AtrMult * ATR);
def DN = hl2 + (-AtrMult * ATR);
def S = if close < S[1]
then Round(UP / tickSize(), 0) * tickSize()
else Round(DN / tickSize(), 0) * tickSize();
def FirstAgg = if close > S then 1 else 0;
plot FirstAggPlot = if isNaN(cl)
then double.nan
else 1;
FirstAggPlot.SetStyle(Curve.Points);
FirstAggPlot.SetLineWeight(3);
FirstAggPlot.AssignValueColor(if FirstAgg == 1
then color.green
else color.red);
AddChartBubble(x, 1, (GetAggregationPeriod()/1000/60) + " min", color.white, yes);

# SecondAgg
def h2 = Fundamental(Fh, period = agg2)[1];
def l2 = Fundamental(Fl, period = agg2)[1];
def c2 = Fundamental(Fc, period = agg2)[1];
def hl2 = Fundamental(Fhl2, period = agg2)[1];
def ATR2 = MovingAverage(AvgType, TrueRange(h2, c2, l2), nATR);
def UP2 = hl2 + (AtrMult * ATR2);
def DN2 = hl2 + (-AtrMult * ATR2);
def S2 = if c2 < S2[1]
then Round(UP2 / tickSize(), 0) * tickSize()
else Round(DN2 / tickSize(), 0) * tickSize();
def SecondAgg = if c2 > S2 then 1 else 0;
plot SecondAggPlot = if isNaN(cl)
then double.nan
else 2;
SecondAggPlot.SetStyle(Curve.Points);
SecondAggPlot.SetLineWeight(3);
SecondAggPlot.AssignValueColor(if SecondAgg == 1
then color.green
else color.red);
AddChartBubble(x, 2, (agg2/1000/60) + " min", color.white, yes);

# ThirdAgg
def h3 = Fundamental(Fh, period = agg3)[1];
def l3 = Fundamental(Fl, period = agg3)[1];
def c3 = Fundamental(Fc, period = agg3)[1];
def hl3 = Fundamental(Fhl2, period = agg3)[1];
def ATR3 = MovingAverage(AvgType, TrueRange(h3, c3, l3), nATR);
def UP3 = hl3 + (AtrMult * ATR3);
def DN3 = hl3 + (-AtrMult * ATR3);
def S3 = if c3 < S3[1]
then Round(UP3 / tickSize(), 0) * tickSize()
else Round(DN3 / tickSize(), 0) * tickSize();
def ThirdAgg = if c3 > S3 then 1 else 0;
plot ThirdAggPlot = if isNaN(cl)
then double.nan
else 3;
ThirdAggPlot.SetStyle(Curve.Points);
ThirdAggPlot.SetLineWeight(3);
ThirdAggPlot.AssignValueColor(if ThirdAgg == 1
then color.green
else color.red);
AddChartBubble(x, 3, (agg3/1000/60) + " min", color.white, yes);

# FourthAgg
def h4 = Fundamental(Fh, period = agg4)[1];
def l4 = Fundamental(Fl, period = agg4)[1];
def c4 = Fundamental(Fc, period = agg4)[1];
def hl4 = Fundamental(Fhl2, period = agg4)[1];
def ATR4 = MovingAverage(AvgType, TrueRange(h4, c4, l4), nATR);
def UP4 = hl4 + (AtrMult * ATR4);
def DN4 = hl4 + (-AtrMult * ATR4);
def S4 = if c4 < S4[1]
then Round(UP4 / tickSize(), 0) * tickSize()
else Round(DN4 / tickSize(), 0) * tickSize();
def FourthAgg = if c4 > S4 then 1 else 0;
plot FourthAggPlot = if isNaN(cl)
then double.nan
else 4;
FourthAggPlot.SetStyle(Curve.Points);
FourthAggPlot.SetLineWeight(3);
FourthAggPlot.AssignValueColor(if FourthAgg == 1
then color.green
else color.red);
AddChartBubble(x, 4, (agg4/1000/60) + " min", color.white, yes);

# FifthAgg
def h5 = Fundamental(Fh, period = agg5)[1];
def l5 = Fundamental(Fl, period = agg5)[1];
def c5 = Fundamental(Fc, period = agg5)[1];
def hl5 = Fundamental(Fhl2, period = agg5)[1];
def ATR5 = MovingAverage(AvgType, TrueRange(h5, c5, l5), nATR);
def UP5 = hl5 + (AtrMult * ATR5);
def DN5 = hl5 + (-AtrMult * ATR5);
def S5 = if c5 < S5[1]
then Round(UP5 / tickSize(), 0) * tickSize()
else Round(DN5 / tickSize(), 0) * tickSize();
def FifthAgg = if c5 > S5 then 1 else 0;
plot FifthAggPlot = if isNaN(cl)
then double.nan
else 5;
FifthAggPlot.SetStyle(Curve.Points);
FifthAggPlot.SetLineWeight(3);
FifthAggPlot.AssignValueColor(if FifthAgg == 1
then color.green
else color.red);
AddChartBubble(x, 5, (agg5/1000/60)+ " min", color.white, yes);
plot Six = if isNaN(cl)
then double.nan
else 6;
Six.SetStyle(Curve.Points);
Six.SetLineWeight(3);
Six.AssignValueColor(if FirstAgg and
SecondAgg and
ThirdAgg and
FourthAgg and
FifthAgg
then color.green
else if !FirstAgg and
!SecondAgg and
!ThirdAgg and
!FourthAgg and
!FifthAgg
then color.red
else color.black);
# End Code ST MTF
@tomsk Interesting...is this particular study ONLY suppose to work on anything less than 10 min timeframe? Seems when put that on a 15 min and up timeframe nothing shows...just want to make sure that's how it's suppose to be. ALSO what I noticed...For example when I was on a 3 min time frame and I changed to the first AGG input from 5 min to 3 min...followed by changing the second AGG to 5 min...the third AGG to 10 etc...The issue was that the first AGG that was set to 3 min gave readings as if it was on the 5 min...Raising a question if anything below 5 min timeframe will show up correctly when the AGG times are changed from 5m 10m 15m and so on...
 
@HighBredCloud - You have to respect the manner in which the secondary aggregation is being defined. I have modified the input values for the various secondary aggregations. Load the following on a 15 min chart of AAPL

Code:
# SuperTrend Multiple Time Frames
# Mobius with mods by tomsk to replace the script() function for secondary aggs with "standard" code
# V03.01.2016
# 11.4.2019

declare lower;

input agg1 = AggregationPeriod.Fifteen_Min;
input agg2 = AggregationPeriod.Thirty_Min;
input agg3 = AggregationPeriod.Hour;
input agg4 = AggregationPeriod.Two_Hours;
input agg5 = AggregationPeriod.DAY;
input AtrMult = .70;
input nATR = 4;
input AvgType = AverageType.HULL;

def Fh = FundamentalType.High;
def Fl = FundamentalType.Low;
def Fc = FundamentalType.Close;
def Fhl2 = FundamentalType.HL2;

def cl = close;
def x = isNaN(cl[2]) and !isNaN(cl[3]);
def ATR = MovingAverage(AvgType, TrueRange(high, close, low), nATR);
def UP = hl2 + (AtrMult * ATR);
def DN = hl2 + (-AtrMult * ATR);
def S = if close < S[1]
then Round(UP / tickSize(), 0) * tickSize()
else Round(DN / tickSize(), 0) * tickSize();
def FirstAgg = if close > S then 1 else 0;
plot FirstAggPlot = if isNaN(cl)
then double.nan
else 1;
FirstAggPlot.SetStyle(Curve.Points);
FirstAggPlot.SetLineWeight(3);
FirstAggPlot.AssignValueColor(if FirstAgg == 1
then color.green
else color.red);
AddChartBubble(x, 1, (GetAggregationPeriod()/1000/60) + " min", color.white, yes);

# SecondAgg
def h2 = Fundamental(Fh, period = agg2)[1];
def l2 = Fundamental(Fl, period = agg2)[1];
def c2 = Fundamental(Fc, period = agg2)[1];
def hl2 = Fundamental(Fhl2, period = agg2)[1];
def ATR2 = MovingAverage(AvgType, TrueRange(h2, c2, l2), nATR);
def UP2 = hl2 + (AtrMult * ATR2);
def DN2 = hl2 + (-AtrMult * ATR2);
def S2 = if c2 < S2[1]
then Round(UP2 / tickSize(), 0) * tickSize()
else Round(DN2 / tickSize(), 0) * tickSize();
def SecondAgg = if c2 > S2 then 1 else 0;
plot SecondAggPlot = if isNaN(cl)
then double.nan
else 2;
SecondAggPlot.SetStyle(Curve.Points);
SecondAggPlot.SetLineWeight(3);
SecondAggPlot.AssignValueColor(if SecondAgg == 1
then color.green
else color.red);
AddChartBubble(x, 2, (agg2/1000/60) + " min", color.white, yes);

# ThirdAgg
def h3 = Fundamental(Fh, period = agg3)[1];
def l3 = Fundamental(Fl, period = agg3)[1];
def c3 = Fundamental(Fc, period = agg3)[1];
def hl3 = Fundamental(Fhl2, period = agg3)[1];
def ATR3 = MovingAverage(AvgType, TrueRange(h3, c3, l3), nATR);
def UP3 = hl3 + (AtrMult * ATR3);
def DN3 = hl3 + (-AtrMult * ATR3);
def S3 = if c3 < S3[1]
then Round(UP3 / tickSize(), 0) * tickSize()
else Round(DN3 / tickSize(), 0) * tickSize();
def ThirdAgg = if c3 > S3 then 1 else 0;
plot ThirdAggPlot = if isNaN(cl)
then double.nan
else 3;
ThirdAggPlot.SetStyle(Curve.Points);
ThirdAggPlot.SetLineWeight(3);
ThirdAggPlot.AssignValueColor(if ThirdAgg == 1
then color.green
else color.red);
AddChartBubble(x, 3, (agg3/1000/60) + " min", color.white, yes);

# FourthAgg
def h4 = Fundamental(Fh, period = agg4)[1];
def l4 = Fundamental(Fl, period = agg4)[1];
def c4 = Fundamental(Fc, period = agg4)[1];
def hl4 = Fundamental(Fhl2, period = agg4)[1];
def ATR4 = MovingAverage(AvgType, TrueRange(h4, c4, l4), nATR);
def UP4 = hl4 + (AtrMult * ATR4);
def DN4 = hl4 + (-AtrMult * ATR4);
def S4 = if c4 < S4[1]
then Round(UP4 / tickSize(), 0) * tickSize()
else Round(DN4 / tickSize(), 0) * tickSize();
def FourthAgg = if c4 > S4 then 1 else 0;
plot FourthAggPlot = if isNaN(cl)
then double.nan
else 4;
FourthAggPlot.SetStyle(Curve.Points);
FourthAggPlot.SetLineWeight(3);
FourthAggPlot.AssignValueColor(if FourthAgg == 1
then color.green
else color.red);
AddChartBubble(x, 4, (agg4/1000/60) + " min", color.white, yes);

# FifthAgg
def h5 = Fundamental(Fh, period = agg5)[1];
def l5 = Fundamental(Fl, period = agg5)[1];
def c5 = Fundamental(Fc, period = agg5)[1];
def hl5 = Fundamental(Fhl2, period = agg5)[1];
def ATR5 = MovingAverage(AvgType, TrueRange(h5, c5, l5), nATR);
def UP5 = hl5 + (AtrMult * ATR5);
def DN5 = hl5 + (-AtrMult * ATR5);
def S5 = if c5 < S5[1]
then Round(UP5 / tickSize(), 0) * tickSize()
else Round(DN5 / tickSize(), 0) * tickSize();
def FifthAgg = if c5 > S5 then 1 else 0;
plot FifthAggPlot = if isNaN(cl)
then double.nan
else 5;
FifthAggPlot.SetStyle(Curve.Points);
FifthAggPlot.SetLineWeight(3);
FifthAggPlot.AssignValueColor(if FifthAgg == 1
then color.green
else color.red);
AddChartBubble(x, 5, (agg5/1000/60)+ " min", color.white, yes);
plot Six = if isNaN(cl)
then double.nan
else 6;
Six.SetStyle(Curve.Points);
Six.SetLineWeight(3);
Six.AssignValueColor(if FirstAgg and
SecondAgg and
ThirdAgg and
FourthAgg and
FifthAgg
then color.green
else if !FirstAgg and
!SecondAgg and
!ThirdAgg and
!FourthAgg and
!FifthAgg
then color.red
else color.black);
# End Code ST MTF
 
I believe you can only set th secondary aggs to time frames higher than the chart time frame, otherwise it will be messed up. That it seems is what he is telling you.
 
@HighBredCloud - You have to respect the manner in which the secondary aggregation is being defined. I have modified the input values for the various secondary aggregations. Load the following on a 15 min chart of AAPL


# SuperTrend Multiple Time Frames
# Mobius with mods by tomsk to replace the script() function for secondary aggs with "standard" code
# V03.01.2016
# 11.4.2019

declare lower;

input agg1 = AggregationPeriod.Fifteen_Min;
input agg2 = AggregationPeriod.Thirty_Min;
input agg3 = AggregationPeriod.Hour;
input agg4 = AggregationPeriod.Two_Hours;
input agg5 = AggregationPeriod.DAY;
input AtrMult = .70;
input nATR = 4;
input AvgType = AverageType.HULL;

def Fh = FundamentalType.High;
def Fl = FundamentalType.Low;
def Fc = FundamentalType.Close;
def Fhl2 = FundamentalType.HL2;

def cl = close;
def x = isNaN(cl[2]) and !isNaN(cl[3]);
def ATR = MovingAverage(AvgType, TrueRange(high, close, low), nATR);
def UP = hl2 + (AtrMult * ATR);
def DN = hl2 + (-AtrMult * ATR);
def S = if close < S[1]
then Round(UP / tickSize(), 0) * tickSize()
else Round(DN / tickSize(), 0) * tickSize();
def FirstAgg = if close > S then 1 else 0;
plot FirstAggPlot = if isNaN(cl)
then double.nan
else 1;
FirstAggPlot.SetStyle(Curve.Points);
FirstAggPlot.SetLineWeight(3);
FirstAggPlot.AssignValueColor(if FirstAgg == 1
then color.green
else color.red);
AddChartBubble(x, 1, (GetAggregationPeriod()/1000/60) + " min", color.white, yes);

# SecondAgg
def h2 = Fundamental(Fh, period = agg2)[1];
def l2 = Fundamental(Fl, period = agg2)[1];
def c2 = Fundamental(Fc, period = agg2)[1];
def hl2 = Fundamental(Fhl2, period = agg2)[1];
def ATR2 = MovingAverage(AvgType, TrueRange(h2, c2, l2), nATR);
def UP2 = hl2 + (AtrMult * ATR2);
def DN2 = hl2 + (-AtrMult * ATR2);
def S2 = if c2 < S2[1]
then Round(UP2 / tickSize(), 0) * tickSize()
else Round(DN2 / tickSize(), 0) * tickSize();
def SecondAgg = if c2 > S2 then 1 else 0;
plot SecondAggPlot = if isNaN(cl)
then double.nan
else 2;
SecondAggPlot.SetStyle(Curve.Points);
SecondAggPlot.SetLineWeight(3);
SecondAggPlot.AssignValueColor(if SecondAgg == 1
then color.green
else color.red);
AddChartBubble(x, 2, (agg2/1000/60) + " min", color.white, yes);

# ThirdAgg
def h3 = Fundamental(Fh, period = agg3)[1];
def l3 = Fundamental(Fl, period = agg3)[1];
def c3 = Fundamental(Fc, period = agg3)[1];
def hl3 = Fundamental(Fhl2, period = agg3)[1];
def ATR3 = MovingAverage(AvgType, TrueRange(h3, c3, l3), nATR);
def UP3 = hl3 + (AtrMult * ATR3);
def DN3 = hl3 + (-AtrMult * ATR3);
def S3 = if c3 < S3[1]
then Round(UP3 / tickSize(), 0) * tickSize()
else Round(DN3 / tickSize(), 0) * tickSize();
def ThirdAgg = if c3 > S3 then 1 else 0;
plot ThirdAggPlot = if isNaN(cl)
then double.nan
else 3;
ThirdAggPlot.SetStyle(Curve.Points);
ThirdAggPlot.SetLineWeight(3);
ThirdAggPlot.AssignValueColor(if ThirdAgg == 1
then color.green
else color.red);
AddChartBubble(x, 3, (agg3/1000/60) + " min", color.white, yes);

# FourthAgg
def h4 = Fundamental(Fh, period = agg4)[1];
def l4 = Fundamental(Fl, period = agg4)[1];
def c4 = Fundamental(Fc, period = agg4)[1];
def hl4 = Fundamental(Fhl2, period = agg4)[1];
def ATR4 = MovingAverage(AvgType, TrueRange(h4, c4, l4), nATR);
def UP4 = hl4 + (AtrMult * ATR4);
def DN4 = hl4 + (-AtrMult * ATR4);
def S4 = if c4 < S4[1]
then Round(UP4 / tickSize(), 0) * tickSize()
else Round(DN4 / tickSize(), 0) * tickSize();
def FourthAgg = if c4 > S4 then 1 else 0;
plot FourthAggPlot = if isNaN(cl)
then double.nan
else 4;
FourthAggPlot.SetStyle(Curve.Points);
FourthAggPlot.SetLineWeight(3);
FourthAggPlot.AssignValueColor(if FourthAgg == 1
then color.green
else color.red);
AddChartBubble(x, 4, (agg4/1000/60) + " min", color.white, yes);

# FifthAgg
def h5 = Fundamental(Fh, period = agg5)[1];
def l5 = Fundamental(Fl, period = agg5)[1];
def c5 = Fundamental(Fc, period = agg5)[1];
def hl5 = Fundamental(Fhl2, period = agg5)[1];
def ATR5 = MovingAverage(AvgType, TrueRange(h5, c5, l5), nATR);
def UP5 = hl5 + (AtrMult * ATR5);
def DN5 = hl5 + (-AtrMult * ATR5);
def S5 = if c5 < S5[1]
then Round(UP5 / tickSize(), 0) * tickSize()
else Round(DN5 / tickSize(), 0) * tickSize();
def FifthAgg = if c5 > S5 then 1 else 0;
plot FifthAggPlot = if isNaN(cl)
then double.nan
else 5;
FifthAggPlot.SetStyle(Curve.Points);
FifthAggPlot.SetLineWeight(3);
FifthAggPlot.AssignValueColor(if FifthAgg == 1
then color.green
else color.red);
AddChartBubble(x, 5, (agg5/1000/60)+ " min", color.white, yes);
plot Six = if isNaN(cl)
then double.nan
else 6;
Six.SetStyle(Curve.Points);
Six.SetLineWeight(3);
Six.AssignValueColor(if FirstAgg and
SecondAgg and
ThirdAgg and
FourthAgg and
FifthAgg
then color.green
else if !FirstAgg and
!SecondAgg and
!ThirdAgg and
!FourthAgg and
!FifthAgg
then color.red
else color.black);
# End Code ST MTF
@tomsk This works perfectly on 15 min now...I wanted to use this particular study as confirmation with a SuperTrend indicator I found in hopes that this study could avoid the repaint of the candles caused by the SuperTrend. So now I need to see IF this study repaints more or less than the SuperTrend that I am using. I only kept the 15 min AGG and turned off the rest...Just out of curiosity IF I were to delete the AGG's that I am not using from the code and only keep the 15 min would that somehow alter anything how the study is calculated? Or is it better just to uncheck the "show plot" ? Sorry I am not a coder...so I don't know such effects of actions. Here's what I had in mind.

 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
200 Online
Create Post

Similar threads

Similar threads

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