Price Action inside Linear Regression Channel For ThinkOrSwim

mashume

Expert
VIP
Lifetime

PRICE ACTION WITHIN THE LINEAR REGRESSION CHANNEL

http://tos.mx/Za1ku4y
DESCRIPTION
I set out to look at how price action moves within the linear regression channel, but found it frustrating to be unable to see the history of price action relative to the channel at points in the past.

This code plots candles relative to the centerline of the linear regression channel (the linear regression line) and shows the movement relative to that.

USAGE
Following the indicator is simple enough. Entries may be signaled by the proce moving upward off the lower boundary, and exits (or short entries) may be found when the indicator is moving off the upper side band. If the price is meandering around the central line, it is an indication that there is little direction to the proce movement to go against the current trend (the channel may be compressing) and nothing is happening to change direction.

THIS IS IMPORTANT: Just because the price action is not moving within the channel does not mean that it is not moving, just that it is moving in harmony and agreement with the direction and rate of change of the linear regression line. It could be falling off a cliff or flying straight up for the moon... this indicator does not tell you anything about the trend of the indicator.

There are arrows shown in the screen capture that are not in this indicator. They are based on some other proprietary code and I cannot share them. However, I believe this indicator may be of value to some members of the community regardless.
Code:
####################################################
#
#  PRICE MOVEMENT WITHIN LINEAR REGRESSION CHANNEL
#
#  Price Action Relative to Linear Regression
#
#  by mashume for the usethinkscript.com community
#
#  2022.03.28
#
#  Released the MIT License as open source
#  (c) mashume 2022
#
####################################################

declare lower;

input price = close;
input widthOfChannel = 90.0;
input fullRange = No;
input length = 50;
input colour = yes;
input labels = yes;

def MiddleLR;
if (fullRange)
then {
    MiddleLR = InertiaAll(price);
} else {
    MiddleLR = Inertia(price, length);
}

def dist = Highest((AbsValue(MiddleLR - price)) * (widthOfChannel / 100.0), length);

plot UpperLR = dist;
plot LowerLR = - dist;

UpperLR.SetDefaultColor(GetColor(3));
LowerLR.SetDefaultColor(GetColor(3));


plot zero = 0;
zero.SetDefaultColor(GetColor(3));

def h = high - MiddleLR;
def l = low - MiddleLR;
def o = open - MiddleLR;
def c = close - MiddleLR;

AddChart(open = o, high = h, low = l, close = c, growColor = color.light_gray, fallColor = color.light_gray, neutralColor = color.light_gray, type = ChartType.BAR);


plot LRS = 100 * ( wma(price, length) -  Average(price, length) ) / (length - 1);

EYE CANDY AND DESCRIPTION

This is not investment advice.
npSPztw.png


Several new indicators are included in this screen shot. But I'm lazy and only did one write up. You can find the other threads somewhere on usethinkscript.com

A
The LINEAR REGRESSION CENTERLINE EXCURSION indicator shows a clear enter signal which lasts nicely through the bulk of the upward movement.

B
The PRICE ACTION within LINEAR REGRESSION CHANNEL indicator shows a squeeze and a bounce off the lower line which corresponds nicely with a move upward in the price chart.

C
The LINEAR REGRESSION CENTERLINE EXCURSION indicator shows a good short signal, though the signal does not last as long as the downward trend.

D
Fourier RMS shows an increase in short term energy as a proportion of the total energy (the blue line rises and the red falls).

E
Fourier RMS shows an dramatic decrease in the short term (blue) line and a distinct rise in the long term (red).
 
Last edited:

PRICE ACTION WITHIN THE LINEAR REGRESSION CHANNEL

http://tos.mx/Za1ku4y
DESCRIPTION
I set out to look at how price action moves within the linear regression channel, but found it frustrating to be unable to see the history of price action relative to the channel at points in the past.

This code plots candles relative to the centerline of the linear regression channel (the linear regression line) and shows the movement relative to that.

