+1 888 340 6572

1st Hour Breakout

From MultiCharts

Article/Author: Omega research Inc., 1997


Description:
This is example of a simple trading system. Entries are based on breakouts, and exits are based on average day range.


Inputs: RanLn - length of period used for average day range calculation.


EasyLanguage Code:

 
VARS:  SESS1FIRSTBARDATE(0,DATA2), SESS1FIRSTBARHIGH(0,DATA2), SESS1FIRSTBARLOW(0,DATA2), AVEDAYRANGE(0,DATA3);



INPUT:  RANLN(10);



AVEDAYRANGE = AVERAGE((H[0] OF DATA3 - L[0] OF DATA3),RANLN) OF DATA3;



IF (TIME OF DATA2 = SESS1FIRSTBARTIME OF DATA2) OR (DATE[0] DATA2 > DATE[1] OF DATA2) THEN BEGIN

	SESS1FIRSTBARDATE = DATE[0] OF DATA2;

	SESS1FIRSTBARHIGH = HIGH[0] OF DATA2;

	SESS1FIRSTBARLOW = LOW[0] OF DATA2;

END;



IF (SESS1FIRSTBARDATE = DATE OF DATA2) AND (TIME OF DATA2 < SESS1ENDTIME OF DATA2) THEN BEGIN

	CONDITION1 = C[1] < SESS1FIRSTBARHIGH[0];

	IF CONDITION1 THEN BUY NEXT BAR AT SESS1FIRSTBARHIGH[0] + 20 POINTS STOP;

	CONDITION2 = CLOSE[1] > SESS1FIRSTBARLOW[0];

	IF CONDITION2 THEN SELL NEXT BAR AT SESS1FIRSTBARLOW - 20 POINTS STOP;

END;



VALUE1 = SESS1FIRSTBARHIGH[0] - AVEDAYRANGE;

VALUE2 = SESS1FIRSTBARLOW[0] + AVEDAYRANGE;



IF LOW[0] <= VALUE1 THEN BUYTOCOVER NEXT BAR AT MARKET;



IF HIGH[0] >= VALUE2 THEN SELL NEXT BAR AT MARKET;