Trend reverse signal

tommy1327

New member
VIP
Need help anyone can help coding below requirment.
1. example 10 candle stick or certain sticks, price trend up. highest price for each stick keep make higher. until the latest highest price bar is red bar, make alert.
2. example price trending down, the lowest price keep make lower, until the latest lowest price is green bar.make alert
3. May use for 4hours chart or daily chart.

4.in a uptrend(price keeping higher and higher), if the latest bar's highest price lower than highest price(lower high) and the latest price lowest price is lower than the highest bar's lowest price(lower low) . we consier it is a top area
5. in a downtrend, if the latest bar make a "higher high" and "higher low", we conside it is a bottom area.

whether have alert or scanner can filter these signals. many thanks
or any indicator similar to it? thanks a lot.
 
Last edited by a moderator:
Solution
Need help anyone can help coding below requirment.
1. example 10 candle stick or certain sticks, price trend up. highest price for each stick keep make higher. until the latest highest price bar is red bar, make alert.
2. example price trending down, the lowest price keep make lower, until the latest lowest price is green bar.make alert
3. May use for 4hours chart or daily chart.

4.in a uptrend(price keeping higher and higher), if the latest bar's highest price lower than highest price(lower high) and the latest price lowest price is lower than the highest bar's lowest price(lower low) . we consier it is a top area
5. in a downtrend, if the latest bar make a "higher high" and "higher low", we conside it is a bottom area.

whether...
Need help anyone can help coding below requirment.
1. example 10 candle stick or certain sticks, price trend up. highest price for each stick keep make higher. until the latest highest price bar is red bar, make alert.
2. example price trending down, the lowest price keep make lower, until the latest lowest price is green bar.make alert
3. May use for 4hours chart or daily chart.

4.in a uptrend(price keeping higher and higher), if the latest bar's highest price lower than highest price(lower high) and the latest price lowest price is lower than the highest bar's lowest price(lower low) . we consier it is a top area
5. in a downtrend, if the latest bar make a "higher high" and "higher low", we conside it is a bottom area.

whether have alert or scanner can filter these signals. many thanks
or any indicator similar to it? thanks a lot.

this is a chart study, that looks for your rules and draws arrows and dots.


higher highs , lower lows
steps 1 & 2 , draw arrows on the xth bar, when the open/close is opposite.

top area , bottom area
steps 4 & 5 , draw dots after a run , then candle moved in oppsosite direction

draw horizontal lines from the top area candles and bottom area candles

alerts on the 4 signals


Code:
#hh_xbars_thenred

#https://usethinkscript.com/threads/trend-reverse-signal.16327/
#Trend reverse signal

#Need help anyone can help coding below requirment.
#1. example 10 candle stick or certain sticks, price trend up. highest price for each stick keep make higher. until the latest highest price bar is red bar, make alert.
#2. example price trending down, the lowest price keep make lower, until the latest lowest price is green bar.make alert
#3. May use for 4hours chart or daily chart.

#4.in a uptrend(price keeping higher and higher), if the latest bar's highest price lower than highest price(lower high) and the latest price lowest price is lower than the highest bar's lowest price(lower low) . we consier it is a top area
#5. in a downtrend, if the latest bar make a "higher high" and "higher low", we conside it is a bottom area.

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

input seq_bars = 10;

def hh = high > high[1];
def ll = low < low[1];

def lh = high < high[1];
def hl = low > low[1];

def grn = close > open;
def red = close < open;

def hhred = (sum(hh, seq_bars) == seq_bars and red);
def llgrn = (sum(ll, seq_bars) == seq_bars and grn);

plot z1 = hhred;
z1.SetPaintingStrategy(PaintingStrategy.boolean_ARROW_down);
z1.SetDefaultColor(Color.red);
z1.setlineweight(3);
z1.hidebubble();

plot z2 = llgrn;
z2.SetPaintingStrategy(PaintingStrategy.boolean_ARROW_up);
z2.SetDefaultColor(Color.green);
z2.setlineweight(3);
z2.hidebubble();

def toparea = (sum(hh[1], seq_bars) == seq_bars and lh and ll);
def botarea = (sum(ll[1], seq_bars) == seq_bars and hh and hl);

plot z3 = if toparea then high*1.002 else na;
z3.SetPaintingStrategy(PaintingStrategy.points);
z3.SetDefaultColor(Color.yellow);
z3.setlineweight(5);
z3.hidebubble();

plot z4 = if botarea then low*0.998 else na;
z4.SetPaintingStrategy(PaintingStrategy.points);
z4.SetDefaultColor(Color.cyan);
z4.setlineweight(5);
z4.hidebubble();


alert(llgrn, "LL grn" ,alert.BAR, sound.DING);
alert(hhred, "HH red" ,alert.BAR, sound.bell);

alert(botarea, "up area" ,alert.BAR, sound.DING);
alert(toparea, "down area" ,alert.BAR, sound.bell);

def topa_top = if bn == 1 then 0 else if toparea then high else topa_top[1];
def topa_bot = if bn == 1 then 0 else if toparea then low else topa_bot[1];
def bota_top = if bn == 1 then 0 else if botarea then high else bota_top[1];
def bota_bot = if bn == 1 then 0 else if botarea then low else bota_bot[1];

