ORB breakout breaking signal

leonardoroap

New member
VIP
I need help
Modify this code so that it gives me a signal and returns the actions that break the maximum or minimum of the breakout in a period of 15 minutes at the market opening. Thank you
If it breaks the breakout high, the candle should end up green and if it breaks the breakout low, the candle should end up red.

Code:
input openingRangeStartTimeEST = 930;
input openingRangeEndTimeEST = 945;
def openingRange = if SecondsTillTime(openingRangeStartTimeEST) <= 0 and SecondsTillTime(openingRangeEndTimeEST) >= 0 then 1 else 0;
def openingRangeLow = if SecondsTillTime(openingRangeStartTimeEST) == 0 then low else if openingRange and low < openingRangeLow[1] then low else openingRangeLow[1];
def openingRangeHigh = if SecondsTillTime(openingRangeStartTimeEST) == 0 then high else if openingRange and high > openingRangeHigh[1] then high else openingRangeHigh[1];

plot lowCloud = if openingRange then openingRangeLow else Double.NaN;
plot highCloud = if openingRange then openingRangeHigh else Double.NaN;
lowCloud.SetDefaultColor(Color.GRAY);
highCloud.SetDefaultColor(Color.GRAY);
AddCloud(lowCloud, highCloud, Color.GRAY, Color.GRAY);
input tradeEntryStartTimeEST = 945;
input tradeEntryEndTimeEST = 1100;
def tradeEntryRange = if SecondsTillTime(tradeEntryStartTimeEST) <= 0 and SecondsTillTime(tradeEntryEndTimeEST) >= 0 then 1 else 0;
plot tradeEntryLowExtension = if tradeEntryRange then openingRangeLow else Double.NaN;
plot tradeEntryHighExtension = if tradeEntryRange then openingRangeHigh else Double.NaN;
tradeEntryLowExtension.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
tradeEntryHighExtension.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
tradeEntryLowExtension.SetStyle(Curve.SHORT_DASH);
tradeEntryHighExtension.SetStyle(Curve.SHORT_DASH);
tradeEntryLowExtension.SetDefaultColor(Color.GRAY);
tradeEntryHighExtension.SetDefaultColor(Color.GRAY);

input entryType = {default wickTouch, closeAbove};
def bearEntryCondition;
def bullEntryCondition;


switch (entryType){
case wickTouch:
bearEntryCondition = tradeEntryRange and low < openingRangeLow and low[1] >= openingRangeLow;
bullEntryCondition = tradeEntryRange and high > openingRangeHigh and high[1] <= openingRangeHigh;
case closeAbove:
bearEntryCondition = tradeEntryRange and close < openingRangeLow and close[1] >= openingRangeLow;
bullEntryCondition = tradeEntryRange and close > openingRangeHigh and close[1] <= openingRangeHigh;
}
def bearishORB = if bearEntryCondition then 1 else if !tradeEntryRange then 0 else bearishORB[1];
def bullishORB = if bullEntryCondition then 1 else if !tradeEntryRange then 0 else bullishORB[1];
def range = openingRangeHigh - openingRangeLow;
def halfRange = range / 2;
def midRange = openingRangeLow + halfRange;

plot midRangePlot = if tradeEntryRange then midRange else Double.NaN;
midRangePlot.SetStyle(Curve.SHORT_DASH);
midRangePlot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
midRangePlot.SetDefaultColor(Color.YELLOW);

def halfwayUpsideProjection = openingRangeHigh + halfRange;
plot halfwayUpsideProjectionPlot = if bullishORB and tradeEntryRange then halfwayUpsideProjection else Double.NaN;
halfwayUpsideProjectionPlot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
halfwayUpsideProjectionPlot.SetDefaultColor(Color.LIGHT_GREEN);

def halfwayDownsideProjection = openingRangeLow - halfRange;
plot halfwayDownsideProjectionPlot = if bearishORB and tradeEntryRange then halfwayDownsideProjection else Double.NaN;
halfwayDownsideProjectionPlot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
halfwayDownsideProjectionPlot.SetDefaultColor(Color.LIGHT_RED);

def fullUpsideProjection = openingRangeHigh + range;
plot fullUpsideProjectionPlot = if bullishORB and tradeEntryRange then fullUpsideProjection else Double.NaN;
fullUpsideProjectionPlot.SetDefaultColor(Color.GREEN);
fullUpsideProjectionPlot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

def fullDownsideProjection = openingRangeLow - range;
plot fullDownsideProjectionPlot = if bearishORB and tradeEntryRange then fullDownsideProjection else Double.NaN;
fullDownsideProjectionPlot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
fullDownsideProjectionPlot.SetDefaultColor(Color.RED);

alert(bullishORB, "leoBuy", alert.bar, sound.ding);
alert(bullEntryCondition, "leoBuy", alert.bar, sound.ding);
alert(openingRangeHigh, "leoBuy", alert.bar, sound.ding);
 

Attachments

  • Captura de ****alla (82).png
    Captura de ****alla (82).png
    144.4 KB · Views: 64
Last edited:
Sorry, I do not understand what you are looking for.

It is not possible to write code unless you provide definitions for your terms:
What does returns the actions that break the maximum or minimum of the breakout in a period of 15 minutes at the market opening mean?

What is the breakout high?
What is the breakout low?

Here are the ORB studies available on the forum. Perhaps you can make one of them work for you?
https://usethinkscript.com/search/2...1&c[nodes][0]=3&c[title_only]=1&o=replies&g=1
 

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