FTFC Strat Labels

PAYtience

Member
VIP
Can someone please help me add strat labels for previous 2 bars as well, currently it displays labels for current bar (5, 10 and 15 mins).

Code:
#Define global colors for light-to-dark labels (1,2, 3, upside/downside)
DefineGlobalColor("3up",   CreateColor(000, 050, 025));
DefineGlobalColor("2up",   CreateColor(000, 075, 010));
DefineGlobalColor("1up",   CreateColor(050, 135, 055));
DefineGlobalColor("3down", CreateColor(125, 010, 010));
DefineGlobalColor("2down", CreateColor(175, 025, 025));
DefineGlobalColor("1down", CreateColor(175, 050, 065));

#Color labels Red/Green only for all bar types
#DefineGlobalColor("greenTimeframe", CreateColor(000, 100, 000));
#DefineGlobalColor("redTimeframe", CreateColor(100, 000, 000));


#Show only on intraday charts (thinkscript/ToS is
#declare hide_on_daily;



input showMin         = yes;#Hint showMin: 1 minute\nStrat "the Oner"\nIntraday timeframe

input showFive_Min    = yes;#Hint
input showTen_Min     = yes;#Hint
input showFifteen_Min = yes;#Hint


### Five_Min AGGREGATION PERIOD ###

def tfFive_Min = AggregationPeriod.FIVE_MIN;
def hFive_Min;
def lFive_Min;
def oFive_Min;
def cFive_Min;
def grnFive_Min;
def redFive_Min;
def onebarFive_Min;
def twobarFive_Min;
def thrbarFive_Min;

if GetAggregationPeriod() <= AggregationPeriod.FIVE_MIN {
    hFive_Min = high (period = tfFive_Min);
    lFive_Min = low  (period = tfFive_Min);
    oFive_Min = open (period = tfFive_Min);
    cFive_Min = close(period = tfFive_Min);
    onebarFive_Min = hFive_Min <= hFive_Min[1] && lFive_Min >= lFive_Min[1];
    twobarFive_Min = hFive_Min <= hFive_Min[1] && lFive_Min <  lFive_Min[1] or
               hFive_Min  > hFive_Min[1] && lFive_Min >= lFive_Min[1];
    thrbarFive_Min = hFive_Min  > hFive_Min[1] && lFive_Min <  lFive_Min[1];
    grnFive_Min = oFive_Min <= cFive_Min;
    redFive_Min = oFive_Min >= cFive_Min;

} else {
    hFive_Min = 0;
    lFive_Min = 0;
    oFive_Min = 0;
    cFive_Min = 0;
    grnFive_Min = Double.NaN;
    redFive_Min = Double.NaN;
    onebarFive_Min = Double.NaN;
    twobarFive_Min = Double.NaN;
    thrbarFive_Min = Double.NaN;
}

#Color labels Red/Green only for all bar types
#AddLabel(showFive_Min, "5m", GlobalColor("greenTimeframe");
#AddLabel(showFive_Min, "5m", GlobalColor("redTimeframe");

AddLabel(showFive_Min, "5",
     if onebarFive_Min && grnFive_Min then GlobalColor("1Up")
else if twobarFive_Min && grnFive_Min then GlobalColor("2Up")
else if thrbarFive_Min && grnFive_Min then GlobalColor("3Up")
else if onebarFive_Min && redFive_Min then GlobalColor("1Down")
else if twobarFive_Min && redFive_Min then GlobalColor("2Down")
else if thrbarFive_Min && redFive_Min then GlobalColor("3Down")
else Color.GRAY);




### Ten_Min AGGREGATION PERIOD ###

def tfTEN_Min = AggregationPeriod.TEN_MIN;
def hTEN_Min;
def lTEN_Min;
def oTEN_Min;
def cTEN_Min;
def grnTEN_Min;
def redTEN_Min;
def onebarTEN_Min;
def twobarTEN_Min;
def thrbarTEN_Min;

