NexusFi: Find Your Edge


Home Menu

 





Scanning for inside bar during market hours only.


Discussion in ThinkOrSwim

Updated
    1. trending_up 2,388 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 4 posts
    2. attach_file 1 attachments




 
Search this Thread

Scanning for inside bar during market hours only.

  #1 (permalink)
phyregold
Dover Delaware
 
Posts: 3 since Aug 2020
Thanks Given: 0
Thanks Received: 0

I have a strategy I used all the time (below). What I want to do is scan for two inside bars within the last 16 hours. THe problem is I don't know how to exclude premarket and after market, I also don't know how to exclude 3:30 - 4:00. If someone could help that would be fantastic.

 
Code
#hint: double inside day - next day look for the price to move big one way or another...
def lo = low;
def hi = high;
def vo = volume;

def s = if hi[1] >= hi and lo[1] <= low then 1 else 0;
plot did = s;
did.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
did.SetLineWeight(3);
did.AssignValueColor(Color.WHITE);

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
Better Renko Gaps
The Elite Circle
How to apply profiles
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
MC PL editor upgrade
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
33 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
  #2 (permalink)
 
wldman's Avatar
 wldman 
Chicago Illinois USA
Legendary Market Wizard
 
Experience: Advanced
Broker: IB, ToS
Trading: /ES, US Equities/Options
Frequency: Several times daily
Duration: Hours
Posts: 3,512 since Aug 2011
Thanks Given: 2,047
Thanks Received: 9,513

I'm not a code guy, but there are many here that can help you. Individual threads are set up segregated by platform. These exceptions are a snap, someone will help, I'm sure. I color inside bars and make the scan using ToS scan feature...or I do it visually. Granted that will not help if you are trying to automate. Find the platform thread, someone will help. Search, Want your "platform name" indicator created...

-Dan

Visit my NexusFi Trade Journal Reply With Quote
  #3 (permalink)
 
lukeskywalker1's Avatar
 lukeskywalker1 
Los Angeles (CA)
 
Experience: Master
Platform: ThinkOrSwim
Trading: Currency Future, Stocks
Posts: 34 since Apr 2019
Thanks Given: 1
Thanks Received: 40



phyregold View Post
I have a strategy I used all the time (below). What I want to do is scan for two inside bars within the last 16 hours. THe problem is I don't know how to exclude premarket and after market, I also don't know how to exclude 3:30 - 4:00. If someone could help that would be fantastic.

 
Code
#hint: double inside day - next day look for the price to move big one way or another...
def lo = low;
def hi = high;
def vo = volume;

def s = if hi[1] >= hi and lo[1] <= low then 1 else 0;
plot did = s;
did.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
did.SetLineWeight(3);
did.AssignValueColor(Color.WHITE);

I didn't quite understand your task, but here is a good example of how to work with time in TOS.
This is an indicator that draws the High and Low of the first hour of trading.

This is a good example of how you can filter out a specific time period.

 
Code
#First hour high and low
#by thetrader.top

declare hide_on_daily;
declare once_per_bar;

input EndCandle = 1030;
input marketOpen = 930;
input marketClose = 1600;

def OpenCounter = SecondsFromTime(marketOpen);
def CloseCounter = SecondsTillTime(marketClose);
def MarketHours = if OpenCounter >= 0 and CloseCounter >= 0 then 1 else 0;
def Today ;
rec DailyHigh ;
rec DailyLow ;

Today = if GetDay() != GetDay()[1] then 1 else 0;
DailyHigh = if Today then high else if MarketHours then if high > DailyHigh[1] AND SecondsFromTime(EndCandle) < 0 then high else DailyHigh[1] else high;
DailyLow = if Today then low else if MarketHours   then if low < DailyLow[1] AND SecondsFromTime(EndCandle) < 0 then low else DailyLow[1] else low;

plot TodaysHigh = if(MarketHours,DailyHigh, Double.NaN) ;
plot TodaysLow = if(MarketHours,DailyLow, Double.NaN) ;

Attached Thumbnails
Click image for larger version

Name:	image_106.png
Views:	196
Size:	220.1 KB
ID:	304048  
Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
phyregold
Dover Delaware
 
Posts: 3 since Aug 2020
Thanks Given: 0
Thanks Received: 0


lukeskywalker1 View Post
I didn't quite understand your task, but here is a good example of how to work with time in TOS.
This is an indicator that draws the High and Low of the first hour of trading.

This is a good example of how you can filter out a specific time period.

 
Code
#First hour high and low
#by thetrader.top

declare hide_on_daily;
declare once_per_bar;

input EndCandle = 1030;
input marketOpen = 930;
input marketClose = 1600;

def OpenCounter = SecondsFromTime(marketOpen);
def CloseCounter = SecondsTillTime(marketClose);
def MarketHours = if OpenCounter >= 0 and CloseCounter >= 0 then 1 else 0;
def Today ;
rec DailyHigh ;
rec DailyLow ;

Today = if GetDay() != GetDay()[1] then 1 else 0;
DailyHigh = if Today then high else if MarketHours then if high > DailyHigh[1] AND SecondsFromTime(EndCandle) < 0 then high else DailyHigh[1] else high;
DailyLow = if Today then low else if MarketHours   then if low < DailyLow[1] AND SecondsFromTime(EndCandle) < 0 then low else DailyLow[1] else low;

plot TodaysHigh = if(MarketHours,DailyHigh, Double.NaN) ;
plot TodaysLow = if(MarketHours,DailyLow, Double.NaN) ;



How do I get the scan to work for the following hourly time ranges, 9:30 - 10:30
10:30 - 11:30
11:30 - 12:30
12:30 - 1:30
1:30 - 2:30
2:30 - 3:30

Reply With Quote
  #5 (permalink)
phyregold
Dover Delaware
 
Posts: 3 since Aug 2020
Thanks Given: 0
Thanks Received: 0


phyregold View Post
How do I get the scan to work for the following hourly time ranges, 9:30 - 10:30
10:30 - 11:30
11:30 - 12:30
12:30 - 1:30
1:30 - 2:30
2:30 - 3:30

anybody?

Reply With Quote




Last Updated on August 31, 2020


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts