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

Re: Indicator line query:



PureBytes Links

Trading Reference Links

I believe this was written by Dave Stanley. I added the extra plots. 
(WYSIWYG ADX) Call it ADX DS.

inputs:
Length(14),X(20),Y(30);

vars:
Counter(0),
TRange(0), MyRange(Length),
PlusDM(0),MinusDM(0),
Plus14(0),
Minus14(0),
DMIup(0),DMIdn(0),
DMI_(0),
CummDMI(0), Return(0),
ADX_(0);


if CurrentBar = 1 then begin

  MyRange  = Length;
  DMIup  = 0;
  Plus14 = 0;
  Minus14 = 0;
  TRange   = 0;

  for Counter = 0 to MyRange-1 begin

    if (High[Counter] - High[Counter+1] < 0) then PlusDM  = 0
    else
       PlusDM  = High[Counter] - High[Counter+1];

    if (Low [Counter+1] - Low [Counter] < 0) then MinusDM = 0
    else
      MinusDM = Low [Counter+1] - Low [Counter];

    if MinusDM >= PlusDM then PlusDM = 0;
    if PlusDM >= MinusDM then MinusDM = 0;

    TRange= TRange + TrueRange[Counter] ;

    Plus14 = Plus14 + PlusDM ;
    Minus14 = Minus14 + MinusDM ;

  end;{...counter=0 to myrange-1}

  if TRange <> 0 then begin
    DMIup = 100 * Plus14 / TRange;
    DMIdn = 100 * Minus14 / TRange;
  end
  else begin
    DMIup = 0 ;
    DMIdn = 0;
  end;

end{...currentbar=1}

else if CurrentBar > 1 then begin

  if High[0]-High[1] < 0 then PlusDM  = 0
  else
    PlusDM  = High[0]-High[1];

  if Low [1]-Low [0] < 0 then MinusDM = 0
  else
    MinusDM = Low [1]-Low [0];

  if MinusDM >= PlusDM then PlusDM = 0;
  if PlusDM >= MinusDM then MinusDM = 0;

  if MyRange > 0 then begin
    TRange  = TRange[1] - (TRange[1] / MyRange) + TrueRange;
    Plus14 = Plus14[1] - (Plus14[1] / MyRange) + PlusDM;
    Minus14 = Minus14[1] - (Minus14[1] / MyRange) + MinusDM;
  end;

  if TRange<>0 then begin
    DMIup = 100 * Plus14 / TRange;
    DMIdn = 100 * Minus14 / TRange;
  end
  else begin
    DMIup = 0;
    DMIdn = 0;
  end;

end;{...currentbar>1}


{ZZZZZZZZZZZZZZZ...DMI_...ZZZZZZZZZZZZZZZZ}

if DMIup + DMIdn= 0 then DMI_ = 0
else
  DMI_ = 100 * AbsValue(DMIup - DMIdn)
       / (DMIup +   DMIdn);


{ZZZZZZZZZZZ...ADX_...ZZZZZZZZZZZZZ}

Return = 0 ;

if CurrentBar >= 1 and Length > 0 then begin

  if CurrentBar <  Length then begin
    CummDMI = 0 ;
    for Counter = 0 to CurrentBar - 1 begin
      CummDMI = CummDMI + DMI_[Counter] ;
    end ;
    Return = CummDMI / CurrentBar ;
  end
  else
    Return = (ADX_[1] * (Length - 1) + DMI_) / Length ;

end ;

ADX_ = Return ;


{ZZZZZZZZZZZZ...Plot...ZZZZZZZZZZZZZ}


plot1(adx_,"adx");
plot2(X, "X");
plot3(Y,"Y");



>From: Robert Cavaleri <rcavaler@xxxxxxxxxxxxx>
>To: omega-list@xxxxxxxxxx
>Subject: Indicator line query:
>Date: Sun, 15 Oct 2000 23:47:21 -0400
>
>
>Hello, I am new to TS.
>
>I am trying to do something that I imagine should be quite simple. I
>want to insert a vertical line in my subgraph which contains an adx(14)
>indicator. I want my line to set my line to a certain y value (i.e. 20).
>I can create a custom line indicator, and set the value and drag it over
>to the subgraph, however I notice that the line value (which is 20) does
>not correlate to the 20 on either the left or right y axis. Can someone
>tell me what I may be doing wrong?
>
>thanks in advance,
>
>robert
>
>
>--
>Rob's Cool Links :
>- 1998 Academy Award winning best animated short film: "Bunny"
>   http://bunny.blueskystudios.com
>
>