input plot_area_lines = yes;
plot z5 = if plot_area_lines and topa_top > 0 then topa_top else na;
plot z6 = if plot_area_lines and topa_bot > 0 then topa_bot else na;
plot z7 = if plot_area_lines and bota_top > 0 then bota_top else na;
plot z8 = if plot_area_lines and bota_bot > 0 then bota_bot else na;
z5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
z5.SetDefaultColor(Color.magenta);
z5.hidebubble();
z6.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
z6.SetDefaultColor(Color.magenta);
z6.hidebubble();
z7.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
z7.SetDefaultColor(Color.lime);
z7.hidebubble();
z8.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
z8.SetDefaultColor(Color.lime);
z8.hidebubble();
#


bars back set to 6
arrows appear on the 6th bar, when it is opposite
dots appear after a run , then moved in oppsosite direction
ric0iFN.jpg
 
Solution
this is a chart study, that looks for your rules and draws arrows and dots.


higher highs , lower lows
steps 1 & 2 , draw arrows on the xth bar, when the open/close is opposite.

top area , bottom area
steps 4 & 5 , draw dots after a run , then candle moved in oppsosite direction

draw horizontal lines from the top area candles and bottom area candles

alerts on the 4 signals


Code:
#hh_xbars_thenred

#https://usethinkscript.com/threads/trend-reverse-signal.16327/
#Trend reverse signal

#Need help anyone can help coding below requirment.
#1. example 10 candle stick or certain sticks, price trend up. highest price for each stick keep make higher. until the latest highest price bar is red bar, make alert.
#2. example price trending down, the lowest price keep make lower, until the latest lowest price is green bar.make alert
#3. May use for 4hours chart or daily chart.

#4.in a uptrend(price keeping higher and higher), if the latest bar's highest price lower than highest price(lower high) and the latest price lowest price is lower than the highest bar's lowest price(lower low) . we consier it is a top area
#5. in a downtrend, if the latest bar make a "higher high" and "higher low", we conside it is a bottom area.

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

input seq_bars = 10;

def hh = high > high[1];
def ll = low < low[1];

def lh = high < high[1];
def hl = low > low[1];

def grn = close > open;
def red = close < open;

def hhred = (sum(hh, seq_bars) == seq_bars and red);
def llgrn = (sum(ll, seq_bars) == seq_bars and grn);

plot z1 = hhred;
z1.SetPaintingStrategy(PaintingStrategy.boolean_ARROW_down);
z1.SetDefaultColor(Color.red);
z1.setlineweight(3);
z1.hidebubble();

plot z2 = llgrn;
z2.SetPaintingStrategy(PaintingStrategy.boolean_ARROW_up);
z2.SetDefaultColor(Color.green);
z2.setlineweight(3);
z2.hidebubble();

def toparea = (sum(hh[1], seq_bars) == seq_bars and lh and ll);
def botarea = (sum(ll[1], seq_bars) == seq_bars and hh and hl);

plot z3 = if toparea then high*1.002 else na;
z3.SetPaintingStrategy(PaintingStrategy.points);
z3.SetDefaultColor(Color.yellow);
z3.setlineweight(5);
z3.hidebubble();

plot z4 = if botarea then low*0.998 else na;
z4.SetPaintingStrategy(PaintingStrategy.points);
z4.SetDefaultColor(Color.cyan);
z4.setlineweight(5);
z4.hidebubble();


alert(llgrn, "LL grn" ,alert.BAR, sound.DING);
alert(hhred, "HH red" ,alert.BAR, sound.bell);

alert(botarea, "up area" ,alert.BAR, sound.DING);
alert(toparea, "down area" ,alert.BAR, sound.bell);

def topa_top = if bn == 1 then 0 else if toparea then high else topa_top[1];
def topa_bot = if bn == 1 then 0 else if toparea then low else topa_bot[1];
def bota_top = if bn == 1 then 0 else if botarea then high else bota_top[1];
def bota_bot = if bn == 1 then 0 else if botarea then low else bota_bot[1];

input plot_area_lines = yes;
plot z5 = if plot_area_lines and topa_top > 0 then topa_top else na;
plot z6 = if plot_area_lines and topa_bot > 0 then topa_bot else na;
plot z7 = if plot_area_lines and bota_top > 0 then bota_top else na;
plot z8 = if plot_area_lines and bota_bot > 0 then bota_bot else na;
z5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
z5.SetDefaultColor(Color.magenta);
z5.hidebubble();
z6.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
z6.SetDefaultColor(Color.magenta);
z6.hidebubble();
z7.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
z7.SetDefaultColor(Color.lime);
z7.hidebubble();
z8.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
z8.SetDefaultColor(Color.lime);
z8.hidebubble();
#


bars back set to 6
arrows appear on the 6th bar, when it is opposite
dots appear after a run , then moved in oppsosite direction
ric0iFN.jpg
Many thanks. by the way is it able to use this code for "watchlist"? or once the arrow and dot comes out, it can setup alert to send email( I will try it ). anyway many thanks.
 

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