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

evaluate trades at specific times



PureBytes Links

Trading Reference Links

Good Evening Omegalist,

I am looking to evaluate data/make trades at specific times during
the day.  I am looking to apply it against symbols that trade 24
hours/day (ES, NQ).  I have tried coding in Easylanguage but have run up
against a wall.  Here are my needs along with the code so far.

1. Must run on 1 min chart, but evaluate OHLC at specific times of day,
approximating a 60 min chart of varying times.  Specific times are as
follows:
30, 130, 230, 330, 430, 530, 630, 705, 820, 920, 1020, 1120, 1220,
1320, 1400, 1530, 1630, 1730, 1830, 1930, 2030, 2130, 2230, 2330.  I'll 
call these "synthetic hourly bars".

I'm having trouble with getting all these times with the code I've 
provided below, but I think I can get past that myself with a little 
more thought.

This is the hard part - for me...

2.  Store (in an array?) the Open and Close of each bar "synthetic 
hourly bar" above for reference against the previous O & C "synthetic 
hourly bar".

3.  Build the High & Low based on the 1 min bars between the "synthetic 
hourly bars" for reference against the previous H & L "synthetic hourly 
bar".

All I am trying to do is run an hourly system on a 1min bar chart so I 
can autoexecute my stop loss order within 1 min of my order so I'm not 
exposing myself to adverse market moves.




{ *******************************************************************

	Signal      : _TradeBar
	
	Last Edit   : 06/09/2004

	Provided By : Mike Marcott
		    : portions by Bob Fulks


*********************************************************************}

Inputs: TStart(0700), TLast(1400), OTime(0820), Interval(60),
DFirst(1040513), EVSTart(30), EVStart2(1530);

Variables: TNext(TStart), TradeOK(FALSE), EvalOK(False), EVNext(EVStart);

Array: MyArray [120, 4] (0); {Not implemented yet in code below}


if Date <> Date[1] then begin    {New day initialization}
    TNext = TStart;		 {Reset TNext to first bar time}
    EVNext = EVStart;	         {Reset EVNext to first eval time}
end; {if Date <> Date[1] }

if (Time >= (TStart + Barinterval) and Time <= (OTime - barinterval)) then
	TNext = OTime ;
if (Time >= (TStart + Barinterval) and Time <= (OTime - barinterval)) then
	EVNext = OTime ;

If (Time >= (TLast + Barinterval) and Time <= (EVStart2 - Barinterval)) then
	EVNext = EVStart2;


TradeOK = (Time = TNext or Time = TLast or Time = OTime) and Date >=
DFirst ;
EvalOK= (Time = EVStart or Time = EvStart2 or Time = EVNext or Time =
TStart or Time = TLast) and Date >= DFirst;

if TradeOK then	 {Find time of next trading bar}
	TNext = MinutesToTime(TimeToMinutes(TNext) + Interval);	
if EvalOK then	 {Find time of next evaluation bar}
	EVNext = MinutesToTime(TimeToMinutes(EVNext) + Interval);


if Time >= TStart and Time <= TLast and TradeOK then begin
	Print(Date:8:0, Time:5:0, TNext:5:0, " TradeOK=",TradeOK);
end; {if Time >= TStart }

Print(Date:8:0, Time:5:0, EVNext:5:0, " EValOK=" ,EValOK);

If TradeOK then Value1 = 1 else value1 = -1;
If EvalOK then Value2 = 1 else Value2 = -1;

Plot1(value1, "Plot1");
Plot2(Value2, "Plot2");


Any help would be greatly appreciated!



--
Best Regards,

Mike
mailto:omegalist@xxxxxxxxxxx