TTrades Daily Bias For ThinkOrSwim

Glefdar

Active member
The author states:
this indicator aims to develop a higher timeframe bias. this indicator focuses on one specific method that utilizes previous highs and lows.

On the daily timeframe, there are a handful of possible scenarios that we consider: if price closes above its previous day high (PDH), the following day's bias will target PDH; if price trades above its PDH but closes back below it, the following day's bias will target its previous day low (PDL).
toN6A3J.png

If price trades as an inside bar that doesn't take either PDH or PDL, it will refer to the previous candle for bias. If the previous day closed above its open, it will target PDH and vice versa. If price trades as an outside bar that takes both PDH and PDL, but closes inside that range, no bias is assigned.
DP7BONf.png


cfoOzKU.png



https://www.tradingview.com/script/xdwgV3Fx-TTrades-Daily-Bias-TFO/

I couldn't tell for sure since I don't know pinescript, but I think this should be convertible. I don't think the logic needs arrays to function. It's an interesting and simple concept that can provide statistically measurable bias for session direction before the prior day high or prior day low is hit. If anyone who knows pinescript can take a crack at it, I think it would be a helpful addition to the library of converted scripts on UTS 🙏
 
Last edited by a moderator:
https://www.tradingview.com/script/xdwgV3Fx-TTrades-Daily-Bias-TFO/

I couldn't tell for sure since I don't know pinescript, but I think this should be convertible. I don't think the logic needs arrays to function. It's an interesting and simple concept that can provide statistically measurable bias for session direction before the prior day high or prior day low is hit. If anyone who knows pinescript can take a crack at it, I think it would be a helpful addition to the library of converted scripts on UTS 🙏
check the below.

CSS:
#/ This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © tradeforopp
#indicator("TTrades Daily Bias [TFO]", "TTrades Daily Bias [TFO]", true, max_lines_count = 500, max_labels_count = 500)
# Converted by Sam4Cok@Samer800    - 04/2024

input DailyBias = yes; # "Daily Bias", tooltip = "Apply TTrades bias concepts to the 1 Day timeframe", group = g_VIS)
input WeeklyBias = no; # "Weekly Bias", tooltip = "Apply TTrades bias concepts to the 1 Week timeframe", group = g_VIS)
input ShowBiasReasoning = yes; # "Show Bias Reasoning", tooltip = "Show the reason why a given bias is being established",
input PlotDailyBias = yes; # "Plot Daily Bias", inline = "DBIAS", group = g_PLT)
input PlotWeeklyBias = yes; # "Plot Weekly Bias", inline = "WBIAS", group = g_PLT)
input DaySeparator = no; # "Day Separator", inline = "DSEP", group = g_STY)
input WeekSeparator = no; # "Week Separator", inline = "WSEP", group = g_STY)

def na = Double.NaN;
def last = isNaN(close);
def tf = GetAggregationPeriod();
def day = GetDay();
def week = GetWeek();
def new_day = day != day[1];
def new_week = week != week[1];
def can_plot_d = DailyBias and tf < AggregationPeriod.DAY;
def can_plot_w = WeeklyBias and tf < AggregationPeriod.WEEK;

#--Color
DefineGlobalColor("bull", CreateColor(0,137,123)); #teal
DefineGlobalColor("bear", CreateColor(255,82,82));
DefineGlobalColor("up", CreateColor(33,150,243));
DefineGlobalColor("dn", CreateColor(255,82,82));
Script handle_bias {
input nph = high;
input npl = low;
input ncl = low;
input nch = high;
input np_up = yes;
input can_plot = yes;
input bias_reason = yes;
input tf = 1;
    def nbias;def txt;#def nclose_ph;def nclose_pl;
    if close[1] > nph {
#        nclose_ph = if nbias[1] == 1 then nclose_ph[1] + 1 else nclose_ph[1];
        nbias = 1;
        txt = if bias_reason and can_plot then 1 else 0;#"Close Above P"+tf+"H\nBias P"+tf+"H"
   } else if close[1] < npl {
#        nclose_pl = if nbias[1] == -1 then nclose_pl[1] + 1 else nclose_pl[1];
        nbias = -1;
        txt = if bias_reason and can_plot then 2 else 0; #"Close Below P"+tf+"L\nBias P"+tf+"L"
   } else if close[1] < nph and close[1] > npl and nch > nph and ncl > npl {
        nbias = -1;
        txt = if bias_reason and can_plot then 3 else 0; #"Failed to Close Above P"+tf+"H\nBias P"+tf+"L"
   } else if close[1] > npl and close[1] < nph and nch < nph and ncl < npl {
        nbias = 1;
        txt = if bias_reason and can_plot then 4 else 0; #"Failed to Close Below P"+tf+"L\nBias P"+tf+"H"
   } else if nch <= nph and ncl >= npl {
        nbias = if np_up then 1 else -1;
        txt = if bias_reason and can_plot then (if np_up then 5 else 5.5) else 0; #"Close Inside\nBias P"+tf + (n.p_up ? "H" : "L")
   } else {
        nbias = 0;
        txt = if bias_reason and can_plot then 6 else 0; #"Outside Bar but Closed Inside\nNo Bias"
}
    plot bias = nbias;
    plot reason = if !isNaN(close) then txt else 0;
}