USAGE
Following the indicator is simple enough. Entries may be signaled by the proce moving upward off the lower boundary, and exits (or short entries) may be found when the indicator is moving off the upper side band. If the price is meandering around the central line, it is an indication that there is little direction to the proce movement to go against the current trend (the channel may be compressing) and nothing is happening to change direction.

THIS IS IMPORTANT: Just because the price action is not moving within the channel does not mean that it is not moving, just that it is moving in harmony and agreement with the direction and rate of change of the linear regression line. It could be falling off a cliff or flying straight up for the moon... this indicator does not tell you anything about the trend of the indicator.

There are arrows shown in the screen capture that are not in this indicator. They are based on some other proprietary code and I cannot share them. However, I believe this indicator may be of value to some members of the community regardless.
Code:
####################################################
#
#  PRICE MOVEMENT WITHIN LINEAR REGRESSION CHANNEL
#
#  Price Action Relative to Linear Regression
#
#  by mashume for the usethinkscript.com community
#
#  2022.03.28
#
#  Released the MIT License as open source
#  (c) mashume 2022
#
####################################################

declare lower;

input price = close;
input widthOfChannel = 90.0;
input fullRange = No;
input length = 50;
input colour = yes;
input labels = yes;

def MiddleLR;
if (fullRange)
then {
    MiddleLR = InertiaAll(price);
} else {
    MiddleLR = Inertia(price, length);
}

def dist = Highest((AbsValue(MiddleLR - price)) * (widthOfChannel / 100.0), length);

plot UpperLR = dist;
plot LowerLR = - dist;

UpperLR.SetDefaultColor(GetColor(3));
LowerLR.SetDefaultColor(GetColor(3));


plot zero = 0;
zero.SetDefaultColor(GetColor(3));

def h = high - MiddleLR;
def l = low - MiddleLR;
def o = open - MiddleLR;
def c = close - MiddleLR;

AddChart(open = o, high = h, low = l, close = c, growColor = color.light_gray, fallColor = color.light_gray, neutralColor = color.light_gray, type = ChartType.BAR);


plot LRS = 100 * ( wma(price, length) -  Average(price, length) ) / (length - 1);

EYE CANDY AND DESCRIPTION

This is not investment advice.
npSPztw.png


Several new indicators are included in this screen shot. But I'm lazy and only did one write up. You can find the other threads somewhere on usethinkscript.com

A
The LINEAR REGRESSION CENTERLINE EXCURSION indicator shows a clear enter signal which lasts nicely through the bulk of the upward movement.

B
The PRICE ACTION within LINEAR REGRESSION CHANNEL indicator shows a squeeze and a bounce off the lower line which corresponds nicely with a move upward in the price chart.

C
The LINEAR REGRESSION CENTERLINE EXCURSION indicator shows a good short signal, though the signal does not last as long as the downward trend.

D
Fourier RMS shows an increase in short term energy as a proportion of the total energy (the blue line rises and the red falls).

E
Fourier RMS shows an dramatic decrease in the short term (blue) line and a distinct rise in the long term (red).
Would the LinearRegressChannel lower with red and green histogram be available?
 
Would the LinearRegressChannel lower with red and green histogram be available?
Sure. Here it is. This one plots a couple of extra lines above and below... you may turn them off as you see fit. Why does it do this you may ask? Because I'm an habitual tinkerer and I'm always trying to do something new or glean some additional piece of information. They are not always useful pieces, however. In this case, it was an attempt to look at momentum as it related to the slope of the upper line (in the indicator code -- not the plotted line shown). The lines turn black if the slope is increasing for two bars and grey if the slope is not. These colours are, of course, best on a light background... you can change them though in the code below.

Enjoy!

-mashume

Code:
declare lower;

input length = 20;
input smoothed = {default "no", "yes"};
input smoothing = AverageType.SIMPLE;
input smooth_length = 3;

