[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

DayTrade HL BO Channel NYSE


  • To: The Code <veeger2001@xxxxxxxxxxx>
  • Subject: DayTrade HL BO Channel NYSE
  • From: taracent <taracent@xxxxxxxxx>
  • Date: Wed, 18 Mar 1998 19:28:27 -0800
  • In-reply-to: <19980318185920.28846.qmail@xxxxxxxxxxx>

PureBytes Links

Trading Reference Links

Hi Code,

To show my interest and response to your posting various "codes" on the
list, let me share one with you and the Omega List.  Since I am kicking
it into the public domain, I hope those reading it will not "polish it",
put their name on it, and attempt to resell the same.  

Keep up the good work.

RT

PS:  The following system was built to only trade NYSE stocks, not
anything else.  As such, the code is very specially built for the NYSE
trader to buy/short the big board.  Enjoy

PSS:  I am disclosing the code to attempt to get others to express their
impressions / desires about daytrading stocks.  If I receive no
responses, I will be very dispointed.


{		High Low Channel Breakout #5 for NYSE stocks only
		Placed into public domain on the omega list 3/18/98 by 
			Randy Tareilo
			Tarac Enterprises
			contact at taracent@xxxxxxxxx
}

Inputs:	InitS(1), ExitS(1), MaxTrade(1), Plog(true), CPTime(1030),
LTTime(1500);

Vars:	Shar(1000), EP(0), TradeCnt(0), PosCnt(0), BuySell(0), pH(close),
pL(close), diff(0),
		CurLog(false), MidPoint(0), NoTime(1540), vLen(60), vCnt(0), vSCnt(0),
Spread(.125), Cnt(0), CntM1(0);

{		Resell is hereby denied without written approval, system is for
discussion purposes only.
		Any use of this system for trading or investment is only for review
and understanding how
		trade station systems work.  No assurances that this system will
provide profits or prevent losses is
		given.  NO guarantees or other representation as to the accuracy or
completeness
		of this system (or trading results) are provided.  The author assumes
no responsibility whatsoever 
		for errors or omissions.  Comments or materials within this system do
not necessarily
		reflect the opinion of the author, nor does it constitute an
endorsement of this 
		system.  While the author or other persons may trade systems similar
to this system,
		this does not imply that this system will work successfully in your
investment or 
		trading world.  If you have any questions concerning trading or
investment methods, you
		should seek out the advice of a trained professional technical
investment advisor.  
	
		Any use of this system is with the complete and full understanding of
the above 
		disclosure statement is with the full acceptance of the disclosure
statement.  

		The following is a NYSE stock day trading system only.  Used only for
finding stocks
		breaking out of a price spread channel and will go long / short the
stock.  System can use any time
		frame from one minute up to 60 minutes.  Based upon testing, any
larger time frame than sixteen minutes
		bars is generally unsuccessful for day trading.   Inputs are as
follows:

			InitS - initial size of the channel breakout that system must exceed
before entering a trade.
				Used to place a channel around price action, then the price must
break a
				InitS size price spread off of a variable moving average.

			ExitS - Initial size of trailing stop loss.  Once the price begins to
move into the 
			    direction of the price breakout, the the trailing stop loss
becomes one method to
				reduce exposure to losses and take profits.

			MaxTrades - Number of maximum positions that system can take in the
stock before
			   all trading for that day is halted. 		

			Plog - a switch to turn on / off trading commands in the log file. 
Use to fore warn the
			   trader to place a trade at a certain price.  Permits the
monitoring of 50 different stocks
			  from the log file without watching every single TS graph.

			CPtime - Time to begin to conserve profits and to begin to move the
exit routine closer
			   to the active price activity.  Generally, no new trades are placed
between the CPtime
			   and the LPtime because of "lunch" time within the marketplace. 
Used to cut losses by
			   not entering "inactive" trades.  Time is based upon NYSE EST
standard values.
			
			LPtime - Time for the last active trading period of the current
market day by which
			   limited trades are placed.  Trailing stop loss routine is pushed
to be closer than
			   normal morning trading hours.  Time is based upon NYSE EST
standard values.

		Default input values have no relationship to the real world, and any
use of this system must
		be based upon the trader selecting his/her own values.

		Rules:
		1.	No entry trades before 935 EDT.
		2.	No entry trades over Max trades for the day.    
		3.	Only one trade allowed per time - no multiple trades.
		4.	Initial entry trade of the day will be from a breakout of a new
High / New Low;
		5.	Additional entry trades will be made from a channel of RngVal width
and will occur after 
			HLtime and must have a channel length of BarLook (min).
		6.	Will exit the long position if stock price falls below the entry
price minus the initial stop loss
			value for each stock.  Same is true for short positions, the exit
will occur if stock price climbs
			above the entry price plus the initial stop loss value.
		7.	After the stock has cleared is initial stop loss value, the system
will exit the long position if
			the stock price falls below the high price minus the wiggle stop loss
value for each stock.
			Same is true for short positions, the exit will occur it the stock
price climbs above the low
			price plus wiggle stop loss value.
		8.   Ignore gaps, play them adjusted after the initial opening bars as
a normal day.
			
		No trades before 9:32 EDT or the first 4 bars, this provides for the
market to have some direction.
		System uses only exit routines as defined below, it does not use any
of the TS built in exit functions.
		Exits all positions by the end of the day, hence, the name of a day
trading system.
		Trades in 1000 shares lots for maximum performance / low commission /
slippage.
		Uses 50 dollars commission/slippage few for normal performance.
		In some rare cases, will hold positions overnight based upon stock
performance.  
		System will not work on daily data or on tick by tick data.  

}


if 	Date		>	Date[1] then begin					{test for new day}
	PosCnt		=	0;							{reset position counter to neutral}
	vLen		=	IntPortion(vCnt/ConstantHours) * 2;			{calculate vLen value}
	vCnt		=	1;
	TradeCnt	=	0;							{reset trade counter to zero}
	BuySell	=	0;								{reset buy sell indicator to zero}
	CurLog		=	false;							{reload log indicator to false}
	if	Plog							and		{check to see if log indicator is turned on}
		date	=	CurrentDate				then		{check for current day}
		CurLog	=	true;							{turn on logging for events}
	diff			=	close - close[1];				{calculate difference in close}
	if	diff		>	1				or		{test for outside of range}
		diff		<	-1				then		{test for outside of range}
		diff		=	diff[1];
	end   
else begin
	vCnt		=	vCnt + 1;
	diff			=	close - close[1];				{calculate difference in close}
	Cnt			=	Cnt + 1;					{increase spread divisor}
	CntM1		=	Cnt - 1;
	if	High 	>	Low					then
		Spread	=	((CntM1/Cnt) * Spread) + ((1/Cnt) * (High - Low))
	else
	if	Low	>	High[1]					and
		High[1]	>	0					then
		Spread	=	((CntM1/Cnt) * Spread) + ((1/Cnt) * (Low - High[1]))
	else
	if	Low[1]	>	High					and
		Low[1]	>	0					then
		Spread	=	((CntM1/Cnt) * Spread) + ((1/Cnt) * (Low[1] - High)); 
	end;

MidPoint		=	MedianPrice;						{create Midpoint Price}
pH			=	Highadj;						{calculate high entry point}
pL			=	Lowadj;							{calculate low entry point}
	
if	MarketPosition		>	 0			then begin		{test for long position}
	if	PosCnt		=	-1			then begin		{test for initial trade for entry price}
		EP		=	@EntryPrice(0) - (InitS * Spread); 		{setup Exit Price for this
position}
		PosCnt		=	0;						{reset position counter}
		if	CurLog			then begin
			Print(@EntryTime:4:0," ", @GetSymbolName, "  Entry Long Price of
",@EntryPrice:6:3);
		
fileappend("c:\livetrad.txt",@GetSymbolName+","+numtostr(date,0)+","+numtostr(@EntryTime,0)+
				", Entry Long Price at, "+numtostr(@EntryPrice,2)+","+newline);
		
fileappend("c:\livetrad.txt",@GetSymbolName+","+numtostr(date,0)+","+numtostr(time,0)
				+", Backup Exit Long at, "	+numtostr(EP,2)+","+newline);
			end;
		end;
	value99		=	EP;							{save previous EP price}
	EP		=	pH - (ExitS * Spread);					{calculate high exit point}
	if	EP	<	value99				then			{check EP for previous higher value}
		EP	=	value99;						{reset EP to higher value}
	if	time		>	1555			and			{check for at end of the day}
		MidPoint	<	@EntryPrice + 1		then			{check for profit in the stock}
		EP			=	MidPoint + .25;				{if not enough profit, exit & do not hold
overnight}
	if	MidPoint	<=	EP			then begin		{check for trailing exit}
		ExitLong;								{exit long NOW}
		PosCnt		=	1;						{turn on Position counter for time calculation}
		if	CurLog		then begin					{print log of trade}
			Print(time:4:0," ",@GetSymbolName, "                *** EXIT LONG
price ", EP:6:3, " ***"); 
		
fileappend("c:\livetrad.txt",@GetSymbolName+","+numtostr(date,0)+","+numtostr(time,0)+
				", EXIT Long NOW at," +numtostr(EP,2)+","+newline);
			end;
		end;
	end
else
if	MarketPosition 	<	0				then begin		{check for short position}
	if	PosCnt		=	-1			then begin		{check to see if new trade}
		EP		=	@EntryPrice(0) + (InitS * Spread);		{initial trade, set exit
point}
		PosCnt		=	0;						{reset Position Counter}
		if	CurLog					then begin
			Print(@EntryTime:4:0," ", @GetSymbolName, "  Entry Short Price of
",@EntryPrice:6:3);
		
fileappend("c:\livetrad.txt",@GetSymbolName+","+numtostr(date,0)+","+numtostr(@EntryTime,0)+
				", Entry Short Price at, "+numtostr(@EntryPrice,2)+","+newline);
		
fileappend("c:\livetrad.txt",@GetSymbolName+","+numtostr(date,0)+","+numtostr(time,0)+
						", Backup Exit Short at, "+numtostr(EP,2)+","+newline);
											{print to disk file to save}
			end;
		end;
	value99	=	EP;								{save previous EP price}
	EP			=	pL + (ExitS * Spread);				{calculate low exit point}
	if	EP		>	value99				then		{check EP for previous lower value}
		EP		=	value99;					{reset EP to lower value}
	if	time	>	1555					and		{check for at end of the day}
		MidPoint	>	@EntryPrice - 1	then				{check for profit in the stock}
		EP		=	MidPoint	-	.25;			{if not enough profit, exit & do not hold
overnight}
	if	MidPoint		>=	EP			then begin	{check for exit type}
		ExitShort;								{exit short}
		PosCnt			=	1;
		if	CurLog						then begin	{print log of trade}
			Print(time:4:0," ", @GetSymbolName, "                             
*** EXIT SHORT price ", EP:6:3, " ***");
		
fileappend("c:\livetrad.txt",@GetSymbolName+","+numtostr(date,0)+","+numtostr(time,0)+
						", EXIT Short NOW at, "+numtostr(EP,2)+","+newline);
			end;
		end; 
	end
else
if	(time				<	CPtime			or		{test for time before CP time (midday)}
	time				>	LTtime)			and		{test for time after LT time (midday)}
	(TradeCnt			<	MaxTrade)		then begin	{test for max trades}
	If	(PosCnt		=	1) 				and		{now out of the last trade}
		(@ExitDate(1)	=	Date)				then begin	{check to see if an exit trade has
occurred}
		PosCnt			=	0;					{reset position counter}
		If	CurLog						then begin
			Print(@ExitTime(1):4:0," ", @GetSymbolName, "  Exit Price of
",@ExitPrice(1):6:3);
		
fileappend("c:\livetrad.txt",@GetSymbolName+","+numtostr(date,0)+","+numtostr(@ExitTime(1),0)+
				", Exit Price at, "+numtostr(@ExitPrice(1),2)+","+newline);
			end;
		end;
	if 	(time			<	Notime)			then begin
		if	(Low		<	pL)			or		{test for new low}
			(Low		=	pL			and
		pL			<	pL[1])			then		{test for new low}
			BuySell	= 	-1						{generate sell order}
		else
		if	(High		>	pH)			or		{test for new High}
			(High		=	pH 			and
			pH			>	pH[1])		then		{test for new high}
			BuySell	=	1;						{generate buy order}
		end;

	if	(BuySell			<>	0)		and		{test for a buy/sell order possible}
		(vCnt				>	4)		then begin	{at least 4 bar time periods of trades
reported}
		if	BuySell		=	-1			then begin	{is this a sell order?}
			Sell Shar Shares at close;					{sell short at next price}
			PosCnt			=	-1;				{set position counter to set up exit routine}
			TradeCnt		=	TradeCnt + 1;			{entered another trade}
			if	CurLog					then begin	{print log of trade}
				Print(time:4:0," ", @GetSymbolName, "                     *** Enter
SHORT price ", close:6:3, " ***");
			
fileappend("c:\livetrad.txt",@GetSymbolName+","+numtostr(date,0)+","+numtostr(time,0)+
					", Enter Short NOW at, "+numtostr(close,2)+","+newline);
				end;
			end
		else
		if	BuySell		=	1			then begin	{test for a buy order?}
			Buy Shar Shares at close;					{buy the stock at open of next bar}
			PosCnt			=	-1;				{set position counter to set up exit routine}
			TradeCnt		=	TradeCnt + 1;			{entered another trade}
			if	CurLog					then begin	{print log of trade}
				Print(time:4:0," ", @GetSymbolName, "           *** Enter LONG 
price ", close:6:3, " ***");
			
fileappend("c:\livetrad.txt",@GetSymbolName+","+numtostr(date,0)+","+numtostr(time,0)+
					", Enter Long NOW at, "+numtostr(close,2)+","+newline);
				end; 
			end;
		end;
	BuySell		=	0;							{reset Buy Sell indicator for next position}
	end;