Repaints The PAM High Low Chart Setup For ThinkOrSwim

Repaints
Status
Not open for further replies.
Yeah you can get fakeouts in those timeframes for sure with any indicator in any market. Always use longer timeframes to confirm your trend. It's okay to use the stop loss in the lower timeframe indicator, typically they will be the same as longer. But I still use the stop loss in the timeframe I get the signal on.
This was a great point, I added higher timeframes into the current version I've been working on -- I now have fully non-repaintable zones that can show 15min zones on a 3min chart, for instance, and can be limited to a certain length so they don't overcrowd the chart.

I am having some trouble removing the duplicate signals that show twice in one zone, though. I even tried mimicking @fskhan 's code for non-repainting but I think the lowestall() function is having issues here. If anyone else wants to take a look at the code they're welcome to, other than that I think the code is ready to be tested, though it's still just a study and not a strategy.

I also agree that it may help to suppress the signal if either the market or the trend is very much against the signal -- a day trend like SPY today is a great example of where the signal would constantly initialize a zone for puts and then unconfirm, which could get confusing for some.
 
This was a great point, I added higher timeframes into the current version I've been working on -- I now have fully non-repaintable zones that can show 15min zones on a 3min chart, for instance, and can be limited to a certain length so they don't overcrowd the chart.

I am having some trouble removing the duplicate signals that show twice in one zone, though. I even tried mimicking @fskhan 's code for non-repainting but I think the lowestall() function is having issues here. If anyone else wants to take a look at the code they're welcome to, other than that I think the code is ready to be tested, though it's still just a study and not a strategy.

I also agree that it may help to suppress the signal if either the market or the trend is very much against the signal -- a day trend like SPY today is a great example of where the signal would constantly initialize a zone for puts and then unconfirm, which could get confusing for some.
I will test it once it is available.
 
Hey, so this indicator is meant to be as simple as possible.

The solid line is your entry once the candle crosses it and closes. I often take positions prior to the candle close because that solid line is the support/resistance zone that you're taking advantage of. Often time, that first candle is the biggest mover and I'm willing to risk 20-30% loss if it does reverse, which does happen especially on lower timeframes.

The dotted line is simply your stop loss. If price action crosses it and it CLOSES, and it HAS TO CLOSE, no exceptions, then you exit the position. Wait for a better entry.
If you use this indicator on the 15m chart, you are going to see that this rarely happens. The reason it is so effective is because you are finding the top or bottom in the last 20 candles and this gives you a good entry on reversals.

If you do use it on lower timeframes, say 1m to 5m (I even recommend it on 10m), then you need to set your bars to be at least 30 where you don't get as many poor entry signals.

Please recommend any feedback you have. I think this indicator is priceless but I'm biased.

One thing I will say is if the candle is an outside bar candle, it means the market is undecided and I would wait for a better entry. There are plenty of markets out there.

@halcyonguy and I have to work on designing a scanner and maybe cleaning the code up. But man this thing is killer.

When you say, you wait for the next candle to close, do you mean to wait for 15 more minutes ? also, I see that now, both "Buy Put" and "Buy Call" are generated within the 20 bars in 15 minute timeframe so what exactly would you have done int his case right now on /ES.

 
No, an outside bar can occur on any timeframe. It's just a candle that has fully engulfed the previous one with a higher high and lower low. This means the market direction is undecided, and therefore, you need to wait to see who wins between the bulls and bears.

An inside bar is where the candle does not have a HH or LL from the previous candle, also indecisiveness and sometimes it contains at least a small squeeze building up momentum for a push in a reversal or trend continuation.
Why would an outside bar indecisive? an outside bar mean it already broke the previous bar either high or low. Isn't inside bar only that's indecisive. if both outside and inside bars are indecisive then what bar is decisive?
 
This was a great point, I added higher timeframes into the current version I've been working on -- I now have fully non-repaintable zones that can show 15min zones on a 3min chart, for instance, and can be limited to a certain length so they don't overcrowd the chart.