def UpperRegLine;
def LowerRegLine;
def MiddleRegLine;


switch (smoothed) {
    CASE "no":
        UpperRegLine = Inertia(HIGH, length);
        LowerRegLine = Inertia(LOW, length);
        MiddleRegLine = Inertia(CLOSE, length);
    CASE "yes":
        UpperRegLine = MovingAverage(averageType = smoothing, length = smooth_length, data = Inertia(HIGH, length));
        LowerRegLine = MovingAverage(averageType = smoothing, length = smooth_length, data = Inertia(LOW, length));
        MiddleRegLine = MovingAverage(averageType = smoothing, length = smooth_length, data = Inertia(CLOSE, length));
}    


plot UpperLine = (UpperRegLine - LowerRegLine) / 2;
plot LowerLine = -UpperLine;

plot MiddleLine = -((UpperRegLine - MiddleRegLine) - UpperLine);
MiddleLine.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
# MiddleLine.AssignValueColor(if AbsValue(middleLine) < UpperLine * .2 then color.light_gray else if MiddleLine >= 0 then color.dark_green else color.dark_red);

MiddleLine.AssignValueColor( if MiddleLine >= 0 then color.dark_green else color.dark_red);

plot zero = 0;

UpperLine.AssignValueColor(if UpperLine > UpperLine[2] and UpperLine > UpperLine[1] then color.black else color.light_gray);

LowerLine.AssignValueColor(if UpperLine > UpperLine[2] and UpperLine > UpperLine[1] then color.black else color.light_gray);

# AddCloud(UpperLine, UpperLine[2], color.black, color.dark_orange);
Plot Enter = if MiddleLine crosses above (UpperLine * .2) then 0 else double.nan;

Plot Exit = if MiddleLine crosses below -(UpperLine * .2) then 0 else double.nan;
 
Sure. Here it is. This one plots a couple of extra lines above and below... you may turn them off as you see fit. Why does it do this you may ask? Because I'm an habitual tinkerer and I'm always trying to do something new or glean some additional piece of information. They are not always useful pieces, however. In this case, it was an attempt to look at momentum as it related to the slope of the upper line (in the indicator code -- not the plotted line shown). The lines turn black if the slope is increasing for two bars and grey if the slope is not. These colours are, of course, best on a light background... you can change them though in the code below.

Enjoy!

-mashume

Code:
declare lower;

input length = 20;
input smoothed = {default "no", "yes"};
input smoothing = AverageType.SIMPLE;
input smooth_length = 3;

def UpperRegLine;
def LowerRegLine;
def MiddleRegLine;


switch (smoothed) {
    CASE "no":
        UpperRegLine = Inertia(HIGH, length);
        LowerRegLine = Inertia(LOW, length);
        MiddleRegLine = Inertia(CLOSE, length);
    CASE "yes":
        UpperRegLine = MovingAverage(averageType = smoothing, length = smooth_length, data = Inertia(HIGH, length));
        LowerRegLine = MovingAverage(averageType = smoothing, length = smooth_length, data = Inertia(LOW, length));
        MiddleRegLine = MovingAverage(averageType = smoothing, length = smooth_length, data = Inertia(CLOSE, length));
}  


plot UpperLine = (UpperRegLine - LowerRegLine) / 2;
plot LowerLine = -UpperLine;

plot MiddleLine = -((UpperRegLine - MiddleRegLine) - UpperLine);
MiddleLine.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
# MiddleLine.AssignValueColor(if AbsValue(middleLine) < UpperLine * .2 then color.light_gray else if MiddleLine >= 0 then color.dark_green else color.dark_red);

MiddleLine.AssignValueColor( if MiddleLine >= 0 then color.dark_green else color.dark_red);

plot zero = 0;

UpperLine.AssignValueColor(if UpperLine > UpperLine[2] and UpperLine > UpperLine[1] then color.black else color.light_gray);

