How to get access to first two 15 mins bar, once that time has passed in Thinksript

bigmit2011

New member
From what I understand something like the code below would only work
if we are still within 9:45 and 10:00 time frame,

but how would I still be able to find stocks that
have the below pattern (first bar is green bar, and the second bar is engulfing red)
for first two 15 mins bars, if I check midday or EOD.


Ruby:
input SecondBar = 0945;
input DurationMins = 15;

def durationSec = durationMins * 15;
def secondsPassed = SecondsFromTime(SecondBar);


# open[1] is first 15 mins while open is the second bar
def pattern = (open[1] < close[1]) and  (low < low[1]) and (high > high[1]) and (open < close)

def timeCondition = if secondsPassed > 0 and secondsPassed <=durationSec then 1 else 0

plot scan = pattern and timeCondition
 
Solution
@bigmit2011 scan for 'signal' being true. Make sure to set Aggregation to 15 min on the filter
Ruby:
input time = 0945;
input reset = 0930;
def engulfing = if secondstilltime(reset) == 0 then 0 else if secondsfromtime(time) == 0 and
close[1] > open[1] and high > high[1] and low < low[1] and close < open then 1 else engulfing[1];
plot signal = engulfing;
signal.hide();
@bigmit2011 scan for 'signal' being true. Make sure to set Aggregation to 15 min on the filter
Ruby:
input time = 0945;
input reset = 0930;
def engulfing = if secondstilltime(reset) == 0 then 0 else if secondsfromtime(time) == 0 and
close[1] > open[1] and high > high[1] and low < low[1] and close < open then 1 else engulfing[1];
plot signal = engulfing;
signal.hide();
 
Last edited:
Solution

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