I am having some trouble removing the duplicate signals that show twice in one zone, though. I even tried mimicking @fskhan 's code for non-repainting but I think the lowestall() function is having issues here. If anyone else wants to take a look at the code they're welcome to, other than that I think the code is ready to be tested, though it's still just a study and not a strategy.

I also agree that it may help to suppress the signal if either the market or the trend is very much against the signal -- a day trend like SPY today is a great example of where the signal would constantly initialize a zone for puts and then unconfirm, which could get confusing for some.
Maybe try checking out Saty's Pivot Ribbon Time Warp code. He has a really good set up on painting higher timeframes onto the lower ones. I held off using his pivot ribbon until today and I'm sad I did. It's amazing.
 
same for me also, today when /ES touched 4075, it showed Buy put option and after sometime it disappeared as the price reversed.
If it touched it, then the signal disappeared, that means your stop loss got hit right? That's how it is supposed to work if that's what happened because price moved higher, thus generating a new signal. But if it never hit the stop loss and then the signal disappeared, well that's a bug and we got the best guys on it that will handle it for sure.
 
Why would an outside bar indecisive? an outside bar mean it already broke the previous bar either high or low. Isn't inside bar only that's indecisive. if both outside and inside bars are indecisive then what bar is decisive?

You're thinking of an outside bar that has only gone one way. Many outside bars are indecisive. When you start using the indicator a little more, you will see what I'm talking about where you have the next 5-6 stuck between the buy put line and the stop loss line and chopping in between those. I'm referring to that. If it's a decisive outside bar, you're Buy Put signal will be determined on the next candle for sure. I was specifically referring to the outside bars that leave you scratching your head. When you are using this indicator, you will see a lot of them.
 
When you say, you wait for the next candle to close, do you mean to wait for 15 more minutes ? also, I see that now, both "Buy Put" and "Buy Call" are generated within the 20 bars in 15 minute timeframe so what exactly would you have done int his case right now on /ES.

I would have scalped the puts and bought the calls when I got the signal. And I recommend waiting 15 minutes unless you have other areas of confluence that support you getting into the trade. That's why I have things like SATY's ATR levels that give me support and resistance where I can see if price action is going to reject or find support there. Also, I use the 13 and 48 (not 48.5 like I previously thought) ema's to see if the signal I'm getting matches the reversal or the ema's are at least pointing in that direction. I'm never taking a buy put signal with the ema's pointing up and vice versa. You have to have confluence and discern whether it's a smart move to get into, even with the indicator.
 
For trend,

I use the following to determine the trend of the day I use $VOLD and $ADD and then $SP500MUP on a Today and 5min chart. It even helps when trend changes its direction. Check it out in the next few days and share your experience.
Dtwu3P3.png

384rmPt.png

Are you mostly using them to observe that trend line support is not broken, and looking for trend agreement among all three? I would have expected that these would be like lagging indicators for SPX trend action but do you find that when some of them are no longer in agreement (e.g. 1/3 or 2/3) then that is a leading signal that SPX will reverse? I’m very interested in understanding your thought process for how to apply these charts when trading SPX or ES.
 
I would have scalped the puts and bought the calls when I got the signal. And I recommend waiting 15 minutes unless you have other areas of confluence that support you getting into the trade. That's why I have things like SATY's ATR levels that give me support and resistance where I can see if price action is going to reject or find support there. Also, I use the 13 and 48 (not 48.5 like I previously thought) ema's to see if the signal I'm getting matches the reversal or the ema's are at least pointing in that direction. I'm never taking a buy put signal with the ema's pointing up and vice versa. You have to have confluence and discern whether it's a smart move to get into, even with the indicator.
I'm kind of confused with both green and red zones forming together on the 15 min interval this morning...i did gain $200 but I'm not confident on the trades..if you have taken the trades this morning, could you please explain?

 
Why would an outside bar indecisive? an outside bar mean it already broke the previous bar either high or low. Isn't inside bar only that's indecisive. if both outside and inside bars are indecisive then what bar is decisive?
Indecisive Outside Bar example


NBuM70f.png
 
