Is there a way to have intraday indicators only use a certain times within a day?

YungTraderFromMontana

Well-known member
I'm trying to use fractal energy in an intraday indicator but gaps separating the previous close and current open mess with the data. Is their a way to exclude this? Right now if the stock gaps overnight the data is messed up for around 90 bars.
 
@YungTraderFromMontana Is this similar to what you're thinking about? I just took a FE study I had by Mobius and changed some things. Its a bit of an experiment, let me know what you think of it.

Code:
#Experimental Time-Limited Fractal Energy
#plots only during set times

input begin_time = 0930;
input end_time = 1600;
def start = if SecondsFromTime(begin_time) >= 0 then 1 else 0;
def end = if SecondsTillTime(end_time) >= 0 then 1 else 0;
def nan = double.nan;

#Fractal Energy by Mobius
#hacked to only show during certain times and changed o/h/l/c values

input nFE = 8;
input AlertOn = no;
input Glength  = 13;
input betaDev =  8;

def data1 = if start and end then open else 0;
def data2 = if start and end then high else 0;
def data3 = if start and end then low else 0;
def data4 = if start and end then close else 0;

def w = (2 * Double.Pi / Glength);
def beta = (1 - Cos(w)) / (Power(1.414, 2.0 / betaDev) - 1 );
def alpha = (-beta + Sqrt(beta * beta + 2 * beta));
def Go = Power(alpha, 4) * data1 +
             4 * (1 – alpha) * Go[1] – 6 * Power( 1 - alpha, 2 ) * Go[2] +
             4 * Power( 1 - alpha, 3 ) * Go[3] - Power( 1 - alpha, 4 ) * Go[4];
def Gh = Power(alpha, 4) * data2 +
             4 * (1 – alpha) * Gh[1] – 6 * Power( 1 - alpha, 2 ) * Gh[2] +
             4 * Power( 1 - alpha, 3 ) * Gh[3] - Power( 1 - alpha, 4 ) * Gh[4];
def Gl = Power(alpha, 4) * data3 +
             4 * (1 – alpha) * Gl[1] – 6 * Power( 1 - alpha, 2 ) * Gl[2] +
             4 * Power( 1 - alpha, 3 ) * Gl[3] - Power( 1 - alpha, 4 ) * Gl[4];
def Gc = Power(alpha, 4) * data4 +
             4 * (1 – alpha) * Gc[1] – 6 * Power( 1 - alpha, 2 ) * Gc[2] +
             4 * Power( 1 - alpha, 3 ) * Gc[3] - Power( 1 - alpha, 4 ) * Gc[4];
def o = (Go + Gc[1]) / 2;
def h = Max(Gh, Gc[1]);
def l = Min(Gl, Gc[1]);
def c = (o + h + l + Gc) / 4;

plot gamma = if start and end then Log(Sum((Max(Gh, Gc[1]) - Min(Gl, Gc[1])), nFE) /
        (Highest(Gh, nFE) - Lowest(Gl, nFE)))
            / Log(nFE) else Double.NaN;
     gamma.SetPaintingStrategy(PaintingStrategy.LINE);
     gamma.SetLineWeight(2);
     gamma.SetDefaultColor(Color.YELLOW);

plot M = if IsNaN(c) then Double.NaN else if start and end then 0.5 else nan;
     M.SetPaintingStrategy(PaintingStrategy.LINE);
     M.SetDefaultColor(Color.DARK_GRAY);
     M.HideBubble();
     M.HideTitle();
plot FEh = if IsNaN(c) then Double.NaN else if start and end then .618 else nan;
     FEh.SetStyle(Curve.SHORT_DASH);
     FEh.HideBubble();
     FEh.SetDefaultColor(Color.GREEN);
     FEh.HideTitle();
plot FEl = if IsNaN(c) then Double.NaN else if start and end then .382 else nan;
     FEl.SetStyle(Curve.SHORT_DASH);
     FEl.SetDefaultColor(Color.RED);
     FEl.HideBubble();
     FEl.HideTitle();

#end code
 
Last edited:

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