Script update_info {
input tf = yes;
input can_plot = yes;
input bias_reason = yes;
input dw = 1;
    def np_up;
    def nph; # := n.ch
    def npl; # := n.cl
    def nch; # := high
    def ncl; # := low
    def nco; # := open
    def nph1 = if nph[1]==0 then high[1] else nph[1];
    def npl1 = if npl[1]==0 then low[1] else npl[1];
    def nch1 = if nch[1]==0 then high else nch[1];
    def ncl1 = if ncl[1]==0 then low else ncl[1];
    def nco1 = if nco[1]==0 then open else nco[1];
    def nbias; def nLabel;
    if tf {
    nbias = handle_bias(nph1, npl1, ncl1, nch1, np_up[1], can_plot, bias_reason, dw).bias;
    nLabel = handle_bias(nph1, npl1, ncl1, nch1, np_up[1], can_plot, bias_reason, dw).reason;
    np_up = if close[1] >= nco1 then yes else no;
    nph = nch[1];
    npl = ncl[1];
    nch = high;
    ncl = low;
    nco = open;
    } else {
    nbias = nbias[1];
    nLabel = 0;
    np_up = np_up[1];
    nph = nph[1];
    npl = npl[1];
    nco = nco[1];
    nch = max(high, nch1);
    ncl = min(low,  ncl1);
    }
    plot up = np_up;
    plot ph = nph;
    plot pl = npl;
    plot bias = nbias;
    plot Label = nLabel;
}
#-- Daily
def dup = update_info(new_day).up;
def dph = update_info(new_day).ph;
def dpl = update_info(new_day).pl;
def dbias  = update_info(new_day, can_plot_d, ShowBiasReasoning, 1).bias;
def dLabel = update_info(new_day, can_plot_d, ShowBiasReasoning, 1).Label;
def colDH = if high >= dph then 1 else -1;
def colDL = if low <= dpl  then 1 else -1;
#--- Weekly
def wup = update_info(new_week).up;
def wph = update_info(new_week).ph;
def wpl = update_info(new_week).pl;
def wbias  = update_info(new_week, can_plot_w, ShowBiasReasoning, 0).bias;
def wLabel = update_info(new_week, can_plot_w, ShowBiasReasoning, 0).Label;
def colWH = if high >= wph then 1 else -1;
def colWL = if low <= wpl  then 1 else -1;

plot PDHRaid = if can_plot_d and new_day and high >= dph then low else na;    # "PDH Raid"
plot PDLRaid = if can_plot_d and new_day and low <= dpl then high else na;    # "PDL Raid"
PDHRaid.SetPaintingStrategy(paintingStrategy.ARROW_UP);
PDLRaid.SetPaintingStrategy(paintingStrategy.ARROW_DOWN);
PDHRaid.SetDefaultColor(GlobalColor("up"));
PDLRaid.SetDefaultColor(GlobalColor("dn"));

plot PWHRaid = if can_plot_w and new_week and high >= wph then wph else na;    # "PWH Raid"
plot PWLRaid = if can_plot_w and new_week and low <= wpl then wpl else na;    # "PWL Raid"
PWHRaid.SetPaintingStrategy(paintingStrategy.ARROW_UP);
PWLRaid.SetPaintingStrategy(paintingStrategy.ARROW_DOWN);
PWHRaid.SetDefaultColor(Color.CYAN);
PWLRaid.SetDefaultColor(Color.MAGENTA);

AddVerticalLine(DaySeparator and new_day and can_plot_d, "NewDay", Color.GRAY);
AddVerticalLine(WeekSeparator and new_week and can_plot_w, "NewWeek", Color.ORANGE);

