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

Ensign Language



PureBytes Links

Trading Reference Links

Hi Lionel

Here's an old email from the Ensign List showing some of the language. Some
former Metastock Listers appear on the Ensign List now. Have lots more
emails if you're interested. Plus brief lessons about the language.

Howard is the owner and main programmer. He writes daily on the Ensign List.
There is a constant dialogue going on. Very enlightening.

Best regards

Walter


----- Original Message -----
From: Jonathan Sibley
To: Howard Arrington
Cc: Discussion Group
Sent: Sunday, November 15, 1998 11:14 AM
Subject: Re: HEA: Re: PivotRange question and solution


EnsignList - http://www.ensignsoftware.com First, it wouldn't be the first
time I've overcomplicated something, so thank you. This looks promising.

But it raises some questions for me (what else is new).

- My previous understanding was that a "For i := BarBegin to BarEnd" loop
would go through the loop initially, and then would essentially run "For i
:= BarEnd to BarEnd" as bars are added to the chart. Is this modified to
"For i := BarEnd-Strength to BarEnd" when some sort of flag has been set.,
e.g., by PivotRange?

- If that is true, are there other conditions where the loop backtracks (not
just PivotRange)? If so, what are they?

- Is it possible for a user routine to take advantage of this lookback
facility as well?

- Does everything within the loop involving "i" get reevaluated?

- If so, is there any way to avoid that (e.g., using a condition based on
some undocumented flag). For example, if I were writing something to the
screen or to a file within the loop I might not need to repeat it. If I've
grossly misunderstood how your lookback works, this question probably
doesn't make sense.

- Given all this, could you talk briefly about the pros and cons of keeping
loops within individual procedures/functions versus creating one master loop
that would evaluate each bar using various procedures/functions?

Thanks.

Jonathan Sibley

At 06:29 PM 11/14/98 -0600, Howard Arrington wrote:

Hi Jonathan,

Perhaps you thought about it too much and made it harder than it really
needs to be.  Here is my solution.

procedure PivotAlerts;
var
 i,j,Strength: integer;
 AlertHigh,AlertLow: real;
begin
 Strength:=Round(GetUser(eParm1));
 AlertHigh:=99999999; AlertLow:=0;        {initialize in case no pivot}
 for i:=BarBeginLeft-Strength to BarEnd do begin
  SetUser(1,GetUser(1,pred(i)),i);        {plot the high Alert level}
  SetUser(2,GetUser(2,pred(i)),i);        {plot the low Alert level}
  j:=Formation(ePivotRange,i,Strength);
  if j=1 then begin AlertLow:=Low(i); SetUser(2,AlertLow,i); end;
  if j=2 then begin AlertHigh:=High(i); SetUser(1,AlertHigh,i); end;
 end;
 if Last(BarEnd)>AlertHigh then
  Alert(True, 'Above Pivot '+VarToStr(AlertHigh), clBlue, clWhite, '')
 else if Last(BarEnd)<AlertLow then
  Alert(True, 'Below Pivot '+VarToStr(AlertLow), clRed, clWhite, '');
end;

begin
 if who=51 then PivotAlerts;
end;

In my example, I am reading the strength parameter from the 1st box on the
User parameter form.  I thought it was helpful to plot the alert levels as
well as post the alert message.  If you do not want to plot, you can remove
the setuser statements, or uncheck the plot boxes on the User parameter
form.

The reason why one does not have to worry about the maybe conditions is
because I always reevaluate starting at BarBeginLeft - Strength.  This is
the left most bar that might have been a previous maybe condition, and if it
is now a pivot it is the one that will move the alert levels to a new
position.  Just set the values in the SetUser arrays and leave the plotting
to EW.

Of course, you can assign this to any of the User Study buttons and change
the Who test accordingly.

Sincerely,
Howard Arrington
http://www.ensignsoftware.com/

-----Original Message-----
From: Jonathan Sibley <jsibley@xxxxxxxx>
To: EnsignList@xxxxxxxxxxx <EnsignList@xxxxxxxxxxx>
Date: Saturday, November 14, 1998 3:18 PM
Subject: PivotRange question

EnsignList - http://www.ensignsoftware.com

I would like to write a routine that tracks pivots and signals when the
price on the current bar exceeds the most recent appropriate pivot (above
bullish, below bearish).

Here is my question. If I try to store information about pivot bars using a
for..next loop (e.g., bar index, high, low), how will I know if a previous
bar has become a pivot? The current bar can't be labeled as a definitive
pivot for whatever the defined range is (default 2 bars on either side, I
believe). I know that Ensign has a pivot value of "potential", but is that
later filled in as Bullish or Bearish if appropriate? If yes, how can I
take advantage of that? If no, what is the appropriate algorithm to apply.
Is the For..Next loop through BarEnd appropriate?

I ask this question for this specific application, but I assume that there
are also broader principles that would be helpful elsewhere.

Thanks, as always.

Jonathan Sibley


______________________________________________________________________ To
unsubscribe, write to EnsignList-unsubscribe@xxxxxxxxxxx Start Your Own FREE
Email List at http://www.listbot.com/