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

EL Question (Off Topic ???)



PureBytes Links

Trading Reference Links

{I'm trying to get price projections based on the swing before last
measurement.  By taking the H-L of the swing before last (if it was an
up-swing) and adding it to the current swing low you should get a
reasonable objective to the upside.  If the swing before last was a
down-swing, the H-L would be subtracted from the most recent swing high
to get a reasonable objective to the downside.
The following code draws a ZigZag line from Swing to Swing.  I can't
remember, but think it came off the omega site.  I'm leaving out my
trying to accomplish the price projections because it's an awful mess.
Any help would be GREATLY appreciated.

Strength determines the Strength of the Swing
WavePcnt determines the determines the percentage that prices must
increase or decrease in order to be considered a true reversal point.}

Inputs: Strength(1), WavePcnt(.2);
Vars: SH(0), SL(0), SHB(0), SLB(0), RP(0), RPDate(0), RPTime(0),
ZigZag(0), Switch(0);

IF CurrentBar = 1 Then Begin
RP = MedianPrice;
RPDate = Date;
RPTime = Time;
End;

SH = SwingHigh(1, High, Strength, Strength+1);
SL = SwingLow(1, Low, Strength, Strength+1);

IF SH <> -1 Then Begin
IF Switch <> -1 AND SH >= RP * (1+(WavePcnt/100)) Then Begin
  Condition1 = True;
  Switch = -1;
  Condition2 = True;
End;
IF Condition1 = False AND Switch = -1 AND SH >= RP Then Begin
  TL_SetEnd(ZigZag, Date[Strength], Time[Strength], SH);
  Condition2 = True;
End;
IF Condition2 Then Begin
  Condition2 = False;
  RP = SH;
  RPDate = Date[Strength];
  RPTime = Time[Strength];
End;
End;

IF SL <> -1 Then Begin
IF Switch <> 1 AND SL <= RP / (1+(WavePcnt/100)) Then Begin
  Condition1 = True;
  Switch = 1;
  Condition2 = True;
End;
IF Condition1 = False AND Switch = 1 AND SL <= RP Then Begin
  TL_SetEnd(ZigZag, Date[Strength], Time[Strength], SL);
  Condition2 = True;
End;
IF Condition2 Then Begin
  Condition2 = False;
  RP = SL;
  RPDate = Date[Strength];
  RPTime = Time[Strength];
End;
End;

IF Condition1 Then Begin
Condition1 = False;
ZigZag = TL_New(RPDate, RPTime, RP, RPDate[1], RPTime[1], RP[1]);
TL_SetSize(ZigZag, 1);
TL_SetExtRight(ZigZag, False);
TL_SetExtLeft(ZigZag, False);
IF False Then Plot1[Strength](RP, "RP");
End;

{David Powell
dwpowell@xxxxxxxxxxxxx}