if GetAggregationPeriod() <= AggregationPeriod.TEN_MIN {
    hTEN_Min = high (period = tfTEN_Min);
    lTEN_Min = low  (period = tfTEN_Min);
    oTEN_Min = open (period = tfTEN_Min);
    cTEN_Min = close(period = tfTEN_Min);
    onebarTEN_Min = hTEN_Min <= hTEN_Min[1] && lTEN_Min >= lTEN_Min[1];
    twobarTEN_Min = hTEN_Min <= hTEN_Min[1] && lTEN_Min <  lTEN_Min[1] or
               hTEN_Min  > hTEN_Min[1] && lTEN_Min >= lTEN_Min[1];
    thrbarTEN_Min = hTEN_Min  > hTEN_Min[1] && lTEN_Min <  lTEN_Min[1];
    grnTEN_Min = oTEN_Min <= cTEN_Min;
    redTEN_Min = oTEN_Min >= cTEN_Min;

} else {
    hTEN_Min = 0;
    lTEN_Min = 0;
    oTEN_Min = 0;
    cTEN_Min = 0;
    grnTEN_Min = Double.NaN;
    redTEN_Min = Double.NaN;
    onebarTEN_Min = Double.NaN;
    twobarTEN_Min = Double.NaN;
    thrbarTEN_Min = Double.NaN;
}

#Color labels Red/Green only for all bar types
#AddLabel(showTEN_Min, "5m", GlobalColor("greenTimeframe");
#AddLabel(showTEN_Min, "5m", GlobalColor("redTimeframe");

AddLabel(showTEN_Min, "10",
     if onebarTEN_Min && grnTEN_Min then GlobalColor("1Up")
else if twobarTEN_Min && grnTEN_Min then GlobalColor("2Up")
else if thrbarTEN_Min && grnTEN_Min then GlobalColor("3Up")
else if onebarTEN_Min && redTEN_Min then GlobalColor("1Down")
else if twobarTEN_Min && redTEN_Min then GlobalColor("2Down")
else if thrbarTEN_Min && redTEN_Min then GlobalColor("3Down")
else Color.GRAY);





### Fifteen_Min AGGREGATION PERIOD ###

def tfFifteen_Min = AggregationPeriod.FIFTEEN_MIN;
def hFifteen_Min;
def lFifteen_Min;
def oFifteen_Min;
def cFifteen_Min;
def grnFifteen_Min;
def redFifteen_Min;
def onebarFifteen_Min;
def twobarFifteen_Min;
def thrbarFifteen_Min;

if GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN {
    hFifteen_Min = high (period = tfFifteen_Min);
    lFifteen_Min = low  (period = tfFifteen_Min);
    oFifteen_Min = open (period = tfFifteen_Min);
    cFifteen_Min = close(period = tfFifteen_Min);
    onebarFifteen_Min = hFifteen_Min <= hFifteen_Min[1] && lFifteen_Min >= lFifteen_Min[1];
    twobarFifteen_Min = hFifteen_Min <= hFifteen_Min[1] && lFifteen_Min <  lFifteen_Min[1] or
   hFifteen_Min  > hFifteen_Min[1] && lFifteen_Min >= lFifteen_Min[1];
    thrbarFifteen_Min = hFifteen_Min  > hFifteen_Min[1] && lFifteen_Min <  lFifteen_Min[1];
    grnFifteen_Min = oFifteen_Min <= cFifteen_Min;
    redFifteen_Min = oFifteen_Min >= cFifteen_Min;

} else {
    hFifteen_Min = 0;
    lFifteen_Min = 0;
    oFifteen_Min = 0;
    cFifteen_Min = 0;
    grnFifteen_Min = Double.NaN;
    redFifteen_Min = Double.NaN;
    onebarFifteen_Min = Double.NaN;
    twobarFifteen_Min = Double.NaN;
    thrbarFifteen_Min = Double.NaN;
}

