Unique 5 Minutes Flip Opening Range Indicator

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

@john3 Trying to code as per your request :) I am not able to Handle the Inside Bar Yet.. The Pink Line is the FMF....

ASfC3Eq.png
 
I can't find the original specs, nor any of my notes. so I'm not sure why I wrote much of what I did... but here it is.

Code:
declare upper;

def h = high;
def l = low;

def OpeningBell = getTime()[1] < RegularTradingStart(getYYYYMMDD()) and
                  getTime() > RegularTradingStart(getYYYYMMDD());
def RTH = getTime() >= RegularTradingStart(getYYYYMMDD()) and
          getTime() <= RegularTradingEnd(getYYYYMMDD());
def FirstFiveActive = getTime() >= OpeningBell and
               getTime() <= RegularTradingStart(getYYYYMMDD()) + 300000;

def SecondFiveActive =
    getTime() >= RegularTradingStart(getYYYYMMDD()) + 300000 and     
    getTime() <= RegularTradingStart(getYYYYMMDD()) + 600000;

def FMF_high = if OpeningBell
          then h
          else if FirstFiveActive and
                  h > FMF_high[1]
               then h
               else FMF_high[1];
def FMF_low = if OpeningBell
          then l
          else if FirstFiveActive and
                  l < FMF_low[1]
               then l
               else FMF_low[1];

plot ORhigh = if !FirstFiveActive and RTH and FMF_high != 0
              then FMF_high
              else Double.NaN;
ORhigh.SetStyle(Curve.LONG_DASH);
ORhigh.SetLineWeight(1);
ORhigh.SetDefaultColor(Color.GREEN);

plot ORlow = if !FirstFiveActive and RTH and FMF_low != 0
             then FMF_low
             else Double.NaN;
ORlow.SetStyle(Curve.LONG_DASH);
ORlow.SetLineWeight(1);
ORlow.SetDefaultColor(Color.RED);

def Swing_Low = if SecondFiveActive and (l < FMF_Low and l < l[1])
    then l
    else if SecondFiveActive and l < Swing_Low[1]
        then l
        else Swing_Low[1];

def Swing_High = if SecondFiveActive and (h > FMF_High and h > h[1])
    then h
    else if SecondFiveActive and h > Swing_High[1]
        then h
        else Swing_High[1];

# plot LowSwing = if !FirstFiveActive and !SecondFiveActive and RTH and Swing_low != 0
plot LowSwing = if !FirstFiveActive and RTH
    then Swing_Low
    else Double.NaN;

plot HighSwing = if !FirstFiveActive and RTH
    then Swing_high
    else Double.NaN;


def swing = if firstFiveActive or SecondFiveActive
    then double.nan
    else
        if !isnan(swing)
            then swing[1]
        else
            if l < FMF_low
            then l - (FMF_high - FMF_low)
                else if h > fmf_high
                    then h + (FMF_high - FMF_low)
            else
                double.nan;

plot Flip = if !firstFiveActive and !secondFiveActive and RTH then swing else double.nan;

# plot flip = swing;

If anyone wants to re-post the requirements, I'll take another swing

-mashume
 
I can't find the original specs, nor any of my notes. so I'm not sure why I wrote much of what I did... but here it is.
...
If anyone wants to re-post the requirements, I'll take another swing

-mashume

@mashume Appreciate your effort to make it work. The code you posted doesn't seem to plot and I get this in the upper left corner of the chart: "Trying to self-assign a non-initialized rec: swing," but here are the requirements again. https://easyupload.io/y9cd7q
 
@mashume Appreciate your effort to make it work. The code you posted doesn't seem to plot and I get this in the upper left corner of the chart: "Trying to self-assign a non-initialized rec: swing," but here are the requirements again. https://easyupload.io/y9cd7q

I should have warned with this code that it is INCOMPLETE BETA (ALPHA even) code and is guaranteed not to work. It may break things, cause the sky to fall, produce pots of gold at the end of rainbows, or simply make you scratch your head and wonder what the hello I was thinking.

;-)

mashume
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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