LowerLine.AssignValueColor(if UpperLine > UpperLine[2] and UpperLine > UpperLine[1] then color.black else color.light_gray);

# AddCloud(UpperLine, UpperLine[2], color.black, color.dark_orange);
Plot Enter = if MiddleLine crosses above (UpperLine * .2) then 0 else double.nan;

Plot Exit = if MiddleLine crosses below -(UpperLine * .2) then 0 else double.nan;
thank you very much @mashume great job!! can i ask you a favor, can you add paint the bar at Entry green and Exit red please. thanks in advance


or maybe better leave the candle the current color but when get a enter signal changes the candles bar let say yellow or other color. thanks in advance
 
Last edited by a moderator:
thank you very much @mashume great job!! can i ask you a favor, can you add paint the bar at Entry green and Exit red please. thanks in advance


or maybe better leave the candle the current color but when get a enter signal changes the candles bar let say yellow or other color. thanks in advance
Add this at the end of the indicator code:
Code:
AssignPriceColor(if MiddleLine crosses 0 then color.orange
else color.current);

any time the histogram crosses 0 it will paint the bar orange, otherwise it will be current color.

-mashume
 
@mashume i'm sorry to bother you but can we add when the price cross up the middle line the paint the candle yellow and when is cross the middle line down paint the candle orange? thanks in advance
Code:
AssignPriceColor(
if MiddleLine crosses above 0 then color.yellow 
else if MiddleLine crosses below 0 then color.orange 
else color.current);
 
Sure. Here it is. This one plots a couple of extra lines above and below... you may turn them off as you see fit. Why does it do this you may ask? Because I'm an habitual tinkerer and I'm always trying to do something new or glean some additional piece of information. They are not always useful pieces, however. In this case, it was an attempt to look at momentum as it related to the slope of the upper line (in the indicator code -- not the plotted line shown). The lines turn black if the slope is increasing for two bars and grey if the slope is not. These colours are, of course, best on a light background... you can change them though in the code below.

Enjoy!

-mashume

Code:
declare lower;

input length = 20;
input smoothed = {default "no", "yes"};
input smoothing = AverageType.SIMPLE;
input smooth_length = 3;

def UpperRegLine;
def LowerRegLine;
def MiddleRegLine;


switch (smoothed) {
    CASE "no":
        UpperRegLine = Inertia(HIGH, length);
        LowerRegLine = Inertia(LOW, length);
        MiddleRegLine = Inertia(CLOSE, length);
    CASE "yes":
        UpperRegLine = MovingAverage(averageType = smoothing, length = smooth_length, data = Inertia(HIGH, length));
        LowerRegLine = MovingAverage(averageType = smoothing, length = smooth_length, data = Inertia(LOW, length));
        MiddleRegLine = MovingAverage(averageType = smoothing, length = smooth_length, data = Inertia(CLOSE, length));
}   


plot UpperLine = (UpperRegLine - LowerRegLine) / 2;
plot LowerLine = -UpperLine;

plot MiddleLine = -((UpperRegLine - MiddleRegLine) - UpperLine);
MiddleLine.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
# MiddleLine.AssignValueColor(if AbsValue(middleLine) < UpperLine * .2 then color.light_gray else if MiddleLine >= 0 then color.dark_green else color.dark_red);

MiddleLine.AssignValueColor( if MiddleLine >= 0 then color.dark_green else color.dark_red);

plot zero = 0;

UpperLine.AssignValueColor(if UpperLine > UpperLine[2] and UpperLine > UpperLine[1] then color.black else color.light_gray);

LowerLine.AssignValueColor(if UpperLine > UpperLine[2] and UpperLine > UpperLine[1] then color.black else color.light_gray);

# AddCloud(UpperLine, UpperLine[2], color.black, color.dark_orange);
Plot Enter = if MiddleLine crosses above (UpperLine * .2) then 0 else double.nan;