#Color labels Red/Green only for all bar types
#AddLabel(showFifteen_Min, "15", GlobalColor("greenTimeframe");
#AddLabel(showFifteen_Min, "15", GlobalColor("redTimeframe");

AddLabel(showFifteen_Min, "15",
     if onebarFifteen_Min && grnFifteen_Min then GlobalColor("1Up")
else if twobarFifteen_Min && grnFifteen_Min then GlobalColor("2Up")
else if thrbarFifteen_Min && grnFifteen_Min then GlobalColor("3Up")
else if onebarFifteen_Min && redFifteen_Min then GlobalColor("1Down")
else if twobarFifteen_Min && redFifteen_Min then GlobalColor("2Down")
else if thrbarFifteen_Min && redFifteen_Min then GlobalColor("3Down")
else Color.GRAY);

Will if work if I add [-1] after the agg here -> def tfFive_Min = AggregationPeriod.FIVE_MIN

Or Something similar, I tried but was not working.


I know I will have to make changes here as well to look back even further-

onebarFifteen_Min = hFifteen_Min <= hFifteen_Min[1] && lFifteen_Min >= lFifteen_Min[1];
twobarFifteen_Min = hFifteen_Min <= hFifteen_Min[1] && lFifteen_Min < lFifteen_Min[1] or
hFifteen_Min > hFifteen_Min[1] && lFifteen_Min >= lFifteen_Min[1];
thrbarFifteen_Min = hFifteen_Min > hFifteen_Min[1] && lFifteen_Min < lFifteen_Min[1];

An example of what to update will be really helpful.

Can someone please help with? :)

I know it might be little hectic and time consuming.
 
Last edited by a moderator:
Solution
Can someone please help me add strat labels for previous 2 bars as well, currently it displays labels for current bar (5, 10 and 15 mins).

Code:
#Define global colors for light-to-dark labels (1,2, 3, upside/downside)
DefineGlobalColor("3up",   CreateColor(000, 050, 025));
DefineGlobalColor("2up",   CreateColor(000, 075, 010));
DefineGlobalColor("1up",   CreateColor(050, 135, 055));
DefineGlobalColor("3down", CreateColor(125, 010, 010));
DefineGlobalColor("2down", CreateColor(175, 025, 025));
DefineGlobalColor("1down", CreateColor(175, 050, 065));

#Color labels Red/Green only for all bar types
#DefineGlobalColor("greenTimeframe", CreateColor(000, 100, 000));
#DefineGlobalColor("redTimeframe", CreateColor(100, 000, 000));


#Show...
Can someone please help me add strat labels for previous 2 bars as well, currently it displays labels for current bar (5, 10 and 15 mins).

Code:
#Define global colors for light-to-dark labels (1,2, 3, upside/downside)
DefineGlobalColor("3up",   CreateColor(000, 050, 025));
DefineGlobalColor("2up",   CreateColor(000, 075, 010));
DefineGlobalColor("1up",   CreateColor(050, 135, 055));
DefineGlobalColor("3down", CreateColor(125, 010, 010));
DefineGlobalColor("2down", CreateColor(175, 025, 025));
DefineGlobalColor("1down", CreateColor(175, 050, 065));

#Color labels Red/Green only for all bar types
#DefineGlobalColor("greenTimeframe", CreateColor(000, 100, 000));
#DefineGlobalColor("redTimeframe", CreateColor(100, 000, 000));


#Show only on intraday charts (thinkscript/ToS is
#declare hide_on_daily;



input showMin         = yes;#Hint showMin: 1 minute\nStrat "the Oner"\nIntraday timeframe

input showFive_Min    = yes;#Hint
input showTen_Min     = yes;#Hint
input showFifteen_Min = yes;#Hint


### Five_Min AGGREGATION PERIOD ###