plot dHH = if DailyBias and dph and !new_day and !last then dph else na;
plot dLL = if DailyBias and dpl and !new_day and !last then dpl else na;
dHH.AssignValueColor(if colDH > 0 then GlobalColor("dn") else GlobalColor("up"));
dLL.AssignValueColor(if colDL > 0 then GlobalColor("dn") else GlobalColor("up"));
plot wHH = if WeeklyBias and wph and !new_week and !last then wph else na;
plot wLL = if WeeklyBias and wpl and !new_week and !last then wpl else na;
wHH.SetStyle(Curve.MEDIUM_DASH);
wLL.SetStyle(Curve.MEDIUM_DASH);
wHH.AssignValueColor(if colWH > 0 then GlobalColor("dn") else GlobalColor("up"));
wLL.AssignValueColor(if colWL > 0 then GlobalColor("dn") else GlobalColor("up"));

#-- Reasons
def LabW = if colWH==1 then  1 else
           if colWL==1 then -1 else 0;
def LabD = if colDH==1 then  1 else
           if colDL==1 then -1 else 0;
AddchartBubble(dLabel==1, dpl, "Close Above PDH\nBias PDH", if LabD>0 then GlobalColor("up") else
                               if LabD<0 then GlobalColor("dn") else Color.GRAY, if open >dpl then no else yes);
AddchartBubble(dLabel==2, dpl, "Close Below PDL\nBias PDL", if LabD>0 then GlobalColor("up") else
                               if LabD<0 then GlobalColor("dn") else Color.GRAY, if open >dpl then no else yes);
AddchartBubble(dLabel==3, dpl, "Failed to Close Above PDH\nBias PDL", if LabD>0 then GlobalColor("up") else
                               if LabD<0 then GlobalColor("dn") else Color.GRAY, if open >dpl then no else yes);
AddchartBubble(dLabel==4, dpl, "Failed to Close Below PDL\nBias PDH", if LabD>0 then GlobalColor("up") else
                               if LabD<0 then GlobalColor("dn") else Color.GRAY, if open >dpl then no else yes);
AddchartBubble(dLabel==5, dpl, "Close Inside\nBias PDH", if LabD>0 then GlobalColor("up") else
                               if LabD<0 then GlobalColor("dn") else Color.GRAY, if open >dpl then no else yes);
AddchartBubble(dLabel==5.5, dpl, "Close Inside\nBias PDL", if LabD>0 then GlobalColor("up") else
                               if LabD<0 then GlobalColor("dn") else Color.GRAY, if open >dpl then no else yes);
AddchartBubble(dLabel==6, dpl, "Outside Bar but Closed Inside\nNo Bias", if LabD>0 then GlobalColor("up") else
                               if LabD<0 then GlobalColor("dn") else Color.GRAY, if open >dpl then no else yes);
#--Week
AddchartBubble(wLabel==1, wph, "Close Above PWH\nBias PWH", if LabW>0 then GlobalColor("up") else
                               if LabW<0 then GlobalColor("dn") else Color.GRAY, if open >wpl then yes else no);
AddchartBubble(wLabel==2, wph, "Close Below PWL\nBias PWL", if LabW>0 then GlobalColor("up") else
                               if LabW<0 then GlobalColor("dn") else Color.GRAY, if open >wpl then yes else no);
AddchartBubble(wLabel==3, wph, "Failed to Close Above PWH\nBias PWL", if LabW>0 then GlobalColor("up") else
                               if LabW<0 then GlobalColor("dn") else Color.GRAY, if open >wpl then yes else no);
AddchartBubble(wLabel==4, wph, "Failed to Close Below PWL\nBias PWH", if LabW>0 then GlobalColor("up") else
                               if LabW<0 then GlobalColor("dn") else Color.GRAY, if open >wpl then yes else no);
AddchartBubble(wLabel==5, wph, "Close Inside\nBias PWH", if LabW>0 then GlobalColor("up") else
                               if LabW<0 then GlobalColor("dn") else Color.GRAY, if open >wpl then yes else no);
AddchartBubble(wLabel==5.5, wph, "Close Inside\nBias PWL", if LabW>0 then GlobalColor("up") else
                               if LabW<0 then GlobalColor("dn") else Color.GRAY, if open >wpl then yes else no);
AddchartBubble(wLabel==6, wph, "Outside Bar but Closed Inside\nNo Bias", if LabW>0 then GlobalColor("up") else
                               if LabW<0 then GlobalColor("dn") else Color.GRAY, if open >wpl then yes else no);

