Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Timed breakout box
Updated July 20, 2012
Top Posters
looks_one
TwoHands
with 9 posts (0 thanks)
looks_two
program
with 3 posts (3 thanks)
looks_3
cory
with 2 posts (2 thanks)
looks_4
Big Mike
with 1 posts (0 thanks)
trending_up
11,112 views
thumb_up
6 thanks given
group
4 followers
forum
17 posts
attach_file
3 attachments
Timed breakout box
July 15th, 2012, 07:44 AM
Fort Lauderdale, Florida
Experience: Beginner
Platform: TradeStation
Trading: ES
Posts: 115 since Apr 2011
Thanks Given: 97
Thanks Received: 150
Thanks Program but this one didn't compile either: it calls Time_s an unknown identifier.
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
July 15th, 2012, 08:00 AM
CA USA
Experience: Intermediate
Platform: MultiCharts
Broker: DDT+land/Rithmic/IQ
Trading: S&P500,6E,YM
Posts: 99 since Nov 2010
Thanks Given: 127
Thanks Received: 64
TwoHands
Thanks Program but this one didn't compile either: it calls Time_s an unknown identifier.
I've never used TS, so i probably won't be able help much more... that being said, try changing Time_s to Time easylanguage and powerlanguage "should" be very close.
I have approximate answers, possible beliefs and different degrees of certainty of different things. But I'm not absolutely sure of anything and there are many things i don't know anything about.
July 15th, 2012, 11:54 AM
Fort Lauderdale, Florida
Experience: Beginner
Platform: TradeStation
Trading: ES
Posts: 115 since Apr 2011
Thanks Given: 97
Thanks Received: 150
As it turns out, TS has a built in indicator called Subsession Hi Lo lines that, except for some minor display tweaks I'd prefer, does almost exactly what I want. Thanks much for your effort.
July 15th, 2012, 08:17 PM
London
Posts: 118 since Mar 2010
Thanks Given: 42
Thanks Received: 58
TwoHands
Has anyone written or know where I can find a
breakout box? I'd like it to allow me to input start and end times and show the high and low of that period. Also need it to automatically change for each day based on the chart's session hours.
The image is using manually entered horizontal and vertical lines to give an idea what I'm looking for.
do you need it for backtest ? or to run it real time?
July 16th, 2012, 08:26 AM
Fort Lauderdale, Florida
Experience: Beginner
Platform: TradeStation
Trading: ES
Posts: 115 since Apr 2011
Thanks Given: 97
Thanks Received: 150
Bimi
do you need it for
backtest ? or to run it real time?
Preferably both but since I have no coding skills I'm having to do my testing real time, viewing daily charts that go back a year or so. I know it's Jesse Livermore -ish but until I learn to program {something I haven't done in 30 years} it's what I've got to work with.
July 19th, 2012, 05:31 PM
Fort Lauderdale, Florida
Experience: Beginner
Platform: TradeStation
Trading: ES
Posts: 115 since Apr 2011
Thanks Given: 97
Thanks Received: 150
Big Mike has given me permission to post the source of the original Tradestation indicator called Subsession Hi Lo Lines hoping that someone can help me get this working the way I want. I'm also posting code from one of the TS employees who made some ineffective changes and then lost interest.
This is a screenshot of several days on a 15 minute chart using TS's original indicator. It allows me to input start and end times and plots the lines for the hi & lo of that period.
Code
{
This indicator is designed to plot the period high and low for a time period set by
the "StartTime" and "EndTime" inputs. The OHLCV calculations are reset when the new
time period starts as evaluated by the "ResetCalcs" calculations.
This indicator is intended for application only to intraday bars (tick or time-
based).
Commentary on the use of vectors for OHLCV, along with calculation explanations,
can be found in the "OHLCVCollection" function.
}
{ code will use classes from these namespaces }
using elsystem ;
using elsystem.collections ;
inputs:
int NumSubSessionsAgo( 1 ), { number of sub-sessions ago; use zero to refer to
the current sub-session }
int StartTime( 0930 ), { start time for OHLCV calculations }
int EndTime( 1600 ) ; { end time for OHLCV calculations }
variables:
Vector OHLCV_Vector( NULL ), { this is the vector that will be passed by
reference to the function OHLCVCollection; it will hold all the OHLCV values }
Vector HighVector( NULL ), { High Prices }
Vector LowVector( NULL ), { Low Prices }
bool ResetCalcs( false ),
bool IncludeThisBar( false ),
int RtnValOrErrorCode( 0 ), { variable to hold the value returned by call to
OHLCVCollection function }
intrabarpersist bool ValuesAvailable( false ), { used to ensure that there is
enough data in the vector before requesting a value }
double SubSessionHigh( -1 ), { holds High of NumSessionsAgo }
double SubSessionLow( -1 ) ; { holds Low of NumSubSessionAgo }
{ check bar type; instantiate the vectors }
method void Init( Object InitSender, InitializedEventArgs InitArgs )
begin
if BarType >= 2 then
RaiseRuntimeError( "Price Channel (Time-based) can be applied to " +
"intraday bars only." ) ;
OHLCV_Vector = new Vector ;
HighVector = new Vector ;
LowVector = new Vector ;
end ;
{ condition upon which OHLCV values will be reset for next period }
ResetCalcs = ( Time > StartTime and Time[1] <= StartTime )
or ( Time > StartTime and Time[1] > Time )
or ( Time[1] > Time and StartTime > Time[1] ) ;
{
IncludeThisBar is passed in to OHLCVCollection to designate whether this bar is to
be used in the OHLCV calcultions. This variable is true if the bar falls within the
time frame established by the StartTime and EndTime inputs and false if the bar is
outside the time frame.
}
IncludeThisBar = IFFLogic( StartTime > EndTime, Time > StartTime or Time <= EndTime,
Time > StartTime and Time <= EndTime ) ;
RtnValOrErrorCode = OHLCVCollection( ResetCalcs, IncludeThisBar, OHLCV_Vector ) ;
{ set-up HighVector and LowVector }
once
begin
HighVector = OHLCV_Vector[1] astype Vector ; { [1] = High Price }
LowVector = OHLCV_Vector[2] astype Vector ; { [2] = Low Price }
end ;
{ only allow retrieval of data once there is enough data loaded into the vector }
once ( RtnValOrErrorCode > NumSubSessionsAgo )
ValuesAvailable = true ;
if ValuesAvailable then
begin
SubSessionHigh = HighVector.At( NumSubSessionsAgo ) astype double ;
SubSessionLow = LowVector.At( NumSubSessionsAgo ) astype double ;
Plot1( SubSessionHigh, "SubSessHigh" ) ;
Plot2( SubSessionLow, "SubSessLow" ) ;
end
else if LastBarOnChart then
RaiseRuntimeError( "High and low not available for requested session. " +
"Try loading more historical data or increasing 'load additional bars'" +
" setting." ) ;
{ ** Copyright (c) 2001 - 2010 TradeStation Technologies, Inc. All rights reserved. **
** TradeStation reserves the right to modify or overwrite this analysis technique
with each release. ** }
I made some requests in the TS forum and one of the TS coders came back with another version of it. I asked for
1. No need for the indi to plot beyond session hours
2. No need to show variations in the hi/lo for the input period
3. Text labels showing the value of the lines.
He came back with code that displays strangely…
His code plots correctly if I use the previous day's data on todays chart, which I don't want -- it's a breakout strategy so it needs todays data. When I use todays data, this is what I get. I have no idea how he calculated the ending point so I don't know why the lines are angled.
His code:
Code
{
This indicator is designed to plot the period high and low for a time period set by
the "StartTime" and "EndTime" inputs. The OHLCV calculations are reset when the new
time period starts as evaluated by the "ResetCalcs" calculations.
This indicator is intended for application only to intraday bars (tick or time-
based).
Commentary on the use of vectors for OHLCV, along with calculation explanations,
can be found in the "OHLCVCollection" function.
*** This indicator was customized to allow the start and ending times of when
the trend lines are draw can be controlled with inputs and the trend line
values are labeled.
}
{ code will use classes from these namespaces }
using elsystem ;
using elsystem.collections ;
inputs:
int NumSubSessionsAgo( 0 ), { number of sub-sessions ago; use zero to refer to
the current sub-session }
int StartTime( 1200 ), { start time for OHLCV calculations }
int EndTime( 1300 ), { end time for OHLCV calculations }
int DrawStartTime( 1200 ), // *** user input to control when trend lines start
int DrawEndTime( 1600 ) ; // *** user input to control when trend lines end
variables:
Vector OHLCV_Vector( NULL ), { this is the vector that will be passed by
reference to the function OHLCVCollection; it will hold all the OHLCV values }
Vector HighVector( NULL ), { High Prices }
Vector LowVector( NULL ), { Low Prices }
bool ResetCalcs( false ),
bool IncludeThisBar( false ),
int RtnValOrErrorCode( 0 ), { variable to hold the value returned by call to
OHLCVCollection function }
intrabarpersist bool ValuesAvailable( false ), { used to ensure that there is
enough data in the vector before requesting a value }
double SubSessionHigh( -1 ), { holds High of NumSessionsAgo }
double SubSessionLow( -1 ), { holds Low of NumSubSessionAgo }
Int HighTLID( 0 ), // *** add these variables
Int LowTLID( 0 ), // *** add these variables
Int TextID( 0 ) ; // *** add these variables
// *** Change from Init to InitializeComponent so this code runs
// first thing before the OHLCVCollections function does, else we
// we will get an object not found error
method override void InitializeComponent() begin
if BarType >= 2 then
RaiseRuntimeError( "Price Channel (Time-based) can be applied to " +
"intraday bars only." ) ;
OHLCV_Vector = new Vector ;
HighVector = new Vector ;
LowVector = new Vector ;
end ;
{ condition upon which OHLCV values will be reset for next period }
ResetCalcs = ( Time > StartTime and Time[1] <= StartTime )
or ( Time > StartTime and Time[1] > Time )
or ( Time[1] > Time and StartTime > Time[1] ) ;
{
IncludeThisBar is passed in to OHLCVCollection to designate whether this bar is to
be used in the OHLCV calcultions. This variable is true if the bar falls within the
time frame established by the StartTime and EndTime inputs and false if the bar is
outside the time frame.
}
IncludeThisBar = IFFLogic( StartTime > EndTime, Time > StartTime or Time <= EndTime,
Time > StartTime and Time <= EndTime ) ;
RtnValOrErrorCode = OHLCVCollection( ResetCalcs, IncludeThisBar, OHLCV_Vector ) ;
{ set-up HighVector and LowVector }
once
begin
HighVector = OHLCV_Vector[1] astype Vector ; { [1] = High Price }
LowVector = OHLCV_Vector[2] astype Vector ; { [2] = Low Price }
end ;
{ only allow retrieval of data once there is enough data loaded into the vector }
once ( RtnValOrErrorCode > NumSubSessionsAgo )
ValuesAvailable = true ;
if ValuesAvailable then begin
SubSessionHigh = HighVector.At( NumSubSessionsAgo ) astype double ;
SubSessionLow = LowVector.At( NumSubSessionsAgo ) astype double ;
// *** If the prior bar time is less than the draw start time but the
// current bar time is greater than the draw start time then we are on the
// first bar of the draw time window, so create the high and low trend lines
// as initial points with the start and end values
if Time[1] < DrawStartTime and Time >= DrawStartTime then begin
HighTLID = TL_New( Date, Time, SubSessionHigh, Date, Time, SubSessionHigh ) ;
LowTLID = TL_New( Date, Time, SubSessionLow, Date, Time, SubSessionLow ) ;
// Set the high trend line to light blue and the low trend line to purple
Value1 = TL_SetColor( HighTLID, Cyan ) ;
Value1 = TL_SetColor( LowTLID, Magenta ) ;
// Create a text label of the subsession high value above the subsession high trend line
TextID = Text_New( Date, Time, SubSessionHigh, NumToStr( SubSessionHigh, 2 ) ) ;
Value1 = Text_SetStyle( TextID, 0, 1 ) ; // Place label to the right and above trend line
// Create a text label of the subsession low value below the subsession low trend line
TextID = Text_New( Date, Time, SubSessionLow, NumToStr( SubSessionLow, 2 ) ) ;
Value1 = Text_SetStyle( TextID, 0, 0 ) ; // Place label to the right and below trend line
end
// *** Else if we have a high trend line ID defined and the time is between
// the draw start and end times, stretch out the end of the high and low
// trend lines to the current date/time
else if HighTLID > 0 and Time >= DrawStartTime and Time <= DrawEndTime then begin
Value1 = TL_SetEnd( HighTLID, Date, Time, SubSessionHigh ) ;
Value1 = TL_SetEnd( LowTLID, Date, Time, SubSessionLow ) ;
end ;
end
else if LastBarOnChart then
RaiseRuntimeError( "High and low not available for requested session. " +
"Try loading more historical data or increasing 'load additional bars'" +
" setting." ) ;
I'm grateful to anyone that can tweak this for me.
July 19th, 2012, 05:41 PM
Manta, Ecuador
Site Administrator Developer Swing Trader
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,499 since Jun 2009
Thanks Given: 33,264
Thanks Received: 101,715
@TwoHands , is this a "timed breakout box"?
If not, you might also post here:
Mike
July 20th, 2012, 08:55 AM
Fort Lauderdale, Florida
Experience: Beginner
Platform: TradeStation
Trading: ES
Posts: 115 since Apr 2011
Thanks Given: 97
Thanks Received: 150
Big Mike
@
TwoHands , is this a "timed
breakout box"?
If not, you might also post here:
Mike
Thanks Mike. Moved it here , retitled it Open Range indicator.
Last Updated on July 20, 2012