PureBytes Links
Trading Reference Links
|
Hi Erik,
EK> I have been busy for several days trying to code a
EK> breakout system based on the highest high and lowest low
EK> within a specified timeframe, without succeeding.
EK> Example: Place a buy stop order above the highest high
EK> in a time period lets say starting 11:45am to 1:15pm.
EK> The order should stay active for the rest of the day.
I'm just writing this off the cuff, outside of my
PowerEditor. So, there may be typos or some syntax
problem when you verify. My intent in writing this is
to give you an idea of the form for the code that you
can work with rather than an exact solution.
You'll need something like the following:
Vars:
Max_High(0),
Min_Low(99999);
{This next part establishes your High and Low breakouts
during the time period you specified. You can make the times
Input variables and adjust as necessary}
If Time>=1145 AND Time<=1315 then begin
Max_High=MaxList(Max_High,High);
Min_Low=MinList(Min_Low,Low);
End;
{The following section sets your entries to start at your
specified time, or any time that you wish, and run through
the remainder of the trading day. You could add some amount
over the High or below the Low by modifying the equations
below.}
If Time>=1145 then begin
Buy Max_High Stop;
Sell Min_Low Stop;
End;
{Finally, this section resets the Max High and Min Low
values at the start of a new day}
If Date<>Date[1] then begin
Max_High=0;
Min_Low=99999;
End;
--
Dave Nadeau
Fort Collins, CO
|