Plot Exit = if MiddleLine crosses below -(UpperLine * .2) then 0 else double.nan;
So in analyzing this with Inertia of (close) vs. say ohlc4 it dawns on me that the lines are simply high/low regression. The Upper line is simply the mid of the the two (and the lower the inverse).

Basic Concept is: (linear regression of (high) - linear regression of (low)) / 2.
Then you mirror the upper and oscillate the Middleline around Zero and change colors when it's > that .2 of the absvalue or < .2 of the absvalue.

I changed the colors and see that the the lines are inverse oscillations around the rise and fall of the regr(close). I suspect there are other ways to analyze. 20% seems to indicate similar to overbought/sold conditions But why instead not look for a standard error and see if it violates a confidence interval? I may code this up, because this is an interesting idea.

What concept is this rooted in?
 

PRICE ACTION WITHIN THE LINEAR REGRESSION CHANNEL

http://tos.mx/Za1ku4y
DESCRIPTION
I set out to look at how price action moves within the linear regression channel, but found it frustrating to be unable to see the history of price action relative to the channel at points in the past.

This code plots candles relative to the centerline of the linear regression channel (the linear regression line) and shows the movement relative to that.

USAGE
Following the indicator is simple enough. Entries may be signaled by the proce moving upward off the lower boundary, and exits (or short entries) may be found when the indicator is moving off the upper side band. If the price is meandering around the central line, it is an indication that there is little direction to the proce movement to go against the current trend (the channel may be compressing) and nothing is happening to change direction.

THIS IS IMPORTANT: Just because the price action is not moving within the channel does not mean that it is not moving, just that it is moving in harmony and agreement with the direction and rate of change of the linear regression line. It could be falling off a cliff or flying straight up for the moon... this indicator does not tell you anything about the trend of the indicator.

There are arrows shown in the screen capture that are not in this indicator. They are based on some other proprietary code and I cannot share them. However, I believe this indicator may be of value to some members of the community regardless.
Code:
####################################################
#
#  PRICE MOVEMENT WITHIN LINEAR REGRESSION CHANNEL
#
#  Price Action Relative to Linear Regression
#
#  by mashume for the usethinkscript.com community
#
#  2022.03.28
#
#  Released the MIT License as open source
#  (c) mashume 2022
#
####################################################

declare lower;

input price = close;
input widthOfChannel = 90.0;
input fullRange = No;
input length = 50;
input colour = yes;
input labels = yes;

def MiddleLR;
if (fullRange)
then {
    MiddleLR = InertiaAll(price);
} else {
    MiddleLR = Inertia(price, length);
}

def dist = Highest((AbsValue(MiddleLR - price)) * (widthOfChannel / 100.0), length);

plot UpperLR = dist;
plot LowerLR = - dist;

UpperLR.SetDefaultColor(GetColor(3));
LowerLR.SetDefaultColor(GetColor(3));


plot zero = 0;
zero.SetDefaultColor(GetColor(3));

def h = high - MiddleLR;
def l = low - MiddleLR;
def o = open - MiddleLR;
def c = close - MiddleLR;

AddChart(open = o, high = h, low = l, close = c, growColor = color.light_gray, fallColor = color.light_gray, neutralColor = color.light_gray, type = ChartType.BAR);


plot LRS = 100 * ( wma(price, length) -  Average(price, length) ) / (length - 1);

EYE CANDY AND DESCRIPTION

This is not investment advice.
npSPztw.png


Several new indicators are included in this screen shot. But I'm lazy and only did one write up. You can find the other threads somewhere on usethinkscript.com

A
The LINEAR REGRESSION CENTERLINE EXCURSION indicator shows a clear enter signal which lasts nicely through the bulk of the upward movement.

B
The PRICE ACTION within LINEAR REGRESSION CHANNEL indicator shows a squeeze and a bounce off the lower line which corresponds nicely with a move upward in the price chart.

C
The LINEAR REGRESSION CENTERLINE EXCURSION indicator shows a good short signal, though the signal does not last as long as the downward trend.