def tfFive_Min = AggregationPeriod.FIVE_MIN;
def hFive_Min;
def lFive_Min;
def oFive_Min;
def cFive_Min;
def grnFive_Min;
def redFive_Min;
def onebarFive_Min;
def twobarFive_Min;
def thrbarFive_Min;

if GetAggregationPeriod() <= AggregationPeriod.FIVE_MIN {
    hFive_Min = high (period = tfFive_Min);
    lFive_Min = low  (period = tfFive_Min);
    oFive_Min = open (period = tfFive_Min);
    cFive_Min = close(period = tfFive_Min);
    onebarFive_Min = hFive_Min <= hFive_Min[1] && lFive_Min >= lFive_Min[1];
    twobarFive_Min = hFive_Min <= hFive_Min[1] && lFive_Min <  lFive_Min[1] or
               hFive_Min  > hFive_Min[1] && lFive_Min >= lFive_Min[1];
    thrbarFive_Min = hFive_Min  > hFive_Min[1] && lFive_Min <  lFive_Min[1];
    grnFive_Min = oFive_Min <= cFive_Min;
    redFive_Min = oFive_Min >= cFive_Min;

} else {
    hFive_Min = 0;
    lFive_Min = 0;
    oFive_Min = 0;
    cFive_Min = 0;
    grnFive_Min = Double.NaN;
    redFive_Min = Double.NaN;
    onebarFive_Min = Double.NaN;
    twobarFive_Min = Double.NaN;
    thrbarFive_Min = Double.NaN;
}

#Color labels Red/Green only for all bar types
#AddLabel(showFive_Min, "5m", GlobalColor("greenTimeframe");
#AddLabel(showFive_Min, "5m", GlobalColor("redTimeframe");

AddLabel(showFive_Min, "5",
     if onebarFive_Min && grnFive_Min then GlobalColor("1Up")
else if twobarFive_Min && grnFive_Min then GlobalColor("2Up")
else if thrbarFive_Min && grnFive_Min then GlobalColor("3Up")
else if onebarFive_Min && redFive_Min then GlobalColor("1Down")
else if twobarFive_Min && redFive_Min then GlobalColor("2Down")
else if thrbarFive_Min && redFive_Min then GlobalColor("3Down")
else Color.GRAY);




### Ten_Min AGGREGATION PERIOD ###

def tfTEN_Min = AggregationPeriod.TEN_MIN;
def hTEN_Min;
def lTEN_Min;
def oTEN_Min;
def cTEN_Min;
def grnTEN_Min;
def redTEN_Min;
def onebarTEN_Min;
def twobarTEN_Min;
def thrbarTEN_Min;

if GetAggregationPeriod() <= AggregationPeriod.TEN_MIN {
    hTEN_Min = high (period = tfTEN_Min);
    lTEN_Min = low  (period = tfTEN_Min);
    oTEN_Min = open (period = tfTEN_Min);
    cTEN_Min = close(period = tfTEN_Min);
    onebarTEN_Min = hTEN_Min <= hTEN_Min[1] && lTEN_Min >= lTEN_Min[1];
    twobarTEN_Min = hTEN_Min <= hTEN_Min[1] && lTEN_Min <  lTEN_Min[1] or
               hTEN_Min  > hTEN_Min[1] && lTEN_Min >= lTEN_Min[1];
    thrbarTEN_Min = hTEN_Min  > hTEN_Min[1] && lTEN_Min <  lTEN_Min[1];
    grnTEN_Min = oTEN_Min <= cTEN_Min;
    redTEN_Min = oTEN_Min >= cTEN_Min;

} else {
    hTEN_Min = 0;
    lTEN_Min = 0;
    oTEN_Min = 0;
    cTEN_Min = 0;
    grnTEN_Min = Double.NaN;
    redTEN_Min = Double.NaN;
    onebarTEN_Min = Double.NaN;
    twobarTEN_Min = Double.NaN;
    thrbarTEN_Min = Double.NaN;
}