def hh = InertiaAll(highest(high + atr(200), 500), 2);
def ll = InertiaAll(lowest(low - atr(200), 500), 2);
plot biasDaily = if !last and PlotDailyBias then inertiaAll(highestAll(hh), 500) else na;
plot biasWeekly = if !last and PlotWeeklyBias then inertiaAll(highestAll(ll), 500) else na;
biasDaily.SetPaintingStrategy(PaintingStrategy.SQUARES);
biasDaily.AssignValueColor(if dbias == 1 then GlobalColor("bull") else if dbias == -1 then Color.RED else Color.GRAY);
biasWeekly.SetPaintingStrategy(PaintingStrategy.SQUARES);
biasWeekly.AssignValueColor(if wbias == 1 then GlobalColor("bull") else if wbias == -1 then Color.RED else Color.GRAY);


#-- end OF code
 
check the below.

CSS:
#/ This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © tradeforopp
#indicator("TTrades Daily Bias [TFO]", "TTrades Daily Bias [TFO]", true, max_lines_count = 500, max_labels_count = 500)
# Converted by Sam4Cok@Samer800    - 04/2024

input DailyBias = yes; # "Daily Bias", tooltip = "Apply TTrades bias concepts to the 1 Day timeframe", group = g_VIS)
input WeeklyBias = no; # "Weekly Bias", tooltip = "Apply TTrades bias concepts to the 1 Week timeframe", group = g_VIS)
input ShowBiasReasoning = yes; # "Show Bias Reasoning", tooltip = "Show the reason why a given bias is being established",
input PlotDailyBias = yes; # "Plot Daily Bias", inline = "DBIAS", group = g_PLT)
input PlotWeeklyBias = yes; # "Plot Weekly Bias", inline = "WBIAS", group = g_PLT)
input DaySeparator = no; # "Day Separator", inline = "DSEP", group = g_STY)
input WeekSeparator = no; # "Week Separator", inline = "WSEP", group = g_STY)

def na = Double.NaN;
def last = isNaN(close);
def tf = GetAggregationPeriod();
def day = GetDay();
def week = GetWeek();
def new_day = day != day[1];
def new_week = week != week[1];
def can_plot_d = DailyBias and tf < AggregationPeriod.DAY;
def can_plot_w = WeeklyBias and tf < AggregationPeriod.WEEK;

#--Color
DefineGlobalColor("bull", CreateColor(0,137,123)); #teal
DefineGlobalColor("bear", CreateColor(255,82,82));
DefineGlobalColor("up", CreateColor(33,150,243));
DefineGlobalColor("dn", CreateColor(255,82,82));
Script handle_bias {
input nph = high;
input npl = low;
input ncl = low;
input nch = high;
input np_up = yes;
input can_plot = yes;
input bias_reason = yes;
input tf = 1;
    def nbias;def txt;#def nclose_ph;def nclose_pl;
    if close[1] > nph {
#        nclose_ph = if nbias[1] == 1 then nclose_ph[1] + 1 else nclose_ph[1];
        nbias = 1;
        txt = if bias_reason and can_plot then 1 else 0;#"Close Above P"+tf+"H\nBias P"+tf+"H"
   } else if close[1] < npl {
#        nclose_pl = if nbias[1] == -1 then nclose_pl[1] + 1 else nclose_pl[1];
        nbias = -1;
        txt = if bias_reason and can_plot then 2 else 0; #"Close Below P"+tf+"L\nBias P"+tf+"L"
   } else if close[1] < nph and close[1] > npl and nch > nph and ncl > npl {
        nbias = -1;
        txt = if bias_reason and can_plot then 3 else 0; #"Failed to Close Above P"+tf+"H\nBias P"+tf+"L"
   } else if close[1] > npl and close[1] < nph and nch < nph and ncl < npl {
        nbias = 1;
        txt = if bias_reason and can_plot then 4 else 0; #"Failed to Close Below P"+tf+"L\nBias P"+tf+"H"
   } else if nch <= nph and ncl >= npl {
        nbias = if np_up then 1 else -1;
        txt = if bias_reason and can_plot then (if np_up then 5 else 5.5) else 0; #"Close Inside\nBias P"+tf + (n.p_up ? "H" : "L")
   } else {
        nbias = 0;
        txt = if bias_reason and can_plot then 6 else 0; #"Outside Bar but Closed Inside\nNo Bias"
}
    plot bias = nbias;
    plot reason = if !isNaN(close) then txt else 0;
}