D
Fourier RMS shows an increase in short term energy as a proportion of the total energy (the blue line rises and the red falls).

E
Fourier RMS shows an dramatic decrease in the short term (blue) line and a distinct rise in the long term (red).
I wanted to look at LinearRegressionLower with a confidence interval (and possibly add StandardError not yet plotted).
I started the Percentile at 68% for one sigma then expanded it by 1 confidence interval x 1.64 both up and down.
Considering the same for the LinRegchannel lower but the inverse is messing with my minds eye. I re-colored to get an idea of how the lines are working.

qnLXAT0.png

See code below.

####################################################
#
# PRICE MOVEMENT WITHIN LINEAR REGRESSION CHANNEL
#
# Price Action Relative to Linear Regression
#
# by mashume for the usethinkscript.com community
#
# 2022.03.28
#
# Released the MIT License as open source
# (c) mashume 2022
#
####################################################

declare lower;

input price = close;
input widthOfChannel = 68.0;
input fullRange = No;
input length = 50;
input colour = yes;
input labels = yes;

def MiddleLR;
def SE;
if (fullRange)
then {
MiddleLR = InertiaAll(price);
SE = StErrAll(price);
} else {
MiddleLR = Inertia(price, length);
SE = StErr(price, length);
}

def dist = Highest((AbsValue(MiddleLR - price)) * (widthOfChannel / 100.0), length);

plot UpperLR = dist;
plot LowerLR = - dist;
plot upperlr2 = dist * 1.64;
plot lowerLR2 = - dist * 1.64;
#plot seupper = dist + Se *1.64;
#plot selower = -dist - se*1.64;

UpperLR.SetDefaultColor(GetColor(3));
LowerLR.SetDefaultColor(GetColor(3));
UpperLR2.SetDefaultColor(GetColor(3));
LowerLR2.SetDefaultColor(GetColor(3));


plot zero = 0;
zero.SetDefaultColor(GetColor(3));

def h = high - MiddleLR;
def l = low - MiddleLR;
def o = open - MiddleLR;
def c = close - MiddleLR;

AddChart(open = o, high = h, low = l, close = c, growColor = color.violet, fallColor = color.plum, neutralColor = color.light_gray, type = ChartType.HeiKIN_ASHI);


plot LRS = 100 * ( wma(price, length) - Average(price, length) ) / (length - 1);
LRS.setDefaultColor(Color.Green);
 

PRICE ACTION WITHIN THE LINEAR REGRESSION CHANNEL

http://tos.mx/Za1ku4y
DESCRIPTION
I set out to look at how price action moves within the linear regression channel, but found it frustrating to be unable to see the history of price action relative to the channel at points in the past.

This code plots candles relative to the centerline of the linear regression channel (the linear regression line) and shows the movement relative to that.

USAGE
Following the indicator is simple enough. Entries may be signaled by the proce moving upward off the lower boundary, and exits (or short entries) may be found when the indicator is moving off the upper side band. If the price is meandering around the central line, it is an indication that there is little direction to the proce movement to go against the current trend (the channel may be compressing) and nothing is happening to change direction.

THIS IS IMPORTANT: Just because the price action is not moving within the channel does not mean that it is not moving, just that it is moving in harmony and agreement with the direction and rate of change of the linear regression line. It could be falling off a cliff or flying straight up for the moon... this indicator does not tell you anything about the trend of the indicator.

There are arrows shown in the screen capture that are not in this indicator. They are based on some other proprietary code and I cannot share them. However, I believe this indicator may be of value to some members of the community regardless.
Code:
####################################################
#
#  PRICE MOVEMENT WITHIN LINEAR REGRESSION CHANNEL
#
#  Price Action Relative to Linear Regression
#
#  by mashume for the usethinkscript.com community
#
#  2022.03.28
#
#  Released the MIT License as open source
#  (c) mashume 2022
#
####################################################

declare lower;

