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

RE: CL_coding swing highs/lows of an indicator?


  • To: "clydelee" <ivo1@xxxxxxxxx>
  • Subject: RE: CL_coding swing highs/lows of an indicator?
  • From: "Franklin A. Cerrone" <cerrone@xxxxxxxxxxx>
  • Date: Thu, 11 Feb 1999 09:00:14 -0500 (EST)
  • In-reply-to: <36C1FE3E.25CAF63C@xxxxxxx>

PureBytes Links

Trading Reference Links

Clyde,
Have you had experience with shorter time
frames, i.e. 15min, 5min, 3min bar charts? Using the
Swing_Lee indicator. Specifically the S&P.

Frank

Frank Cerrone
cerrone@xxxxxxxxxxx

-----Original Message-----
From: clydelee [mailto:clydelee@xxxxxxx]
Sent: Wednesday, February 10, 1999 4:47 PM
To: Peter Iovanella
Cc: Omega List; Code List
Subject: Re: CL_coding swing highs/lows of an indicator?


Peter,

Some time back I posted an indicator that picked turning points
and displayed bars between each TP.

The following FUNCION is the heart of that indicator and will
provide you with an excellent tool to pick turning points.

You will have to record the high or low as appropriate at each
swing detected and then evaluate the most recent lows or highs
of these turning points to decide what is going on.

The  .ela  contains indicator and function.

Code follows:


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

   Study       : Swing_Lee

   Last Edit   : 12/13/97

   Provided By : Clyde Lee (c) 1997

   Notes:   Uses HighestHigh and LowestLow to determine Turning
            Points for Swing Analysis.

            Returns number of bars back to last swing point.
            Negative if low.  Positive if high.

********************************************************************
}
Input:   NDays(NumericSimple);
Vars:    OldHigh(0),       OldLow(0),        String1(" "),
         HBar(0),          LBar(0),          TextLoc(0),
         HHBar(0),         LHBar(0),
         Direct(0),        Return(0),        Init(0);

{
HBar=HighestBar(H,AbsValue(NDays));
LBar=LowestBar (L,AbsValue(NDays));
HHBar=CurrentBar-HBar;
LHBar=CurrentBar-LBar;

If Direct=0 then begin
   Direct=HBar-LBar;
End
Else begin
   If Direct>0 then begin
      If h[HBar]<h[CurrentBar-HHBar[1]] then begin
         HBar=CurrentBar-HHBar[1];
         HHBar=HHBar[1];
      End;
   End
   Else If Direct<0 then begin
      If l[LBar]>l[CurrentBar-LHBar[1]] then begin
         LBar=CurrentBar-LHBar[1];
         LHBar=LHBar[1];
      End;
   End;
End;


If LBar<HBar and Direct>0 then   begin
      Direct=-1;
      OldHigh=H[HBar];
      Return = HBar;
End
Else If HBar<LBar and Direct<0 then begin
      Direct=+1;
      OldLow=L[LBar];
      Return = -LBar;
End;
}
If NDays>0 then begin
   HBar=HighestBar(H,NDays);
   LBar=LowestBar (L,NDays);
End
Else begin
   HBar=HighestBar(H,-NDays);
   LBar=LowestBar (L,-NDays);
End;

HHBar=CurrentBar-HBar;
LHBar=CurrentBar-LBar;

If Direct=0 then begin
   Direct=HBar-LBar;
End
Else begin
   If Direct>0 then begin
      If h[HBar]<h[CurrentBar-HHBar[1]] then begin
         HBar=CurrentBar-HHBar[1];
         HHBar=HHBar[1];
      End;
   End
   Else If Direct<0 then begin
      If l[LBar]>l[CurrentBar-LHBar[1]] then begin
         LBar=CurrentBar-LHBar[1];
         LHBar=LHBar[1];
      End;
   End;
End;


If Direct>0 then
   Return=Return+1
else
   Return=Return-1;

If LBar<HBar and Direct>0 then   begin
      Direct=-1;
      OldHigh=H[HBar];
      Return=-HBar;
End
Else If HBar<LBar and Direct<0 then begin
      Direct=+1;
      OldLow=L[LBar];
      Return=LBar;
End;


Swing_Lee = Return;


++++++++++++++++++++++++end of code+++++++++++++++++++++++++++++++

Peter Iovanella wrote:
>
> Is it possible to calculate swing highs and lows for indicators?
I'm trying
> to code a bearish divergence in a Stochastic Oscillator, which
Murphy
> defines as divergence between %D and the underlying price when %D
is in the
> overbought range and forms 2 declining peaks as prices continue
higher.  I'm
> having trouble defining the '2 declining peaks' part.  Any
ideas/is it even
> possible?
>
> Peter

--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Clyde Lee   Chairman/CEO       (Home of SwingMachine)
SYTECH Corporation             email:   <clydelee@xxxxxxx>
7910 Westglen, Suite 105       Work:    (713) 783-9540
Houston,  TX  77063            Fax:     (713) 783-1092
SM available at:               ftp://intrepid.com/pub/clyde
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -