SetHiding for TD Sequential?

P

pghostine

New member
I recently set out to implement my own version of the TOS Sequence Counter study. The TOS version is lacking on many fronts; Several guidelines associated with the TD Sequential indicators are not implemented in this study. I wish I had the code to build upon it.

This morning, I ran into an issue with the SetHiding method. It seemed quite straightforward, but when I used it, I just couldn't get it to hide my plot even though the condition I'm passing it is true. Here's the experimental code that shows the problem. I've even plotted the condition itself to make sure it's correct (=1) in the data box.

Any help would be appreciated.

Code:
declare upper;
#
input Setup_Min = 9;

def TDSS_CONDITION = if close > close[4] then yes else no;
def TDBS_CONDITION = if close < close[4] then yes else no;
def buPF = TDSS_CONDITION and TDBS_CONDITION[1];
def bePF = TDBS_CONDITION and TDSS_CONDITION[1];

def TDSS;
if buPF
then {
    TDSS = 1;
} else {
    if TDSS_CONDITION
    then {
        TDSS = TDSS[1] + 1;
    } else {
        TDSS  =TDSS[1];
    }
}

def TDBS;
if bePF
then {
    TDBS = 1;
} else {
    if TDBS_CONDITION
    then {
        TDBS = TDBS[1] + 1;
    } else {
        TDBS  = TDBS[1];
    }
}

plot TDSS_PLOT = TDSS;
plot TDBS_PLOT = TDBS;

plot TDSS_HIDE = if TDBS_CONDITION and TDSS[1] < Setup_Min then 1 else 0;
plot TDBS_HIDE = if TDSS_CONDITION and TDBS[1] < Setup_Min then 1 else 0;

TDSS_PLOT.SetHiding(TDSS_HIDE);
TDBS_PLOT.SetHiding(TDBS_HIDE); 

TDSS_PLOT.DefineColor("ORANGE", CreateColor(255, 128, 0));
TDBS_PLOT.DefineColor("ORANGE", CreateColor(255, 128, 0));

TDSS_PLOT.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
TDBS_PLOT.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
TDSS_PLOT.SetDefaultColor(TDSS_PLOT.Color("ORANGE"));
TDBS_PLOT.SetDefaultColor(TDBS_PLOT.Color("ORANGE"));

# End Study
 
Last edited by a moderator:

Similar threads

Top