NexusFi: Find Your Edge


Home Menu

 





Timed breakout box


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one TwoHands with 9 posts (0 thanks)
    2. looks_two program with 3 posts (3 thanks)
    3. looks_3 cory with 2 posts (2 thanks)
    4. looks_4 Fat Tails with 1 posts (1 thanks)
    1. trending_up 10,777 views
    2. thumb_up 6 thanks given
    3. group 4 followers
    1. forum 17 posts
    2. attach_file 3 attachments




 
Search this Thread

Timed breakout box

(login for full post details)
  #1 (permalink)
 TwoHands 
Fort Lauderdale, Florida
 
Experience: Beginner
Platform: TradeStation
Trading: ES
Posts: 115 since Apr 2011
Thanks Given: 97
Thanks Received: 150

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.


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Futures Close-Out Policy
Commodities
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Request for MACD with option to use different MAs for fa …
NinjaTrader
Looking for an MQL4 MetaTrader programmer/coder
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
33 thanks
Daytrading ES & NQ
32 thanks
Battlestations: Show us your trading desks!
30 thanks
Spoo-nalysis ES e-mini futures S&P 500
28 thanks
Retail Trading As An Industry
25 thanks

(login for full post details)
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,099


Have that available for NinjaTrader, but not for TradeStation.

Reply With Quote
The following user says Thank You to Fat Tails for this post:
(login for full post details)
  #4 (permalink)
 
program's Avatar
 program 
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

This might get you started in the right direction... it did for me.
should work for TS ORB

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.
Reply With Quote
The following user says Thank You to program for this post:
(login for full post details)
  #5 (permalink)
 TwoHands 
Fort Lauderdale, Florida
 
Experience: Beginner
Platform: TradeStation
Trading: ES
Posts: 115 since Apr 2011
Thanks Given: 97
Thanks Received: 150


program View Post
This might get you started in the right direction... it did for me.
should work for TS ORB

Thanks Program, but I don't think I can use a .pla file in Tradestation.

Started this thread Reply With Quote
(login for full post details)
  #6 (permalink)
 
cory's Avatar
 cory 
virginia
the coin hunter
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,096 since Jun 2009
Thanks Given: 877
Thanks Received: 8,086

in ninja we call it open range indicator maybe you can search for the same thing in TS.

Reply With Quote
The following user says Thank You to cory for this post:
(login for full post details)
  #7 (permalink)
 TwoHands 
Fort Lauderdale, Florida
 
Experience: Beginner
Platform: TradeStation
Trading: ES
Posts: 115 since Apr 2011
Thanks Given: 97
Thanks Received: 150


cory View Post
in ninja we call it open range indicator maybe you can search for the same thing in TS.

Thanks Cory. Found one but not for Tradestation. The hunt continues

Started this thread Reply With Quote
(login for full post details)
  #8 (permalink)
 
cory's Avatar
 cory 
virginia
the coin hunter
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,096 since Jun 2009
Thanks Given: 877
Thanks Received: 8,086

maybe this

Reply With Quote
The following user says Thank You to cory for this post:
(login for full post details)
  #9 (permalink)
 TwoHands 
Fort Lauderdale, Florida
 
Experience: Beginner
Platform: TradeStation
Trading: ES
Posts: 115 since Apr 2011
Thanks Given: 97
Thanks Received: 150


cory View Post
maybe this

Alas doesn't compile in TS 9.0. I was also looking more for an indicator than an automated strategy, which this seems to be.

Lines 12 & 45 Position information function not allowed in a study

 
Code
Input:
   orb(0.3);
Variables:
   MP(0),
   TodaysOpen(0),
   MyTrueRange(0), 
   PreTrueRange(0),
   tempOpen(0), 
   answer(0), 
   answerSell(0);

MP = MarketPosition;

// New Day

If date <> date[1] then begin
   TodaysOpen = Open;
   PreTrueRange = TrueHigh[1] of data2 - TrueLow[1] of data2;
   answer = TodaysOpen + (PreTrueRange * orb);
   answerSell = TodaysOpen - (PreTrueRange * orb);
end;

// Enter trade on breakout

If ( Time >= 900 ) And ( Time <= 1430 ) And ( MP = 0 ) And ( EntriesToday(Date) = 0 )  Then
Begin
   Buy ("LE") next bar at answer stop;
   Sellshort("SE") next bar at answerSell stop;
End;

// Stop Loss

If ( MP = 1 ) Then Sell next bar at answerSell stop;
If ( MP = -1 ) Then Buy to cover next bar at answer stop;
   
// Exit at end-of-day

If ( Time = 1500 ) And ( MP <> 0 ) Then
Begin
   Sell this bar at close;
   Buy to cover this bar at close;
End;

{************************************************* *********}
IF MarketPosition = 1 THEN BEGIN
Alert("Still Long");
END;

Started this thread Reply With Quote
(login for full post details)
  #10 (permalink)
 
program's Avatar
 program 
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