I'm kind of confused with both green and red zones forming together on the 15 min interval this morning...i did gain $200 but I'm not confident on the trades..if you have taken the trades this morning, could you please explain?

It means we are chopping, which matches flow data and has many areas of confluence. 13 and 48 ema are almost literally touching. We are squeezing and you will get these types of signal in a very strong squeeze.


NBuM70f.png
 
Hi all, sorry for the wait -- here is my latest attempt at the high-low indicator, with MTF options and no repainting once the signal is fully confirmed.
mod note:
This scripts uses future bars so yes, it does repaint. It looks into the future for confirmation and then goes backs and repaints.
This script cannot be used in a strategy, the backtesting results will not be valid.

CE85rLG.png


Above is the study using the 15min timeframe to form zones on the 5min chart -- I've also added the 13 and 48.5 emas in this picture.

As you can see, the zones no longer repaint, but I did add logic to suppress them after "length" amount of bars -- I may add this as an input later so that the length is separate from the zone extension. Also, given that this IS still a swinghigh/low study, you may see candles forming but if a new high/low is formed quickly, then it will reform the zone; that's just the nature of these studies, it can't detect the absolute high/low in real time lol. Also, you can obviously see that I still haven't gotten the duplicate signals to stop firing yet -- any help on that would be great.

Things I still want done here:
1. Making the signals only show once per zone
2. Adding the options for labels instead of arrows (probably doing this tonight)
3. Suppressing the signal creation if the chart or market internals are extremely against the countertrend signal (this can also likely be toggled)
4. There is still an option to add the vertical line but on MTF charts, it will show multiple times so I don't like it -- if there's a way to pretty that up it would be great
5. Adding the "buy types" back in, as I think that's a great option

Here is the link and code, I'll continue to improve on this but I wanted to at least get others' opinions and criticisms on this first: http://tos.mx/gGbzkIZ

Code:
#  +------------------------------------------------------------+
# New logic based on -- Example: How to extend levels to the right of the chart,
# by Robert Payne @ https://funwiththinkscript.com  
# Logic provided by OGOptionsSlayer at usethinkscript.com

# define swing low points
input length = 20;
input add_cloud = yes;
#input buy_type = {default "Confirmation", "Active"};
#input bars_to_skip = 1;
input color_bars = yes;
input UseChartTime = no;
input agg = aggregationPeriod.FIFTEEN_MIN;
#input show_n =2;

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

# Scripts
script barssince {
    input Condition = 0;
    def barssince = if Condition then 1 else barssince[1] + 1;
    plot return = barssince;
}

#//MTF
def l;
def h;
def c;
def o;

if UseChartTime
then {
    o = open;
    l   = low;
    h  = high;
    c = close;
} else {
    o = open(period = agg);
    l = low(period = agg);
    h = high(period = agg);
    c = close(period = agg);
}


def first = (!IsNaN(c[-(length - 1)]) and IsNaN(c[-length]));
def firstbar = bn - length;
#AddVerticalLine(first, "-", Color.WHITE);



def lastBar = HighestAll(if IsNaN(c) then 0 else bn);
def offset = Min(length - 1, lastBar - bn);


def swingLow = l < Lowest(l[1], length - 1) and l == GetValue(Lowest(l, length), -offset);
def swingHigh =  h > Highest(h[1], length - 1) and h == GetValue(Highest(h, length), -offset);

# change candle colors just to make it easier to see what we are working with
AssignPriceColor(if color_bars then (if swingLow then Color.LIME else if swingHigh then Color.magenta else Color.current) else color.current);


# identify the very last swing low point
#def lowPointOneBarNumber =  swingLow then bn else 0);
def swinglowbar = if swinglow then bn else swinglowbar[1];

def lowPointOnehigh = if swingLow then h else lowPointOnehigh[1];
def lowPointOneValue = if swinglowbar>=firstbar then (if swingLow then l else lowPointOneValue[1]) else na;
plot low1 = if swingLow then l else lowPointOneValue;
low1.SetDefaultColor(Color.LIME);