Script update_info {
input tf = yes;
input can_plot = yes;
input bias_reason = yes;
input dw = 1;
    def np_up;
    def nph; # := n.ch
    def npl; # := n.cl
    def nch; # := high
    def ncl; # := low
    def nco; # := open
    def nph1 = if nph[1]==0 then high[1] else nph[1];
    def npl1 = if npl[1]==0 then low[1] else npl[1];
    def nch1 = if nch[1]==0 then high else nch[1];
    def ncl1 = if ncl[1]==0 then low else ncl[1];
    def nco1 = if nco[1]==0 then open else nco[1];
    def nbias; def nLabel;
    if tf {
    nbias = handle_bias(nph1, npl1, ncl1, nch1, np_up[1], can_plot, bias_reason, dw).bias;
    nLabel = handle_bias(nph1, npl1, ncl1, nch1, np_up[1], can_plot, bias_reason, dw).reason;
    np_up = if close[1] >= nco1 then yes else no;
    nph = nch[1];
    npl = ncl[1];
    nch = high;
    ncl = low;
    nco = open;
    } else {
    nbias = nbias[1];
    nLabel = 0;
    np_up = np_up[1];
    nph = nph[1];
    npl = npl[1];
    nco = nco[1];
    nch = max(high, nch1);
    ncl = min(low,  ncl1);
    }
    plot up = np_up;
    plot ph = nph;
    plot pl = npl;
    plot bias = nbias;
    plot Label = nLabel;
}
#-- Daily
def dup = update_info(new_day).up;
def dph = update_info(new_day).ph;
def dpl = update_info(new_day).pl;
def dbias  = update_info(new_day, can_plot_d, ShowBiasReasoning, 1).bias;
def dLabel = update_info(new_day, can_plot_d, ShowBiasReasoning, 1).Label;
def colDH = if high >= dph then 1 else -1;
def colDL = if low <= dpl  then 1 else -1;
#--- Weekly
def wup = update_info(new_week).up;
def wph = update_info(new_week).ph;
def wpl = update_info(new_week).pl;
def wbias  = update_info(new_week, can_plot_w, ShowBiasReasoning, 0).bias;
def wLabel = update_info(new_week, can_plot_w, ShowBiasReasoning, 0).Label;
def colWH = if high >= wph then 1 else -1;
def colWL = if low <= wpl  then 1 else -1;

plot PDHRaid = if can_plot_d and new_day and high >= dph then low else na;    # "PDH Raid"
plot PDLRaid = if can_plot_d and new_day and low <= dpl then high else na;    # "PDL Raid"
PDHRaid.SetPaintingStrategy(paintingStrategy.ARROW_UP);
PDLRaid.SetPaintingStrategy(paintingStrategy.ARROW_DOWN);
PDHRaid.SetDefaultColor(GlobalColor("up"));
PDLRaid.SetDefaultColor(GlobalColor("dn"));

plot PWHRaid = if can_plot_w and new_week and high >= wph then wph else na;    # "PWH Raid"
plot PWLRaid = if can_plot_w and new_week and low <= wpl then wpl else na;    # "PWL Raid"
PWHRaid.SetPaintingStrategy(paintingStrategy.ARROW_UP);
PWLRaid.SetPaintingStrategy(paintingStrategy.ARROW_DOWN);
PWHRaid.SetDefaultColor(Color.CYAN);
PWLRaid.SetDefaultColor(Color.MAGENTA);

AddVerticalLine(DaySeparator and new_day and can_plot_d, "NewDay", Color.GRAY);
AddVerticalLine(WeekSeparator and new_week and can_plot_w, "NewWeek", Color.ORANGE);

plot dHH = if DailyBias and dph and !new_day and !last then dph else na;
plot dLL = if DailyBias and dpl and !new_day and !last then dpl else na;
dHH.AssignValueColor(if colDH > 0 then GlobalColor("dn") else GlobalColor("up"));
dLL.AssignValueColor(if colDL > 0 then GlobalColor("dn") else GlobalColor("up"));
plot wHH = if WeeklyBias and wph and !new_week and !last then wph else na;
plot wLL = if WeeklyBias and wpl and !new_week and !last then wpl else na;
wHH.SetStyle(Curve.MEDIUM_DASH);
wLL.SetStyle(Curve.MEDIUM_DASH);
wHH.AssignValueColor(if colWH > 0 then GlobalColor("dn") else GlobalColor("up"));
wLL.AssignValueColor(if colWL > 0 then GlobalColor("dn") else GlobalColor("up"));

