Fave This

Monday, 24 December 2012

[Komunitas AmiBroker] Pascal Willain Effective volume formula perlu diubah ke AFL



Para Suhu sekalian,
Ini ketemu Effective volume formula cuman bahasanya bukan buat ami. Ada yang bersedia translate ke AFL? 
Saya sudah coba hubungi si Pascal utk dp plug-in aslinya, cuman krn Ami skrg pindah ke 64bit, Pascal gak supply plug-innya

Terima kasih banyak.
Salam
Ade

{- Filename: Effective Volume™ -}
{*************************************************
Effective Volume™ is an indicator developed by Pascal Willain and published in the  book "Value in Time" , Wiley 2008.
This indicator detects institutional activities by stastistically analysing price/volume movements on the minute level.
This analysis allows to show institutional players' activities out of the noise generated by retail players.
More information can be found on www.effectivevolume.eu
Effective Volume is a registered trademark.
Adaptation of Effective Volume™ to "Wall Street" has been provided by Paul Menzing.
**************************************************}
var
  Direction,NumBars,DayCount,iVolumeFilter,iPriceFilter,Dag         : integer;
  i,Counter,Counter1,Counter2,Loop                                  : integer;
  TotalDailyVolume,SPI,PriceFiter,Size                              : real;
  PriceInflection,TotalDailyEV,SeperationNumber                     : real;
  VolumeFilter,TotalEffVolume,xMidPoint,Temp,SeparationVolume       : real;
  PlotSEV,PlotLEV,LargeEffectiveVolume,SmallEffectiveVolume,TrueLow : TSeries;
  TrueHigh,CloseAgo,EffectiveVolume,TotalEffectiveVolume,xDayCount  : TSeries;
  SessionEndTime,xSessionEndTime,StartDate                          : TdateTime;
  ShowMD                                                            : Boolean;

  aEffectiveVolume   : array[1..1440]of Real;
  aTmp               : array[1..1440]of Real;
  
begin

  iVolumeFilter := CreateParameterInteger('VolumeFilter %', 1, 999,5, true);
  iPriceFilter  := CreateParameterInteger('PriceFilter %', 1, 999, 1, true);
  SPI           := CreateParameterReal('Smallest Price Increment', 0, 1, 0.01, false);
  Size          := CreateParameterReal('Size', 0, 1, 0.001, false);
  Dag           := CreateParameterInteger ('Total Days'      , 1   , 2000   , 15    , true);
  ShowMD        := CreateParameterBoolean('Multiple days', true, false);
  
  with Indicator do
  begin
    ShortName    := 'Effective Volume™';
    RequiredBars := 2*390;
  end;

    CloseAgo             := Shiftseries(Close,1);
    TrueLow              := MinSeries(Low,CloseAgo);
    TrueHigh             := MaxSeries(High,CloseAgo);
    xDayCount            := CreateSeries(BarCount);
    EffectiveVolume      := CreateSeries(BarCount);
    TotalEffectiveVolume := CreateSeries(BarCount);
    LargeEffectiveVolume := CreateSeries(BarCount);
    SmallEffectiveVolume := CreateSeries(BarCount);
    PlotLEV              := CreateSeries(BarCount);
    PlotSEV              := CreateSeries(BarCount);

    if Dag <= 5 then Dag := 7 else Dag := Trunc((Dag/5) * 7);
    StartDate            := date - (Dag + 2);

    DayCount := 0;
    
for i:=FirstValidIndex(close)+1 to barcount-1 do begin

     xSessionEndTime := frac(datetime[i])+ 0.001;
     SessionEndTime  := Instrument.MarketClose;


if  dateTime[i] >= (StartDate) then
begin

   if (DayCount = 0 ) then
   begin
    NumBars                 := 0;
     LargeEffectiveVolume[i] := 0;
    SmallEffectiveVolume[i] := 0;
    PlotLEV[i]              := NAN;
    PlotSEV[i]              := NAN;   
   end;

     TotalDailyVolume := TotalDailyVolume + Volume[i];   
     PriceFiter       := Abs(((Close[i] - Close[i-1])/Close[i-1])*100);
      
  if (DayCount > 0)  then
  begin
       NumBars := NumBars + 1;
       if Numbars = 1 then  EffectiveVolume[i] := 0;
       
   if (Numbars > 1) then begin
    if (Close[i-1] - Close[i] <> 0) and ( (Volume[i] <= VolumeFilter) and (PriceFiter <= iPriceFilter))then
    begin
   
      if close[i] > close[i-1] then
      begin
        PriceInflection := close[i] - close[i-1];
        Direction       := 1;
      end;
      if close[i] < close[i-1] then
      begin
        PriceInflection := close[i-1] - close[i];
        Direction       := -1;
      end;
   
       if  (TrueHigh[i] - TrueLow[i] + SPI) <> 0 then  EffectiveVolume[i] := Direction * ((PriceInflection + SPI)/(TrueHigh[i] - TrueLow[i] + SPI)) * Volume[i] else EffectiveVolume[i] := 0;   
    end
     else EffectiveVolume[i] := 0;
   end;//Numbars

        TotalEffVolume            := TotalEffVolume +  EffectiveVolume[i];
        aEffectiveVolume[NumBars] := EffectiveVolume[i];
        aTmp[NumBars]             := Abs(EffectiveVolume[i]);   
        TotalDailyEV              := TotalDailyEV + aTmp[NumBars];   
  end;//Daycount