Here is the code, copy and paste... maybe with a little tweaking it will compile in TS.

 
Code
Inputs:
	StartTime(800),						// Start time of session
	EndTime(900),							// End time of openingsrange
	ExtendOpeningsRange(False),		// Extending the openings range
	TextOffSet(1),							// The distance between the text and the lines, in points of the pricescale
	TextAlignment(2),						// Alignment of the text object: 0: to right of bar, 1: to left of bar, 2: centered on bar
	FontSize(9),							// Font size of the text objects
	FontName("Verdana"),					// Font type of the text objects
	High_Color(RGB(0, 255, 0)),		// Color for the high line and text
	Mid_Color(RGB(255, 128, 0)),		// Color for the mid line and text
	Low_Color(RGB(255, 0, 0)),			// Color for the low line and text
	High_Line_Tickness(2),				// Tickness of the high line
	Mid_Line_Tickness(1),				// Tickness of the middle line
	Low_Line_Tickness(2),				// Tickness of the low line
	High_Line_Style(2),					// Style of the high line
	Mid_Line_Style(3),					// Style of the mid line
	Low_Line_Style(2)						// Style of the low line
	;

Variables:
	sessionStart(SessionStartTime(0, 1)), opRangeHigh(0), opRangeLow(999999), barsSinceStart(0), alreadyPlotted(False),
	numOfDecimals(Round(Log(PriceScale) / Log(10), 0)), offset(TextOffSet * (MinMove / PriceScale)), lineOffset(0), 
	tlHigh(0), tlLow(0), tlMid(0), opRangeActive(False),
	sessionEnd(SessionEndTime(0, SessionCount(0)) * 100), beginTime(StartTime * 100), endingTime(EndTime * 100);

// Reset previous values
if (Date <> Date[1]) then begin
	opRangeHigh		= 0;
	opRangeLow		= 999999;
	barsSinceStart = 0;
	alreadyPlotted	= False;
	opRangeActive	= True;
end;	
	
// Collect openingsbar range
if (Time_s >= beginTime) and (Time_s <= endingTime) then begin
	opRangeHigh 	= MaxList(High, opRangeHigh);
	opRangeLow		= MinList(Low, opRangeLow);
	barsSinceStart	= barsSinceStart + 1;
end;

// Start plotting
if (Time_s >= endingTime) and (alreadyPlotted = False) then begin

	// Save values for the trendlines (needed for extending later on)
	tlHigh 		= opRangeHigh;
	tlMid			= (opRangeHigh + opRangeLow) * 0.50;
	tlLow 		= opRangeLow;
		
	// Plot the text
	value20 = IFF(barsSinceStart > 1, barsSinceStart - 1, barsSinceStart);
	value1 = Text_New_s(Date, Time_s[value20 * 0.50], tlHigh + offset, 			Text("High = ", NumToStr(tlHigh, numOfDecimals)));
	value2 = Text_New_s(Date, Time_s[value20 * 0.50], tlLow - (offset * 2), 	Text("Midpoint = ", NumToStr(tlMid, numOfDecimals)));
	value3 = Text_New_s(Date, Time_s[value20 * 0.50], tlLow - offset, 			Text("Low = ", NumToStr(tlLow, numOfDecimals)));
	
	// Change colour of text instrument
	Text_SetColor(value1, High_Color);
	Text_SetColor(value2, Mid_Color);
	Text_SetColor(value3, Low_Color);
	
	// Change the alignment of the text object
	Text_SetStyle(value1, TextAlignment, 2);
	Text_SetStyle(value2, TextAlignment, 2);
	Text_SetStyle(value3, TextAlignment, 2);
	
	// Change the font size
	Text_SetSize(value1, FontSize);
	Text_SetSize(value2, FontSize);
	Text_SetSize(value3, FontSize);
	
	// Change the font type
	Text_SetFontName(value1, FontName);
	Text_SetFontName(value2, FontName);
	Text_SetFontName(value3, FontName);
	
	// Draw the trendlines
	value10 = TL_New_s(Date, Time_s[value20], tlHigh, Date, Time_s, tlHigh);
	value11 = TL_New_s(Date, Time_s[value20], tlMid, Date, Time_s, tlMid);
	value12 = TL_New_s(Date, Time_s[value20], tlLow, Date, Time_s, tlLow);
	
	// Change colour of the lines
	TL_SetColor(value10, High_Color);
	Tl_SetColor(value11, Mid_Color);
	TL_SetColor(value12, Low_Color);
	
	// Change the style of the lines
	TL_SetStyle(value10, High_Line_Style);
	TL_SetStyle(value11, Mid_Line_Style);
	TL_SetStyle(value12, Low_Line_Style);
	
	// Change the width of the lines
	TL_SetSize(value10, High_Line_Tickness);
	TL_SetSize(value11, Mid_Line_Tickness);
	TL_SetSize(value12, Low_Line_Tickness);

	alreadyPlotted = True;
end;

if (ExtendOpeningsRange = True) and (opRangeActive = True) and (Time_s < sessionEnd) and (Time_s > endingTime) then begin

	// Check if the openings range is still valid
	if (Close > tlHigh) or (Close < tlLow) then 
		opRangeActive = False;
		
	// Only extend lines as long as the openings range isn't violated
	if (opRangeActive = True) then begin
		value20 = TL_SetEnd_s(value10, Date, Time_s, tlHigh);
	   value21 = TL_SetEnd_s(value11, Date, Time_s, (tlHigh + tlLow) * 0.50);
		value22 = TL_SetEnd_s(value12, Date, Time_s, tlLow);
	end;

end; //: ExtendOpeningsRange

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.
Reply With Quote
The following user says Thank You to program for this post:





Last Updated on July 20, 2012


© 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