Rally based Rally Label With Timeframes For ThinkOrSwim

ApeX Predator

Well-known member
Rally based Rally Label with timeframes
Based on @tradeimbalances criteria below post.

Ruby:
#Modified by SuryaKiranC
#Requested at https://usethinkscript.com/threads/rally-based-rally-label-with-timeframes.7126/

declare once_per_bar;
input ShowArrows = Yes;
input ShowBubbles = No;

def IsUp = close > open;
def IsDown = close < open;
def IsDoji = IsDoji();
def avgRange = 0.05 * Average(high - low, 20);
def isBasingDemandRBR = IsAscending(close, 2)[1] and (IsDown[0] or IsDoji) and IsUp[-1] and open[0] < close[-1] and high[0] < high[-1];
def isBasingDemandDBR = IsDescending(close, 2)[1] and (IsDown[0] or IsDoji) and IsUp[-1] and open[0] < close[-1] and low[0] < low[-1];
def isBasingSupplyDBD = IsDescending(close, 2)[1] and (IsUp[0] or IsDoji) and IsDown[-1] and high[0] > high[-1] and open[0] > close[-1] and low[0] > low[-1];
def isBasingSupplyRBD = IsAscending(close, 2)[1] and (IsUp[0] or IsDoji) and IsDown[-1] and high[0] > high[-1] and open[0] > close[-1];

plot BasingDemandRBR = if isBasingDemandRBR then low else Double.NaN;
plot BasingDemandDBR = if isBasingDemandDBR then high else Double.NaN;

plot BasingSupplyRBD = if isBasingSupplyRBD then low else Double.NaN;
plot BasingSupplyDBD = if isBasingSupplyDBD then high else Double.NaN;

BasingDemandRBR.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
BasingDemandRBR.SetDefaultColor(GetColor(1));
BasingDemandRBR.SetHiding(!ShowArrows);
AddChartBubble(ShowBubbles and BasingDemandRBR, low, "RBR",GetColor(1), no);

BasingDemandDBR.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
BasingDemandDBR.SetDefaultColor(GetColor(1));
BasingDemandDBR.SetHiding(!ShowArrows);
AddChartBubble(ShowBubbles and BasingDemandDBR, low, "DBR",GetColor(1), no);

BasingSupplyRBD.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
BasingSupplyRBD.SetDefaultColor(GetColor(0));
BasingSupplyRBD.SetHiding(!ShowArrows);
AddChartBubble(ShowBubbles and BasingSupplyRBD, high, "RBD",GetColor(0), yes);

BasingSupplyDBD.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
BasingSupplyDBD.SetDefaultColor(GetColor(0));
BasingSupplyDBD.SetHiding(!ShowArrows);
AddChartBubble(ShowBubbles and BasingSupplyDBD, high, "DBD",GetColor(0), yes);
 
Last edited by a moderator:
Hi

I am new and looking for this type of script. I have no programming skills. Can anyone assist me:-

RBR green / red / green candle formation

RBD red / green /red candle formation


Need a label and ping alert in the tos chart

Only in open market it is active

“criteria” green label when found this rbr pattern when the last time and sales transacted price is above the open of the last red candle - do not look at asks and bid data

“criteria” yellow label when found this rbd pattern when the last time and sales transacted price is below the close of the last green candle - do not look at asks and bid data


If candle fails then the trader is responsibile to get out pf the trade

Works on all time frames 1/3/5/10/15/30/45/90 min and 1/2/3/4 hr

Should have tabs in the study edit panel to activate the timeframes one requires

Call to action - when a rbr or rbd criteria is met then the label goes green/yellow a alert ping is sounded off and the label states rbr and the timeframe - e.g. rbr 1 min / rbr 5min

Fail if the last time and sales transacted price is the close of the last candle while the current candle is forming then the label changes to cream colour and says “fail 1 min”

Call to action - if the last time and sales transacted price is below the close of the last red candle of a rbr while the current candle is forming then the label changes to cream colour and says “fail - timeframe” - e.g. “ fail - 1 min”

Call to action - if the last time and sales transacted price is above the open of the last green candle of a rbd while the current candle is forming then the label changes to cream colour and says “fail - timeframe” - e.g. “ fail - 1 min”

Repeated call to action so the label and alert is sounded off when the candle closes off

Repeated call to action so the label and alert is sounded off when the candle passes the above price points in above call to action points

Cheers
 

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