/////////////////////////////////End Of Day Calculation/////////////////////////////////////////////////////
if  xSessionEndTime >= SessionEndTime  then begin
       DayCount  := DayCount + 1;
       xMidPoint := TotalDailyEV * 0.5;

  if  (DayCount > 0) and (Numbars > 2) then
  begin

    //Sorting Array High to Low
     for Counter1 := 1 to Numbars-1  do
      begin
       for Counter2 := Counter1 + 1 to Numbars do
      begin
         if  aTmp[Counter1] < aTmp[Counter2]then
         begin
           Temp           := atmp[Counter1];
           aTmp[Counter1] := aTmp[Counter2];
           aTmp[Counter2] := Temp;
         end ;
       end ;
    end ;
   
    Loop             := 1;
    SeperationNumber := TotalDailyEV;
    while (loop <= NumBars) and (SeperationNumber >= xMidPoint)do
    begin
       SeperationNumber := SeperationNumber - aTmp[Loop];   
      SeparationVolume := aTmp[Loop];
       Loop             := Loop + 1;
    end;

    for Counter :=  Numbars - 1 downto 0 do
    begin

      if abs(aEffectiveVolume[Numbars - Counter])>= SeparationVolume
      then  begin
      LargeEffectiveVolume[i - Counter]:=LargeEffectiveVolume[i - Counter-1] + aEffectiveVolume[Numbars - Counter]*Size;
      SmallEffectiveVolume[i - Counter]:=SmallEffectiveVolume[i - Counter-1]+ 0;
      end
       else
       if abs(aEffectiveVolume[Numbars - Counter])< SeparationVolume then
      begin
      SmallEffectiveVolume[i - Counter]:=SmallEffectiveVolume[i - Counter-1] + aEffectiveVolume[Numbars - Counter]*Size;
      LargeEffectiveVolume[i - Counter]:=LargeEffectiveVolume[i - Counter-1]+ 0;
      end;
       //Plot values starting with first minute
       if (DayCount > 1) then begin
       PlotLEV[i - Counter] := round(LargeEffectiveVolume[i - Counter]);
       PlotSEV[i - Counter] := round(SmallEffectiveVolume[i - Counter]);
      end;
    end;

     for Counter := 1 to Numbars do
     begin
      aEffectiveVolume[Numbars] := 0;
      aTmp[Numbars]             := 0;
     end;
  end;//NumBars

    NumBars                := 0;
     VolumeFilter           := TotalDailyVolume * (iVolumeFilter * 0.01);
     TotalDailyEV           := 0;
     TotalDailyVolume       := 0
     TotalEffVolume         := 0;
     EffectiveVolume[i]     := 0;
     TotalEffectiveVolume[i]:= 0;
    if not ShowMD then
    begin
     LargeEffectiveVolume[i] := 0;
      SmallEffectiveVolume[i] := 0;   
    end;
  end;  //SessionEndTime
end;  // StartDate
end;  //for

  with CreateLine(PlotLEV) do
  begin
    Name  := 'LEV';
    Color := clBlue;
    width := 4;
  end;
  with CreateLine(PlotSEV) do
  begin
    Name  := 'SEV';
    Color := clYellow;
    width := 4;
  end;
end.



__._,_.___


Harga Software AmiBroker:
- Versi Professional: Rp 2,5 Jt
- Versi Standard: Rp 1,8 Jt

Harga Paket Realtime Intraday Data:
- 1 bulan Rp 250 Rb
- 3 bulan Rp 675 Rb (after disc 10%)
- 6 bulan Rp 1,2 Jt (after disc 20%)
- 12 bulan Rp 2,3 Jt (after disc 23%)

Pemesanan:
E-Mail: sales@integrity.co.id
Ph: 021-57936155
SMS: 08159304868
Pin: 285844A8
http://www.integrity.co.id




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

No comments:

Post a Comment