PureBytes Links
Trading Reference Links
|
> Example 1 : Buy at todays high plus one pointon a
> stop.
> Buy at HighD + 1 point stop;
> Example 2 :Buy at YESTERDAYS high plus one pointon a stop.
> Buy at HighD[1] + 1 point stop;
HighD (and LowD, CloseD, OpenD) are functions. You must pass a
parameter to tell them what day you want. So today's high is
HighD(0), and yesterday's high is HighD(1).
On a related note, I have had a LOT of trouble with the HighD &etc
functions. I've solved many mysterious problems by computing the
daily high/low myself instead of using HighD/LowD. I finally looked
at the HighD/etc code. It looks like it will fail if you don't call
it on EVERY bar of the day (especially the first bar), so maybe that
was my problem. Omega should have declared it as a Series function
to avoid this error. Be Careful if you use those functions!! Better
yet, copy them to MyHighD &etc, and declare the copied functions to
be Series.
However, I think Jose is looking for something a bit different. He
wants the H/L of the first 30 minutes, then he wants to set stops
above & below that 30min H/L for the rest of the day. Correct, Jose?
To do that, you'll have to store the 30min H/L into variables and
refer to those values for the rest of the day.
Assuming you're using 30min bars (so the first bar of the day is the
30min bar you're interested in), you could do something like this:
(Not tested)
Vars: High30(0), Low30(0), OneTick(MinMove points);
if Date<>Date[1] then begin { First bar of the new day }
High30 = High;
Low30 = Low;
end;
{ Clear the stop values if the stops are hit }
if High >= High30 + OneTick then High30 = 0;
if Low <= Low30 - OneTick then Low30 = 0;
{ Don't issue orders on the last bar of the day, since that
order would affect the first 30min bar of the next day! }
if Time < Sess1EndTime then begin
if High30 <> 0 then buy at High30 + OneTick stop;
if Low30 <> 0 then sell at Low30 - OneTick stop;
end;
Gary
|