ADX indicator

Hi, all!

Someone know how at WLD 4 calculated an indicator ADX?

I used a formula as described in the manual WLD4:

+DI = Round( ( +DM / TR ) * 100 )

where,

DI+ = DIPlus
TR = True Range of current bar

The +DI is then smoothed over the period specified, the same way as a simple moving average, and +DM is calculated as follows:

(i) For up trending days, +DM = today's high - yesterday's high
(ii) For down trending days, +DM = zero
(iii) For inside days, +DM = zero
(iv) For outside days, if today's high - yesterday's high, is greater than yesterday's low- today's low, then +MD = today's high - yesterday's high, otherwise +DM = zero
(v) For upwards gap days, +DM = today's high - yesterday's high
(vi) For downwards gap days, +DM = zero

I realised the formula on C#, but result is different than make a code on WLD4, but again I see the different

Example on WLD4:

Code:
function MyDXPluse(Period: integer): integer;
begin

var BarSys,pDM,mDM,pDMA,mDMA,ATRA,R: integer;

var dHigh,dLow: float;

pDM := CreateSeries();
mDM := CreateSeries();

mDMA := CreateSeries();
pDMA := CreateSeries();

Result:= CreateSeries();
R:= CreateSeries();

for BarSys := Period to BarCount - 1 do
begin

   dHigh := @#High[BarSys] - @#High[BarSys-1];
   dLow := @#Low[BarSys-1] - @#Low[BarSys];


  if ((dHigh < 0) and (dLow < 0)) or (dHigh=dLow) then begin
      SetSeriesValue( BarSys,pDM,0);
      SetSeriesValue( BarSys,mDM,0);
   end;
   if (dHigh > dLow) then begin
      SetSeriesValue( BarSys, pDM,dHigh);
      SetSeriesValue( BarSys, mDM, 0);
   end;

   if (dHigh < dLow) then begin
      SetSeriesValue( BarSys, pDM,0);
      SetSeriesValue( BarSys, mDM,dLow);
   end;
  
end; //for

{
pDMA:= WilderMASeries(pDM,Period);
mDMA:= WilderMASeries(mDM,Period);

ATRA := ATRSeries(Period);
}

ATRA := TrueRangeSeries();

for BarSys := Period to BarCount() - 1 do begin
SetSeriesValue( BarSys, R,  Round( 100 * (@pDM[BarSys] / @ATRA[BarSys])));
end; //for

Result :=  WilderMASeries(R,Period);

end;  //function
//--------------------------------------------------------------------------------

var x : integer = MyDXPluse(7);


var xPane: integer =  CreatePane( 75, true, true );
PlotSeriesLabel( x, xPane, 009, #Thick, 'MyDXPluse Plot' );

Please write to me how is correct do calculate the formula ADX using at WLD4, I long sought information about it, but I found nothing!
 
A screenshot different the ADX indicator at WLD4 and The ADX made by the formula

1506190038110099.jpg
 
Back
Top