def lowPointOneup = if swinglowbar>=firstbar then (if swingLow then h else lowPointOnehigh[1]) else na;
plot low1high = if swingLow then h else lowPointOneup;
low1high.SetDefaultColor(Color.LIME);
AddCloud(if add_cloud then low1high else Double.NaN, low1, Color.LIGHT_GREEN, Color.LIGHT_GREEN);

low1.setpaintingstrategy(paintingstrategy.horizontal);
low1high.setpaintingstrategy(paintingstrategy.horizontal);

def uppies = if barssince(swingLow) <= length then l else Double.NaN;
def sincelo = barssince(swingLow);


def crossup =  if close[1] crosses above low1high then bn else 99999;
#def crossupbar = lowestall(crossup);
def crossupsig = if bn == crossup then 1 else 0;
def upsince = barssince(crossup);



# and upsince[1]<length;
plot lowup = crossupsig ;
# and barssince(swinglow)<20;
#and upsince[1]>5 ;
lowup.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
#AddLabel(yes , "Since Low " + barssince(swinglow), Color.GREEN);



def highbar = if swinghigh then bn else highbar[1];


# identify the very last swing low point
def highPointOneBarNumber = if swingHigh then bn else 0;
def highPointOnelo = if swingHigh then l else highPointOnelo[1];
def highPointOneValue = if highbar>=firstbar then (if swingHigh then h else highPointOneValue[1]) else na;
plot high1 = if swingHigh then h else highPointOneValue;
high1.SetDefaultColor(Color.RED);

#addchartbubble(swinghigh, low, "low" + low, color.yellow);

def highPointOnelow = if highbar>=firstbar then (if swingHigh then l else highPointOnelo[1]) else na;
plot high1low = if swingHigh then l else highPointOnelow;
high1low.SetDefaultColor(Color.RED);
AddCloud(if add_cloud then high1low else Double.NaN, high1, Color.LIGHT_RED, Color.LIGHT_RED);

def sincehigh = barssince(swingHigh);

#AddLabel(yes , if sincehigh < length then "True" else "False", Color.RED);
#AddLabel(yes , "Since High " + barssince(swinghigh), color.red);

#def crossdn = !first and close[1] crosses below high1low and close < high1low;
#def crossdn =  (!first and close[1] crosses below high1low and close <high1low) or
#     (sum(swinghigh, 3)>=1 and close[1] < high1low and close < high1low);
def crossdn =  if close crosses below high1low then bn else 99999;
#def crossdnbar = between(highbar, crossdn, bn);
def crossdnsig = if bn equals crossdn then 1 else 0;

def dnsince = barssince(crossdn);

plot highdn = crossdnsig;
# and dnsince[1]<length;
highdn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

high1.setpaintingstrategy(paintingstrategy.horizontal);
high1low.setpaintingstrategy(paintingstrategy.horizontal);

# End
 
Last edited by a moderator:
Added alerts

Code:
#  +------------------------------------------------------------+
# New logic based on -- Example: How to extend levels to the right of the chart,
# by Robert Payne @ https://funwiththinkscript.com   
# Logic provided by OGOptionsSlayer at usethinkscript.com
# tradingnumbers - added alerts

# define swing low points
input length = 20;
input add_cloud = yes;
#input buy_type = {default "Confirmation", "Active"};
#input bars_to_skip = 1;
input color_bars = yes;
input UseChartTime = no;
input agg = aggregationPeriod.FIFTEEN_MIN;
#input show_n =2;

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

# Scripts
script barssince {
    input Condition = 0;
    def barssince = if Condition then 1 else barssince[1] + 1;
    plot return = barssince;
}

#//MTF
def l;
def h;
def c;
def o;

if UseChartTime
then {
    o = open;
    l   = low;
    h  = high;
    c = close;
} else {
    o = open(period = agg);
    l = low(period = agg);
    h = high(period = agg);
    c = close(period = agg);
}


def first = (!IsNaN(c[-(length - 1)]) and IsNaN(c[-length]));
def firstbar = bn - length;
#AddVerticalLine(first, "-", Color.WHITE);



def lastBar = HighestAll(if IsNaN(c) then 0 else bn);
def offset = Min(length - 1, lastBar - bn);