#-- Reasons
def LabW = if colWH==1 then  1 else
           if colWL==1 then -1 else 0;
def LabD = if colDH==1 then  1 else
           if colDL==1 then -1 else 0;
AddchartBubble(dLabel==1, dpl, "Close Above PDH\nBias PDH", if LabD>0 then GlobalColor("up") else
                               if LabD<0 then GlobalColor("dn") else Color.GRAY, if open >dpl then no else yes);
AddchartBubble(dLabel==2, dpl, "Close Below PDL\nBias PDL", if LabD>0 then GlobalColor("up") else
                               if LabD<0 then GlobalColor("dn") else Color.GRAY, if open >dpl then no else yes);
AddchartBubble(dLabel==3, dpl, "Failed to Close Above PDH\nBias PDL", if LabD>0 then GlobalColor("up") else
                               if LabD<0 then GlobalColor("dn") else Color.GRAY, if open >dpl then no else yes);
AddchartBubble(dLabel==4, dpl, "Failed to Close Below PDL\nBias PDH", if LabD>0 then GlobalColor("up") else
                               if LabD<0 then GlobalColor("dn") else Color.GRAY, if open >dpl then no else yes);
AddchartBubble(dLabel==5, dpl, "Close Inside\nBias PDH", if LabD>0 then GlobalColor("up") else
                               if LabD<0 then GlobalColor("dn") else Color.GRAY, if open >dpl then no else yes);
AddchartBubble(dLabel==5.5, dpl, "Close Inside\nBias PDL", if LabD>0 then GlobalColor("up") else
                               if LabD<0 then GlobalColor("dn") else Color.GRAY, if open >dpl then no else yes);
AddchartBubble(dLabel==6, dpl, "Outside Bar but Closed Inside\nNo Bias", if LabD>0 then GlobalColor("up") else
                               if LabD<0 then GlobalColor("dn") else Color.GRAY, if open >dpl then no else yes);
#--Week
AddchartBubble(wLabel==1, wph, "Close Above PWH\nBias PWH", if LabW>0 then GlobalColor("up") else
                               if LabW<0 then GlobalColor("dn") else Color.GRAY, if open >wpl then yes else no);
AddchartBubble(wLabel==2, wph, "Close Below PWL\nBias PWL", if LabW>0 then GlobalColor("up") else
                               if LabW<0 then GlobalColor("dn") else Color.GRAY, if open >wpl then yes else no);
AddchartBubble(wLabel==3, wph, "Failed to Close Above PWH\nBias PWL", if LabW>0 then GlobalColor("up") else
                               if LabW<0 then GlobalColor("dn") else Color.GRAY, if open >wpl then yes else no);
AddchartBubble(wLabel==4, wph, "Failed to Close Below PWL\nBias PWH", if LabW>0 then GlobalColor("up") else
                               if LabW<0 then GlobalColor("dn") else Color.GRAY, if open >wpl then yes else no);
AddchartBubble(wLabel==5, wph, "Close Inside\nBias PWH", if LabW>0 then GlobalColor("up") else
                               if LabW<0 then GlobalColor("dn") else Color.GRAY, if open >wpl then yes else no);
AddchartBubble(wLabel==5.5, wph, "Close Inside\nBias PWL", if LabW>0 then GlobalColor("up") else
                               if LabW<0 then GlobalColor("dn") else Color.GRAY, if open >wpl then yes else no);
AddchartBubble(wLabel==6, wph, "Outside Bar but Closed Inside\nNo Bias", if LabW>0 then GlobalColor("up") else
                               if LabW<0 then GlobalColor("dn") else Color.GRAY, if open >wpl then yes else no);

def hh = InertiaAll(highest(high + atr(200), 500), 2);
def ll = InertiaAll(lowest(low - atr(200), 500), 2);
plot biasDaily = if !last and PlotDailyBias then inertiaAll(highestAll(hh), 500) else na;
plot biasWeekly = if !last and PlotWeeklyBias then inertiaAll(highestAll(ll), 500) else na;
biasDaily.SetPaintingStrategy(PaintingStrategy.SQUARES);
biasDaily.AssignValueColor(if dbias == 1 then GlobalColor("bull") else if dbias == -1 then Color.RED else Color.GRAY);
biasWeekly.SetPaintingStrategy(PaintingStrategy.SQUARES);
biasWeekly.AssignValueColor(if wbias == 1 then GlobalColor("bull") else if wbias == -1 then Color.RED else Color.GRAY);


#-- end OF code
Thank you so much 🙏
 

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