#twitter-follow { border: 0;position: fixed; top: 240px; left:0;} #live-support { border: 0;position: fixed; top: 370px; left:0;} #knowledge-base { border: 0;position: fixed; top: 170px; left:0;}

## Number of Times an Event Occurred in the First N-Minutes of a Trading Session

by Caleb, 4358 days ago

This function analyzes the first N-minutes of a trading session then counts the number of times a specific event occurred. As an example, you can use it to measure the number of times the price crossed above its short-term moving average during the first trading hour.

You can implement this example by typing:
a = cross(close, sma(10));
p = FirstMinutesCond(60, a);

The functions name is "FirstMinutesCond". As you can see, you must provide the number of minutes as the first argument and the condition rule as the second argument.

You can also calculate the number of times the crossover happened in the previous day then compare it with today's number. Here is how to implement this idea:
b = cross(close, sma(10));
p = FirstMinutesCond(60, b);
a = barssince(day() != ref(day(), 1)) + 1;
a = iff(p > 0, ref(p, a), 0);
rule1 = p > a;

You can plot this formula in a chart or add it as a rule in an intraday trading system.

Here is another example:
Calculate the number of occurrences of the following pattern (Close higher than open price) in the first trading hour.
p = FirstMinutesCond(60, close > open);

To calculate the support or resistance lines formed in the first N-minutes of a trading session, use the "FirstMinutesHL" function I have shared few months ago.
Support and resistance lines based on N-Minutes high/low of a trading session

What is this?

 Type: Trading Indicator Object ID: 1174 Country: All Market: All Style: Technical Analysis

 Related objects Empty
Number of reviews
Average rate
Click to rate this item
Number of rates the current object received
Report an object
if you can't run it for example or if it contains errors
Click to report this object

 Random Blog Posts Backtesting trading strategies using intraday data Fundamental Stock Analysis: Rank stocks based on a valuation ratio Different Types of Trading Indicators: Trend, Momentum, Volatility and Volume 6 ideas to implement in your portfolio to reduce your trading risk Introduction to sentiment analysis applied to the stock market Fundamental analysis: How to track economic indicators in the Forex market Forecast volatility using trading rules and neural networks Inverse Fisher Transform: Indicator, composite and trading system Show All

Number of reviews
Average rate
Click to rate this item
Number of rates the current object received
Report an object
if you can't run it for example or if it contains errors
Click to report this object