#Color labels Red/Green only for all bar types
#AddLabel(showTEN_Min, "5m", GlobalColor("greenTimeframe");
#AddLabel(showTEN_Min, "5m", GlobalColor("redTimeframe");

AddLabel(showTEN_Min, "10",
     if onebarTEN_Min && grnTEN_Min then GlobalColor("1Up")
else if twobarTEN_Min && grnTEN_Min then GlobalColor("2Up")
else if thrbarTEN_Min && grnTEN_Min then GlobalColor("3Up")
else if onebarTEN_Min && redTEN_Min then GlobalColor("1Down")
else if twobarTEN_Min && redTEN_Min then GlobalColor("2Down")
else if thrbarTEN_Min && redTEN_Min then GlobalColor("3Down")
else Color.GRAY);





### Fifteen_Min AGGREGATION PERIOD ###

def tfFifteen_Min = AggregationPeriod.FIFTEEN_MIN;
def hFifteen_Min;
def lFifteen_Min;
def oFifteen_Min;
def cFifteen_Min;
def grnFifteen_Min;
def redFifteen_Min;
def onebarFifteen_Min;
def twobarFifteen_Min;
def thrbarFifteen_Min;

if GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN {
    hFifteen_Min = high (period = tfFifteen_Min);
    lFifteen_Min = low  (period = tfFifteen_Min);
    oFifteen_Min = open (period = tfFifteen_Min);
    cFifteen_Min = close(period = tfFifteen_Min);
    onebarFifteen_Min = hFifteen_Min <= hFifteen_Min[1] && lFifteen_Min >= lFifteen_Min[1];
    twobarFifteen_Min = hFifteen_Min <= hFifteen_Min[1] && lFifteen_Min <  lFifteen_Min[1] or
   hFifteen_Min  > hFifteen_Min[1] && lFifteen_Min >= lFifteen_Min[1];
    thrbarFifteen_Min = hFifteen_Min  > hFifteen_Min[1] && lFifteen_Min <  lFifteen_Min[1];
    grnFifteen_Min = oFifteen_Min <= cFifteen_Min;
    redFifteen_Min = oFifteen_Min >= cFifteen_Min;

} else {
    hFifteen_Min = 0;
    lFifteen_Min = 0;
    oFifteen_Min = 0;
    cFifteen_Min = 0;
    grnFifteen_Min = Double.NaN;
    redFifteen_Min = Double.NaN;
    onebarFifteen_Min = Double.NaN;
    twobarFifteen_Min = Double.NaN;
    thrbarFifteen_Min = Double.NaN;
}

#Color labels Red/Green only for all bar types
#AddLabel(showFifteen_Min, "15", GlobalColor("greenTimeframe");
#AddLabel(showFifteen_Min, "15", GlobalColor("redTimeframe");

AddLabel(showFifteen_Min, "15",
     if onebarFifteen_Min && grnFifteen_Min then GlobalColor("1Up")
else if twobarFifteen_Min && grnFifteen_Min then GlobalColor("2Up")
else if thrbarFifteen_Min && grnFifteen_Min then GlobalColor("3Up")
else if onebarFifteen_Min && redFifteen_Min then GlobalColor("1Down")
else if twobarFifteen_Min && redFifteen_Min then GlobalColor("2Down")
else if thrbarFifteen_Min && redFifteen_Min then GlobalColor("3Down")
else Color.GRAY);

Will if work if I add [-1] after the agg here -> def tfFive_Min = AggregationPeriod.FIVE_MIN

Or Something similar, I tried but was not working.


I know I will have to make changes here as well to look back even further-

