PureBytes Links
Trading Reference Links
|
Brian Smiley wrote:
Here is the function:
{*******************************************************************
Function : Swing_Lee
Last Edit : 6/4/99
Provided By : Clyde Lee (c) 1997,1998,1999
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: HBar(0), LBar(0),
MinInt(IntPortion(NDays/5+1)),
Direct(0), Return(0);
If NDays<>0 and CurrentBar>NDays then begin
Value2=H;HBar=0;
For Value1=1 to AbsValue(NDays)-1 begin
If H[Value1]>Value2 then begin
HBar=Value1;Value2=H[HBar];
End;
End; Value2=L;LBar=0;
For Value1=1 to AbsValue(NDays)-1 begin
If L[Value1]<Value2 then begin
LBar=Value1;Value2=L[LBar];
End;
End;
If Direct=0 then begin
Direct=HBar-LBar;
End;
If Direct>0 then
Return=Return+1
else
Return=Return-1;
If LBar<HBar and Direct>0 {and HBar-LBar>MinInt} then begin
Direct=-1;
Return=-HBar;
End
Else If HBar<LBar and Direct<0 {and LBar-HBar>MinInt} then begin
Direct=+1;
Return=LBar;
End;
End;
Swing_Lee = Return;
John Corrion wrote:
Is the Swing_Lee User function missing here? Can it be supplied?
John
-------Original Message-------
From: Brian Smiley
Date: 08/18/05 11:43:16
To: omega-list@xxxxxxxxxx
Subject: Convert Clyde Lee Gann ind. for Forex
I have a Clyde Lee Gann Angle indicator that works good for the emini,
Dow, etc. However the scaling does not work properly for Forex markets.
Perhaps because of the 4 decimals? Here is the code, does someone know
how to fix this anomaly?
{Indicator: C.Lee_GannS&R
Purpose: Plot 3 Gann support and resistance lines
at each pivot detected by SwingLee
User specifies Gann angles to use.
Author: Clyde Lee, Copyright 6/2000
Permission: Permission to use in any fashion desired if proper credit
is given crediting author and indicating copyright.}
Inputs: NBars(19), {Number bars to use in SwingLee for detection
of swing points}
Angle1(7.5),
Angle2(11.25),
Angle3(19);
Vars: Direct(0);
Vars: OldBar(0), OldPrice(0),
NewBar(0), NewPrice(0);
Vars: PriceRoot(0),Price1(0),Price2(0),Price3(0);
Direct = Swing_Lee(NBars);
If Sign(Direct)<>Sign(Direct[1]) then begin
OldBar = NewBar;
OldPrice = NewPrice;
NewBar = CurrentBar-AbsValue(Direct);
If Direct<0 then
NewPrice = H[-Direct]
else
NewPrice = L[Direct];
PriceRoot = SquareRoot(NewPrice);
Price1 = Square(PriceRoot+Sign(Direct)*Angle1/360*2);
Price2 = Square(PriceRoot+Sign(Direct)*Angle2/360*2);
Price3 = Square(PriceRoot+Sign(Direct)*Angle3/360*2);
For Value1=AbsValue(Direct) downto 0 begin
Plot1[Value1](Price1,"GP1");
Plot2[Value1](Price2,"GP2");
Plot3[Value1](Price3,"GP3");
Plot4[Value1](NewPrice,"np");
End;
End
Else if OldPrice>0 then begin
Plot1[Value1](Price1,"GP1");
Plot2[Value1](Price2,"GP2");
Plot3[Value1](Price3,"GP3");
Plot4[Value1](NewPrice,"np");
End;
|