def swingLow = l < Lowest(l[1], length - 1) and l == GetValue(Lowest(l, length), -offset);
def swingHigh =  h > Highest(h[1], length - 1) and h == GetValue(Highest(h, length), -offset);

# change candle colors just to make it easier to see what we are working with
AssignPriceColor(if color_bars then (if swingLow then Color.LIME else if swingHigh then Color.magenta else Color.current) else color.current);


# identify the very last swing low point
#def lowPointOneBarNumber =  swingLow then bn else 0);
def swinglowbar = if swinglow then bn else swinglowbar[1];

def lowPointOnehigh = if swingLow then h else lowPointOnehigh[1];
def lowPointOneValue = if swinglowbar>=firstbar then (if swingLow then l else lowPointOneValue[1]) else na;
plot low1 = if swingLow then l else lowPointOneValue;
low1.SetDefaultColor(Color.LIME);

def lowPointOneup = if swinglowbar>=firstbar then (if swingLow then h else lowPointOnehigh[1]) else na;
plot low1high = if swingLow then h else lowPointOneup;
low1high.SetDefaultColor(Color.LIME);
AddCloud(if add_cloud then low1high else Double.NaN, low1, Color.LIGHT_GREEN, Color.LIGHT_GREEN);

low1.setpaintingstrategy(paintingstrategy.horizontal);
low1high.setpaintingstrategy(paintingstrategy.horizontal);

def uppies = if barssince(swingLow) <= length then l else Double.NaN;
def sincelo = barssince(swingLow);


def crossup =  if close[1] crosses above low1high then bn else 99999;
#def crossupbar = lowestall(crossup);
def crossupsig = if bn == crossup then 1 else 0;
def upsince = barssince(crossup);



# and upsince[1]<length;
plot lowup = crossupsig ;
# and barssince(swinglow)<20;
#and upsince[1]>5 ;
lowup.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
#AddLabel(yes , "Since Low " + barssince(swinglow), Color.GREEN);



def highbar = if swinghigh then bn else highbar[1];


# identify the very last swing low point
def highPointOneBarNumber = if swingHigh then bn else 0;
def highPointOnelo = if swingHigh then l else highPointOnelo[1];
def highPointOneValue = if highbar>=firstbar then (if swingHigh then h else highPointOneValue[1]) else na;
plot high1 = if swingHigh then h else highPointOneValue;
high1.SetDefaultColor(Color.RED);

#addchartbubble(swinghigh, low, "low" + low, color.yellow);

def highPointOnelow = if highbar>=firstbar then (if swingHigh then l else highPointOnelo[1]) else na;
plot high1low = if swingHigh then l else highPointOnelow;
high1low.SetDefaultColor(Color.RED);
AddCloud(if add_cloud then high1low else Double.NaN, high1, Color.LIGHT_RED, Color.LIGHT_RED);

def sincehigh = barssince(swingHigh);

#AddLabel(yes , if sincehigh < length then "True" else "False", Color.RED);
#AddLabel(yes , "Since High " + barssince(swinghigh), color.red);

#def crossdn = !first and close[1] crosses below high1low and close < high1low;
#def crossdn =  (!first and close[1] crosses below high1low and close <high1low) or
#     (sum(swinghigh, 3)>=1 and close[1] < high1low and close < high1low);
def crossdn =  if close crosses below high1low then bn else 99999;
#def crossdnbar = between(highbar, crossdn, bn);
def crossdnsig = if bn equals crossdn then 1 else 0;

def dnsince = barssince(crossdn);

plot highdn = crossdnsig;
# and dnsince[1]<length;
highdn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

high1.setpaintingstrategy(paintingstrategy.horizontal);
high1low.setpaintingstrategy(paintingstrategy.horizontal);

# Alerts

Alert(crossupsig[1], "Long", Alert.BAR, Sound.Ding);
Alert(crossdnsig[1], "Short", Alert.BAR, Sound.Ding);

# End
 
Hi all, sorry for the wait -- here is my latest attempt at the high-low indicator, with MTF options and no repainting once the signal is fully confirmed.

CE85rLG.png


Above is the study using the 15min timeframe to form zones on the 5min chart -- I've also added the 13 and 48.5 emas in this picture.

As you can see, the zones no longer repaint, but I did add logic to suppress them after "length" amount of bars -- I may add this as an input later so that the length is separate from the zone extension. Also, given that this IS still a swinghigh/low study, you may see candles forming but if a new high/low is formed quickly, then it will reform the zone; that's just the nature of these studies, it can't detect the absolute high/low in real time lol. Also, you can obviously see that I still haven't gotten the duplicate signals to stop firing yet -- any help on that would be great.

Things I still want done here:
1. Making the signals only show once per zone
2. Adding the options for labels instead of arrows (probably doing this tonight)
3. Suppressing the signal creation if the chart or market internals are extremely against the countertrend signal (this can also likely be toggled)
4. There is still an option to add the vertical line but on MTF charts, it will show multiple times so I don't like it -- if there's a way to pretty that up it would be great
5. Adding the "buy types" back in, as I think that's a great option

Here is the link and code, I'll continue to improve on this but I wanted to at least get others' opinions and criticisms on this first: http://tos.mx/gGbzkIZ

Code:
#  +------------------------------------------------------------+
# New logic based on -- Example: How to extend levels to the right of the chart,
# by Robert Payne @ https://funwiththinkscript.com  
# Logic provided by OGOptionsSlayer at usethinkscript.com

# define swing low points
input length = 20;
input add_cloud = yes;
#input buy_type = {default "Confirmation", "Active"};
#input bars_to_skip = 1;
input color_bars = yes;
input UseChartTime = no;
input agg = aggregationPeriod.FIFTEEN_MIN;
#input show_n =2;

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

# Scripts
script barssince {
    input Condition = 0;
    def barssince = if Condition then 1 else barssince[1] + 1;
    plot return = barssince;
}

#//MTF
def l;
def h;
def c;
def o;

if UseChartTime
then {
    o = open;
    l   = low;
    h  = high;
    c = close;
} else {
    o = open(period = agg);
    l = low(period = agg);
    h = high(period = agg);
    c = close(period = agg);
}


def first = (!IsNaN(c[-(length - 1)]) and IsNaN(c[-length]));
def firstbar = bn - length;
#AddVerticalLine(first, "-", Color.WHITE);



def lastBar = HighestAll(if IsNaN(c) then 0 else bn);
def offset = Min(length - 1, lastBar - bn);


def swingLow = l < Lowest(l[1], length - 1) and l == GetValue(Lowest(l, length), -offset);
def swingHigh =  h > Highest(h[1], length - 1) and h == GetValue(Highest(h, length), -offset);

# change candle colors just to make it easier to see what we are working with
AssignPriceColor(if color_bars then (if swingLow then Color.LIME else if swingHigh then Color.magenta else Color.current) else color.current);


# identify the very last swing low point
#def lowPointOneBarNumber =  swingLow then bn else 0);
def swinglowbar = if swinglow then bn else swinglowbar[1];

def lowPointOnehigh = if swingLow then h else lowPointOnehigh[1];
def lowPointOneValue = if swinglowbar>=firstbar then (if swingLow then l else lowPointOneValue[1]) else na;
plot low1 = if swingLow then l else lowPointOneValue;
low1.SetDefaultColor(Color.LIME);

def lowPointOneup = if swinglowbar>=firstbar then (if swingLow then h else lowPointOnehigh[1]) else na;
plot low1high = if swingLow then h else lowPointOneup;
low1high.SetDefaultColor(Color.LIME);
AddCloud(if add_cloud then low1high else Double.NaN, low1, Color.LIGHT_GREEN, Color.LIGHT_GREEN);

low1.setpaintingstrategy(paintingstrategy.horizontal);
low1high.setpaintingstrategy(paintingstrategy.horizontal);

def uppies = if barssince(swingLow) <= length then l else Double.NaN;
def sincelo = barssince(swingLow);