onebarFifteen_Min = hFifteen_Min <= hFifteen_Min[1] && lFifteen_Min >= lFifteen_Min[1];
twobarFifteen_Min = hFifteen_Min <= hFifteen_Min[1] && lFifteen_Min < lFifteen_Min[1] or
hFifteen_Min > hFifteen_Min[1] && lFifteen_Min >= lFifteen_Min[1];
thrbarFifteen_Min = hFifteen_Min > hFifteen_Min[1] && lFifteen_Min < lFifteen_Min[1];

An example of what to update will be really helpful.

Can someone please help with? :)

I know it might be little hectic and time consuming.

since you have 3 code sections, with essentially the same code, i rewrote the study, to use 1 of those sections, modified it, and put it in a script.
this script is a sub routine, that calculates a number , -3,-2,-1,0,1,2,3


Code:
#strat_ftfc_labels

#https://usethinkscript.com/threads/ftfc-strat-labels.19264/
#FTFC Strat Labels
#PAYtience  Start dateTuesday at 9:30 PM  TagsNone
##1
#Can someone please help me add strat labels for previous 2 bars as well, currently it displays labels for current bar (5, 10 and 15 mins).


def na = double.nan;
def bn = barnumber();

#Define global colors for light-to-dark labels (1,2, 3, upside/downside)
DefineGlobalColor("3up",   CreateColor(000, 050, 025));
DefineGlobalColor("2up",   CreateColor(000, 075, 010));
DefineGlobalColor("1up",   CreateColor(050, 135, 055));
DefineGlobalColor("3down", CreateColor(125, 010, 010));
DefineGlobalColor("2down", CreateColor(175, 025, 025));
DefineGlobalColor("1down", CreateColor(175, 050, 065));

input showMin         = yes;
#Hint showMin: 1 minute\nStrat "the Oner"\nIntraday timeframe
input showFive_Min    = yes;
input showTen_Min     = yes;
input showFifteen_Min = yes;

script strat {
  input agg = AggregationPeriod.FIVE_MIN;
  input offset = 0;
  def h;
  def l;
  def o;
  def c;
  def s;
  def dir;
  if GetAggregationPeriod() <= agg then {
    h = high(period = agg)[offset];
    l = low(period = agg)[offset];
    o = open(period = agg)[offset];
    c = close(period = agg)[offset];
    s = if (h <= h[1] and l >= l[1]) then 1
      else if ((h <= h[1] and l < l[1]) or (h > h[1] and l >= l[1])) then 2
      else if (h > h[1] and l < l[1]) then 3
      else 0;
    dir = if (o <= c) then 1 else if (o >= c) then -1 else 0;
  } else {
    h = 0;
    l = 0;
    o = 0;
    c = 0;
    s = 0;
    dir = 0;
  }

# a number ,  -3,-2,-1,0,1,2,3
plot z = (s * dir);
}


input agg1 = AggregationPeriod.FIVE_MIN;
input agg2 = AggregationPeriod.TEN_MIN;
input agg3 = AggregationPeriod.FIFTEEN_MIN;
def agg1min = agg1/60000;
def agg2min = agg2/60000;
def agg3min = agg3/60000;

#------------------
# 2 bars back

input bars_back2 = 2;
def s1b = strat(agg1,bars_back2);
def s2b = strat(agg2,bars_back2);
def s3b = strat(agg3,bars_back2);

addlabel(1, "  ", color.black);
addlabel(1, "bars back: " + bars_back2, color.yellow);
addlabel(1, agg1min,
 (if s1b == 1 then GlobalColor("1Up")
 else if s1b == 2 then GlobalColor("2Up")
 else if s1b == 3 then GlobalColor("3Up")
 else if s1b == -1 then GlobalColor("1Down")
 else if s1b == -2 then GlobalColor("2Down")
 else if s1b == -3 then GlobalColor("3Down")
 else color.black));

addlabel(1, agg2min,
  (if s2b == 1 then GlobalColor("1Up")
  else if s2b == 2 then GlobalColor("2Up")
  else if s2b == 3 then GlobalColor("3Up")
  else if s2b == -1 then GlobalColor("1Down")
  else if s2b == -2 then GlobalColor("2Down")
  else if s2b == -3 then GlobalColor("3Down")
  else color.black));