input price = close;
input widthOfChannel = 90.0;
input fullRange = No;
input length = 50;
input colour = yes;
input labels = yes;

def MiddleLR;
if (fullRange)
then {
    MiddleLR = InertiaAll(price);
} else {
    MiddleLR = Inertia(price, length);
}

def dist = Highest((AbsValue(MiddleLR - price)) * (widthOfChannel / 100.0), length);

plot UpperLR = dist;
plot LowerLR = - dist;

UpperLR.SetDefaultColor(GetColor(3));
LowerLR.SetDefaultColor(GetColor(3));


plot zero = 0;
zero.SetDefaultColor(GetColor(3));

def h = high - MiddleLR;
def l = low - MiddleLR;
def o = open - MiddleLR;
def c = close - MiddleLR;

AddChart(open = o, high = h, low = l, close = c, growColor = color.light_gray, fallColor = color.light_gray, neutralColor = color.light_gray, type = ChartType.BAR);


plot LRS = 100 * ( wma(price, length) -  Average(price, length) ) / (length - 1);

EYE CANDY AND DESCRIPTION

This is not investment advice.
npSPztw.png


Several new indicators are included in this screen shot. But I'm lazy and only did one write up. You can find the other threads somewhere on usethinkscript.com

A
The LINEAR REGRESSION CENTERLINE EXCURSION indicator shows a clear enter signal which lasts nicely through the bulk of the upward movement.

B
The PRICE ACTION within LINEAR REGRESSION CHANNEL indicator shows a squeeze and a bounce off the lower line which corresponds nicely with a move upward in the price chart.

C
The LINEAR REGRESSION CENTERLINE EXCURSION indicator shows a good short signal, though the signal does not last as long as the downward trend.

D
Fourier RMS shows an increase in short term energy as a proportion of the total energy (the blue line rises and the red falls).

E
Fourier RMS shows an dramatic decrease in the short term (blue) line and a distinct rise in the long term (red).
Thank you for this, would you suggest running this "FULL RANGE" on or off?
 
Thank you for this, would you suggest running this "FULL RANGE" on or off?
Analysis like this can be subjective but try Full Range at first, lower the length to 21 or 12 even (12 is 1hr of candles on a 5m chart).
Then start looking for divergences. You see the setup as it crosses below 1 and 2 CI (confidence interval) then drops below the mid, and finally bottoms. Then it goes into a squeeze and continues downward. Backtest in block of 5 days (1 week), using 5 or 30m candles. Anything smaller is noise and anything bigger is too big for shorter blocks of data/candles.

OX9BD8I.png
 
By divergences I mean Hidden Divergences. When price i moving up but the LRS starts making lower highs. When it crosses the mid on the final push you get the flush, then a squeeze, then the flush again.

Analysis like this can be subjective but try Full Range at first, lower the length to 21 or 12 even (12 is 1hr of candles on a 5m chart).
Then start looking for divergences. You see the setup as it crosses below 1 and 2 CI (confidence interval) then drops below the mid, and finally bottoms. Then it goes into a squeeze and continues downward. Backtest in block of 5 days (1 week), using 5 or 30m candles. Anything smaller is noise and anything bigger is too big for shorter blocks of data/candles.

OX9BD8I.png
 
@mashume thank you some much. it is great! please can we add the scan for it? that will be awesome. thank you in advance!
Ooooooh, scans are not my forte. I will leave that to more capable others... though I imagine the inertiaAll() function might not play nicely in a scan.

-mashume
 
Ooooooh, scans are not my forte. I will leave that to more capable others... though I imagine the inertiaAll() function might not play nicely in a scan.

-mashume
Mashume, I am completely ignorant about writing codes, and scripts. So, I will trouble you with a revision to the earlier one that wrote that has arrows pointing out to buy and sell. Can you modify it to show if acted on those signals how those trades would end up? Like x many trades would be x time successful. One more: candlesticks possible?
 

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