def crossup =  if close[1] crosses above low1high then bn else 99999;
#def crossupbar = lowestall(crossup);
def crossupsig = if bn == crossup then 1 else 0;
def upsince = barssince(crossup);



# and upsince[1]<length;
plot lowup = crossupsig ;
# and barssince(swinglow)<20;
#and upsince[1]>5 ;
lowup.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
#AddLabel(yes , "Since Low " + barssince(swinglow), Color.GREEN);



def highbar = if swinghigh then bn else highbar[1];


# identify the very last swing low point
def highPointOneBarNumber = if swingHigh then bn else 0;
def highPointOnelo = if swingHigh then l else highPointOnelo[1];
def highPointOneValue = if highbar>=firstbar then (if swingHigh then h else highPointOneValue[1]) else na;
plot high1 = if swingHigh then h else highPointOneValue;
high1.SetDefaultColor(Color.RED);

#addchartbubble(swinghigh, low, "low" + low, color.yellow);

def highPointOnelow = if highbar>=firstbar then (if swingHigh then l else highPointOnelo[1]) else na;
plot high1low = if swingHigh then l else highPointOnelow;
high1low.SetDefaultColor(Color.RED);
AddCloud(if add_cloud then high1low else Double.NaN, high1, Color.LIGHT_RED, Color.LIGHT_RED);

def sincehigh = barssince(swingHigh);

#AddLabel(yes , if sincehigh < length then "True" else "False", Color.RED);
#AddLabel(yes , "Since High " + barssince(swinghigh), color.red);

#def crossdn = !first and close[1] crosses below high1low and close < high1low;
#def crossdn =  (!first and close[1] crosses below high1low and close <high1low) or
#     (sum(swinghigh, 3)>=1 and close[1] < high1low and close < high1low);
def crossdn =  if close crosses below high1low then bn else 99999;
#def crossdnbar = between(highbar, crossdn, bn);
def crossdnsig = if bn equals crossdn then 1 else 0;

def dnsince = barssince(crossdn);

plot highdn = crossdnsig;
# and dnsince[1]<length;
highdn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

high1.setpaintingstrategy(paintingstrategy.horizontal);
high1low.setpaintingstrategy(paintingstrategy.horizontal);

# End
I don't think "Long" should fire in here.
aV9RC1l.png
 
Are you mostly using them to observe that trend line support is not broken, and looking for trend agreement among all three? I would have expected that these would be like lagging indicators for SPX trend action but do you find that when some of them are no longer in agreement (e.g. 1/3 or 2/3) then that is a leading signal that SPX will reverse? I’m very interested in understanding your thought process for how to apply these charts when trading SPX or ES.
I personally use a very rudimentary indicator to estimate overall market sentiment or you can say current trend. I only trade SPX and have found the indicator originally presented here very useful by @Chemmy. I avoid trading against these sentiments at any point in time.

Here is my indicator to develop an understanding of the overall market. This is not very scientific perhaps.
https://usethinkscript.com/threads/...cator-for-thinkorswim.1825/page-2#post-118310
 
Last edited by a moderator:
I don't think "Long" should fire in here.
aV9RC1l.png

Yeah, so that's due to two things:
1. The fact that I still haven't gotten the repeat signals fixed -- the first arrow in that zone is the only one that should show, I just haven't finished that bit yet
2. The original logic requires a cross of the previous candle close over the zone high, which is why this fired even though it went right into a new swing high. I can definitely add a buffer or something to suppress immediate fires in the opposite direction though if needed, I had that in the original version of this code too.
 
Yeah, so that's due to two things:
1. The fact that I still haven't gotten the repeat signals fixed -- the first arrow in that zone is the only one that should show, I just haven't finished that bit yet
2. The original logic requires a cross of the previous candle close over the zone high, which is why this fired even though it went right into a new swing high. I can definitely add a buffer or something to suppress immediate fires in the opposite direction though if needed, I had that in the original version of this code too.
That will be helpful. Even though I selected the current timeframe, it will still repaint. That short zone disappeared. Otherwise, it works very well.
IovbZBp.png
 
Status
Not open for further replies.

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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