addlabel(1, agg3min,
  (if s3b == 1 then GlobalColor("1Up")
  else if s3b == 2 then GlobalColor("2Up")
  else if s3b == 3 then GlobalColor("3Up")
  else if s3b == -1 then GlobalColor("1Down")
  else if s3b == -2 then GlobalColor("2Down")
  else if s3b == -3 then GlobalColor("3Down")
  else color.black));


# 1 bar back
input bars_back1 = 1;
def s1a = strat(agg1,bars_back1);
def s2a = strat(agg2,bars_back1);
def s3a = strat(agg3,bars_back1);

addlabel(1, "  ", color.black);
addlabel(1, "bars back: " + bars_back1, color.yellow);
addlabel(1, agg1min,
 (if s1a == 1 then GlobalColor("1Up")
 else if s1a == 2 then GlobalColor("2Up")
 else if s1a == 3 then GlobalColor("3Up")
 else if s1a == -1 then GlobalColor("1Down")
 else if s1a == -2 then GlobalColor("2Down")
 else if s1a == -3 then GlobalColor("3Down")
 else color.black));

addlabel(1, agg2min,
  (if s2a == 1 then GlobalColor("1Up")
  else if s2a == 2 then GlobalColor("2Up")
  else if s2a == 3 then GlobalColor("3Up")
  else if s2a == -1 then GlobalColor("1Down")
  else if s2a == -2 then GlobalColor("2Down")
  else if s2a == -3 then GlobalColor("3Down")
  else color.black));

addlabel(1, agg3min,
  (if s3a == 1 then GlobalColor("1Up")
  else if s3a == 2 then GlobalColor("2Up")
  else if s3a == 3 then GlobalColor("3Up")
  else if s3a == -1 then GlobalColor("1Down")
  else if s3a == -2 then GlobalColor("2Down")
  else if s3a == -3 then GlobalColor("3Down")
  else color.black));

#  current bar
input bars_back0 = 0;
def s1 = strat(agg1,bars_back0);
def s2 = strat(agg2,bars_back0);
def s3 = strat(agg3,bars_back0);

addlabel(1, "  ", color.black);
addlabel(1, "bars back: " + bars_back0, color.yellow);
addlabel(1, agg1min,
 (if s1 == 1 then GlobalColor("1Up")
 else if s1 == 2 then GlobalColor("2Up")
 else if s1 == 3 then GlobalColor("3Up")
 else if s1 == -1 then GlobalColor("1Down")
 else if s1 == -2 then GlobalColor("2Down")
 else if s1 == -3 then GlobalColor("3Down")
 else color.black));

addlabel(1, agg2min,
  (if s2 == 1 then GlobalColor("1Up")
  else if s2 == 2 then GlobalColor("2Up")
  else if s2 == 3 then GlobalColor("3Up")
  else if s2 == -1 then GlobalColor("1Down")
  else if s2 == -2 then GlobalColor("2Down")
  else if s2 == -3 then GlobalColor("3Down")
  else color.black));

addlabel(1, agg3min,
  (if s3 == 1 then GlobalColor("1Up")
  else if s3 == 2 then GlobalColor("2Up")
  else if s3 == 3 then GlobalColor("3Up")
  else if s3 == -1 then GlobalColor("1Down")
  else if s3 == -2 then GlobalColor("2Down")
  else if s3 == -3 then GlobalColor("3Down")
  else color.black));

addlabel(1, "  ", color.black);


#----------------------
input test1 = no;
addlabel(test1, s1,color.yellow);
addlabel(test1, s2,color.yellow);
addlabel(test1, s3,color.yellow);
#
 

Attachments

  • img1.JPG
    img1.JPG
    8.8 KB · Views: 87
Last edited:
Solution

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
373 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