Effective Volume™

Stel hier uw vragen over TA-script, of help anderen met het oplossen van hun probleem
PaulM
Berichten: 431
Lid geworden op: do apr 06, 2006 11:56 pm
Locatie: Enschede

Effective Volume

Bericht door PaulM »

In samenwerking met Pascal Willain heb ik onderstaande code in TA-Script geschreven.

Pascal Willain zegt hier het volgende over:

Code: Selecteer alles

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. 
Meer informatie kan er gevonden worden op www.effectivevolume.eu

Dr. Alexander Elder (Entries & Exits,Come into my trading room, Trading for a Living)schreef het voorwoord voor zijn boek "Value in Time" en zegt daarover:

Code: Selecteer alles

"It' s a revolutionary book that explodes the envelope of standard technical analysis. It Introduces several new tools that can help you recognize when a trend is likely to reverse. It reveals new ways to profit from trends and their reversals" 
.

Korte impressies kunnen gevonden worden op:
http://www.amazon.com/review/product/04 ... ewpoints=1)

De indicator invoegen op één minuut data.

Code: Selecteer alles

{- 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.
Mvg,

Paul M

lars
Berichten: 42
Lid geworden op: wo dec 27, 2006 10:21 pm
Locatie: Gouda

Bericht door lars »

Paul,
Ik zie 2 lijnen die onderaan en boven aan blijven.
Als ik terug ga in de tijd dan zie ik ze wel bewegen.
klopt dit?
Kan je vertellen hoe je ze moet lezen.
Het lijkt mij bijzonder interessant

Alvast bedankt

Lars

PaulM
Berichten: 431
Lid geworden op: do apr 06, 2006 11:56 pm
Locatie: Enschede

Bericht door PaulM »

Lars,

Meer informatie kun je hier vinden:
http://www.willain.com/index.html

Daarna links in het menu Effective volume aanklikken en daarna nogmaals Effective Volume aanklikken.

Mvg,
Paul M

PaulM
Berichten: 431
Lid geworden op: do apr 06, 2006 11:56 pm
Locatie: Enschede

Bericht door PaulM »

Werkt alleen in de testversie Wall Street build 224 (als testversie te downloaden)

Wanneer je onderstaande code niet op een 1 min grafiek toepast krijg je een waarschuwingstekst.

Code: Selecteer alles

{- 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
 //works only on a one minute chart
   if barinterval = bi1Minute then
   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

 //Error text
 end else  with
 CreateText(DateTime[BarCount-1], Close[BarCount-1], 'Error: Works only on a one minute chart!')do
 begin
  Color := clRed;;
  Font.Style := [fsBold];
  HorzPosition := hpLeft;
  Font.Size := 24;
 end;
 
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.
Mvg,

Paul M

lars
Berichten: 42
Lid geworden op: wo dec 27, 2006 10:21 pm
Locatie: Gouda

Bericht door lars »

bedankt
Paul

gr lars

PaulM
Berichten: 431
Lid geworden op: do apr 06, 2006 11:56 pm
Locatie: Enschede

Bericht door PaulM »

-Twee functie's toegevoegd, voor het vinden van een nauwkeurige startdatum.
Deze detecteren de dagen dat de markt voor handel gesloten is.
-De indicator werkt nu ook realtime, dus niet alleen end of day.



Werkt alleen in de testversie Wall Street build 224 (als testversie te downloaden)

Code: Selecteer alles

{- 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.
**************************************************}

function NonTradingDays_NL(TargetDay: TDateTime): Integer;
var
HoliDay1,HoliDay2,HoliDay3,HoliDay4,HoliDay5,HoliDay6:TDateTime;

begin
    HoliDay1 := EncodeDate(2008, 1, 1); //Dinsdag 1 Januari 2008 Nieuwjaar
    HoliDay2 := EncodeDate(2008, 3, 21); //Vrijdag 21 Maart 2008  Goede vrijdag
    HoliDay3 := EncodeDate(2008, 3, 24); // Maandag 24 Maart 2008  Pasen
    HoliDay4 := EncodeDate(2008, 5, 1); // Donderdag 1 Mei 2008
    HoliDay5 := EncodeDate(2008, 12, 25); //Donderdag 25 December 2008  Kerstmis
    HoliDay6 := EncodeDate(2008, 12, 26); // Vrijdag 26 December 2008  2de Kerstdag
    if (TargetDay =  HoliDay1) or
        (TargetDay =  HoliDay2) or
         (TargetDay =  HoliDay3) or
          (TargetDay =  HoliDay4) or
           (TargetDay =  HoliDay5) or
            (TargetDay =  HoliDay6) then Result := 1 else Result := -1;
end;

function FindStartDate(NumDays: integer): Integer;
var
  Counter1,Counter2: integer;
begin
  Counter1 := -1;
	Counter2 := 0;
	while Counter1 < NumDays  do begin				
		if (DayofWeek(date - Counter2) > 0) and (DayofWeek(date - Counter2) < 6)
			and (NonTradingDays_NL(date - Counter2) = -1)then Counter1 := Counter1 + 1 ;
			Counter2 := Counter2 + 1;
    end;
    Result := Counter2 - 1;	
end;

var
  Direction,NumBars,DayCount,iVolumeFilter,iPriceFilter,TotalDays   : 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;
  PlotTEV                                                           : TSeries;
  SessionEndTime,xSessionEndTime,StartDate                          : TdateTime;
  SessionStartTime,xSessionStartTime                                : TdateTime;
  ShowMD                                                            : Boolean;

  aEffectiveVolume   : array[1..1440]of Real;
  aTmp               : array[1..1440]of Real;
  aPriceFilter       : 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);
  TotalDays     := CreateParameterInteger ('Total Days'      , 1   , 2000   , 10    , 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);
    PlotTEV              := CreateSeries(BarCount);


    StartDate            := date - FindStartDate(TotalDays);
    DayCount             := 0;

for i:=FirstValidIndex(close)+1 to barcount-1 do begin
 //works only on a one minute chart
   if barinterval = bi1Minute then
   begin

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


 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;
       aPriceFilter[Numbars] := PriceFiter;
       if Numbars = 1 then
       begin
        EffectiveVolume[i] := 0;
       end;


   if (Numbars > 1) then begin
    if (Close[i-1] - Close[i] <> 0) 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;


  if  (DayCount > 0)  then
  begin

   VolumeFilter := TotalDailyVolume * (iVolumeFilter * 0.01);
   xMidPoint    := TotalDailyEV * 0.5;

     For Counter1 := 1 to Numbars do
	   begin
	    if (aTmp[Counter1] > VolumeFilter) and (aPriceFilter[Counter1] < iPriceFilter) then
	    begin
			  aTmp[Counter1] := 0;
			  aEffectiveVolume[Counter1] := 0;
	    end;
	   end;
    //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]);
       PlotTEV[i - Counter] := round(LargeEffectiveVolume[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;
	  TotalDailyEV           := 0;
	  TotalDailyVolume       := 0
	  TotalEffVolume         := 0;
	  EffectiveVolume[i]     := 0;
	
    if not ShowMD then
    begin
     LargeEffectiveVolume[i] := 0;
	   SmallEffectiveVolume[i] := 0;
    end;
  end;  //SessionEndTime
  {*******************************LAST OPEN SESSION CALCULATION********************************************}
if (i = barcount - 1)  and (xSessionStartTime > SessionStartTime) and (xSessionEndTime <SessionEndTime) then begin

  if  (Numbars > 1)  then
  begin

    xMidPoint    := TotalDailyEV * 0.5;
    VolumeFilter := TotalDailyVolume * (iVolumeFilter * 0.01);

  	For Counter1 := 1 to Numbars do
	  begin
	   if (aTmp[Counter1] > VolumeFilter) and (aPriceFilter[Counter1] < iPriceFilter) then
	   begin
			aTmp[Counter1] := 0;
			aEffectiveVolume[Counter1] := 0;
	   end;
	  end;
	
  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]);
       PlotTEV[i - Counter] := round(LargeEffectiveVolume[i - Counter]) + round(SmallEffectiveVolume[i - Counter]);
      end;
    end;
  end;//NumBars
end;  //Session

end;  // StartDate

 //Error text
 end else  with
 CreateText(DateTime[BarCount-1], Close[BarCount-1], 'Error: Works only on a one minute chart!')do
 begin
  Color        := clRed;;
  Font.Style   := [fsBold];
  HorzPosition := hpLeft;
  Font.Size    := 24;
 end;
end;  //for

  with CreateLine(PlotLEV) do
  begin
    Name  := 'LEV';
    Color := clGreen;
  end;
  with CreateLine(PlotSEV) do
  begin
    Name  := 'SEV';
    Color := clRed;
  end;
  with CreateLine(PlotTEV) do
  begin
    Name  := 'TEV';
    Color := clYellow;
  end;
end.
Werkt in de eerdere versie's Wall Street

Code: Selecteer alles

{- 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.
**************************************************}

function NonTradingDays_NL(TargetDay: TDateTime): Integer;
var
HoliDay1,HoliDay2,HoliDay3,HoliDay4,HoliDay5,HoliDay6:TDateTime;

begin
    HoliDay1 := EncodeDate(2008, 1, 1); //Dinsdag 1 Januari 2008 Nieuwjaar
    HoliDay2 := EncodeDate(2008, 3, 21); //Vrijdag 21 Maart 2008  Goede vrijdag
    HoliDay3 := EncodeDate(2008, 3, 24); // Maandag 24 Maart 2008  Pasen
    HoliDay4 := EncodeDate(2008, 5, 1); // Donderdag 1 Mei 2008
    HoliDay5 := EncodeDate(2008, 12, 25); //Donderdag 25 December 2008  Kerstmis
    HoliDay6 := EncodeDate(2008, 12, 26); // Vrijdag 26 December 2008  2de Kerstdag
    if (TargetDay =  HoliDay1) or
        (TargetDay =  HoliDay2) or
         (TargetDay =  HoliDay3) or
          (TargetDay =  HoliDay4) or
           (TargetDay =  HoliDay5) or
            (TargetDay =  HoliDay6) then Result := 1 else Result := -1;
end;

function FindStartDate(NumDays: integer): Integer;
var
  Counter1,Counter2: integer;
begin
  Counter1 := -1;
	Counter2 := 0;
	while Counter1 < NumDays  do begin				
		if (DayofWeek(date - Counter2) > 0) and (DayofWeek(date - Counter2) < 6)
			and (NonTradingDays_NL(date - Counter2) = -1)then Counter1 := Counter1 + 1 ;
			Counter2 := Counter2 + 1;
    end;
    Result := Counter2 - 1;	
end;

var
  Direction,NumBars,DayCount,iVolumeFilter,iPriceFilter,TotalDays   : 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;
  PlotTEV                                                           : TSeries;
  SessionEndTime,xSessionEndTime,StartDate                          : TdateTime;
  SessionStartTime,xSessionStartTime                                : TdateTime;
  ShowMD                                                            : Boolean;

  aEffectiveVolume   : array[1..1440]of Real;
  aTmp               : array[1..1440]of Real;
  aPriceFilter       : 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);
  TotalDays     := CreateParameterInteger ('Total Days'      , 1   , 2000   , 10    , 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);
    PlotTEV              := CreateSeries(BarCount);


    StartDate            := date - FindStartDate(TotalDays);
    DayCount             := 0;

for i:=FirstValidIndex(close)+1 to barcount-1 do begin
 //works only on a one minute chart
   //if barinterval = bi1Minute then
   //begin

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


 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;
       aPriceFilter[Numbars] := PriceFiter;
       if Numbars = 1 then
       begin
        EffectiveVolume[i] := 0;
       end;


   if (Numbars > 1) then begin
    if (Close[i-1] - Close[i] <> 0) 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;


  if  (DayCount > 0)  then
  begin

   VolumeFilter := TotalDailyVolume * (iVolumeFilter * 0.01);
   xMidPoint    := TotalDailyEV * 0.5;

     For Counter1 := 1 to Numbars do
	   begin
	    if (aTmp[Counter1] > VolumeFilter) and (aPriceFilter[Counter1] < iPriceFilter) then
	    begin
			  aTmp[Counter1] := 0;
			  aEffectiveVolume[Counter1] := 0;
	    end;
	   end;
    //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]);
       PlotTEV[i - Counter] := round(LargeEffectiveVolume[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;
	  TotalDailyEV           := 0;
	  TotalDailyVolume       := 0
	  TotalEffVolume         := 0;
	  EffectiveVolume[i]     := 0;
	
    if not ShowMD then
    begin
     LargeEffectiveVolume[i] := 0;
	   SmallEffectiveVolume[i] := 0;
    end;
  end;  //SessionEndTime
  {*******************************LAST OPEN SESSION CALCULATION********************************************}
if (i = barcount - 1)  and (xSessionStartTime > SessionStartTime) and (xSessionEndTime <SessionEndTime) then begin

  if  (Numbars > 1)  then
  begin

    xMidPoint    := TotalDailyEV * 0.5;
    VolumeFilter := TotalDailyVolume * (iVolumeFilter * 0.01);

  	For Counter1 := 1 to Numbars do
	  begin
	   if (aTmp[Counter1] > VolumeFilter) and (aPriceFilter[Counter1] < iPriceFilter) then
	   begin
			aTmp[Counter1] := 0;
			aEffectiveVolume[Counter1] := 0;
	   end;
	  end;
	
  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]);
       PlotTEV[i - Counter] := round(LargeEffectiveVolume[i - Counter]) + round(SmallEffectiveVolume[i - Counter]);
      end;
    end;
  end;//NumBars
end;  //Session

end;  // StartDate

 //Error text
 {end else  with
 CreateText(DateTime[BarCount-1], Close[BarCount-1], 'Error: Works only on a one minute chart!')do
 begin
  Color        := clRed;;
  Font.Style   := [fsBold];
  HorzPosition := hpLeft;
  Font.Size    := 24;
 end;}
end;  //for

  with CreateLine(PlotLEV) do
  begin
    Name  := 'LEV';
    Color := clGreen;
  end;
  with CreateLine(PlotSEV) do
  begin
    Name  := 'SEV';
    Color := clRed;
  end;
  with CreateLine(PlotTEV) do
  begin
    Name  := 'TEV';
    Color := clYellow;
  end;
end.
Dit is een volume indicator, geeft volgende plaatje:

Afbeelding

Mvg,

Paul M

Willem01
Berichten: 60
Lid geworden op: di mei 08, 2007 4:32 pm

Bericht door Willem01 »

Interessante indicator

Is er iemand die in een A4tje kan uitleggen hoe het werk ?

Groet, W

PaulM
Berichten: 431
Lid geworden op: do apr 06, 2006 11:56 pm
Locatie: Enschede

Bericht door PaulM »

Willem,

De beschrijving is te vinden in dit boek:
http://www.amazon.com/Value-Time-Tradin ... roduct_top
Ook kun jij kijken op:
http://www.effectivevolume.eu/
http://www.willain.com/index.html

Paul

Janus
Berichten: 1345
Lid geworden op: wo jan 30, 2008 2:07 am
Contacteer:

Bericht door Janus »

Ook te bestellen bij Bol.com onder isbn nummer: 0470118733
.
Vriendelijke groet,
JanS ;)

Willem01
Berichten: 60
Lid geworden op: di mei 08, 2007 4:32 pm

Bericht door Willem01 »

Ok, hij heeft veel woorden nodig..

Ik lees over Float ROI en Active Boundaries

Hoe wordt die berekend ? Is daar een forumule voor ? Daar zegt hij weinig over. Bovendien gaat hij uit van een bekend aantal in omloop zijnde aandelen. Maar hoe haal je dat aantal uit Prijs en Volume info?

Groet, W

PaulM
Berichten: 431
Lid geworden op: do apr 06, 2006 11:56 pm
Locatie: Enschede

Bericht door PaulM »


Willem01
Berichten: 60
Lid geworden op: di mei 08, 2007 4:32 pm

Bericht door Willem01 »

Dag Paul

Dank.. snel..

Aha.. ben jij dan DE Paul M ?

Ik ga het verder bestuderen, het is nog niet eenvoudig om er signalen uit te destilleren..
Misschien bestaat er een korte & krachtige samenvatting ?

Groet, Willem

PaulM
Berichten: 431
Lid geworden op: do apr 06, 2006 11:56 pm
Locatie: Enschede

Bericht door PaulM »

Dag Willem,

Op http://www.effectivevolume.eu/ onder Trading EV staan pdf-bestanden.

Paul

Willem01
Berichten: 60
Lid geworden op: di mei 08, 2007 4:32 pm

Bericht door Willem01 »

Hallo

De Effecitieve Volume Indicator is gestopt met werken sinds de upgrade van het Alex software pakket
Enig idee waarom ? Hoe krijgen we het weer aan de praat ?

Groet Willem

Eric
Berichten: 3180
Lid geworden op: za sep 10, 2005 2:41 am
Locatie: Den Haag

Bericht door Eric »

Ik heb niet direct een verklaring waarom hij voorheen wel werkte, maar het probleem zat hem in de detectie van een dagovergang, ik heb deze test veranderd. Daarnaast heb de iets verbouwd aan het gebruik van de aTmp array, omdat het sorteren in TA-script erg lang duurt en dit tegenwoordig vele malen sneller kan met de ingebouwde functie SortSeries (die echter wel een TSeries verwacht).

In ieder geval lijkt hij het nu te doen.

Code: Selecteer alles

{- 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,TotalDays   : integer;
  i,iStart,Counter,Counter1,Loop                                    : integer;
  TotalDailyVolume,SPI,Size                                         : real;
  PriceInflection,TotalDailyEV,SeperationNumber                     : real;
  VolumeFilter,TotalEffVolume,xMidPoint,SeparationVolume            : real;
  PlotSEV,PlotLEV,LargeEffectiveVolume,SmallEffectiveVolume,TrueLow : TSeries;
  TrueHigh,CloseAgo,EffectiveVolume,TotalEffectiveVolume,xDayCount  : TSeries;
  PlotTEV                                                           : TSeries;
  LstDate                                                           : TDateTime;
  ShowMD                                                            : Boolean;
  sTmp, sPriceFilter, sEffectiveVolume                              : TSeries;
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);
  TotalDays     := CreateParameterInteger ('Total Days', 1, 2000, 10, 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);
  PlotTEV              := CreateSeries(BarCount);
  sTmp := CreateSeries(1440);
  sPriceFilter := CreateSeries(1440);
  sEffectiveVolume := CreateSeries(1440);

// bepaal startpunt op basis van TotalDays parameter
  i := BarCount-1;
  while (i > 0) and (iStart = 0) do
  begin
    if trunc(DateTime[i]) <> LstDate then
    begin
      DayCount := DayCount+1;
      LstDate := trunc(DateTime[i]);
      if DayCount > TotalDays+1 then iStart := i+1;
    end;
    i := i-1;
  end;
  DayCount := 0;

  for i:=iStart+1 to BarCount-1 do
  begin
    TotalDailyVolume := TotalDailyVolume + Volume[i];

    if DayCount = 0 then
    begin
      LargeEffectiveVolume[i] := 0;
      SmallEffectiveVolume[i] := 0;
    end else
    begin
      sPriceFilter[Numbars] := Abs(((Close[i] - Close[i-1])/Close[i-1])*100);
      if Numbars = 0 then
        EffectiveVolume[i] := 0
      else
      begin
        PriceInflection := Abs(Close[i] - Close[i-1]);
        Direction := Sign(Close[i] - Close[i-1]);

        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; //Numbars

      TotalEffVolume            := TotalEffVolume + EffectiveVolume[i];
      sEffectiveVolume[NumBars] := EffectiveVolume[i];
      sTmp[NumBars]             := Abs(EffectiveVolume[i]);
      TotalDailyEV              := TotalDailyEV + sTmp[NumBars];
      NumBars := NumBars + 1;
    end; //Daycount
      
/////////////////////////////////End Of Day Calculation/////////////////////////////////////////////////////
    if ((i < BarCount-1) and (trunc(DateTime[i]) <> trunc(DateTime[i+1]))) or (i = BarCount-1) then
    begin
      DayCount := DayCount+1;

      VolumeFilter := TotalDailyVolume * (iVolumeFilter * 0.01);
      xMidPoint    := TotalDailyEV * 0.5;

      for Counter1 := 0 to Numbars-1 do
      begin
        if (sTmp[Counter1] > VolumeFilter) and (sPriceFilter[Counter1] < iPriceFilter) then
        begin
          sTmp[Counter1] := 0;
          sEffectiveVolume[Counter1] := 0;
        end;
      end;
      sTmp := SortSeries(sTmp, smDescending);

      Loop := 0;
      SeperationNumber := TotalDailyEV;
      while (loop < NumBars) and (SeperationNumber >= xMidPoint) do
      begin
        SeperationNumber := SeperationNumber - sTmp[Loop];
        SeparationVolume := sTmp[Loop];
        Loop := Loop + 1;
      end;

      for Counter := Numbars-1 downto 0 do
      begin
        if abs(sEffectiveVolume[Numbars - Counter - 1]) >= SeparationVolume then
        begin
          LargeEffectiveVolume[i - Counter] := LargeEffectiveVolume[i - Counter-1] + sEffectiveVolume[Numbars - Counter-1] * Size;
          SmallEffectiveVolume[i - Counter] := SmallEffectiveVolume[i - Counter-1] + 0;
        end else
        begin
          SmallEffectiveVolume[i - Counter] := SmallEffectiveVolume[i - Counter-1] + sEffectiveVolume[Numbars - Counter-1] * 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]);
          PlotTEV[i - Counter] := round(LargeEffectiveVolume[i - Counter]) + round(SmallEffectiveVolume[i - Counter]);
        end;
      end;

      FillSeries(sEffectiveVolume, 0);
      FillSeries(sTmp, 0);
      NumBars                := 0;
      TotalDailyEV           := 0;
      TotalDailyVolume       := 0
      TotalEffVolume         := 0;
      EffectiveVolume[i]     := 0;

      if not ShowMD then
      begin
        LargeEffectiveVolume[i] := 0;
        SmallEffectiveVolume[i] := 0;
      end;
    end;
  end;

  with CreateLine(PlotLEV) do
  begin
    Name  := 'LEV';
    Color := clGreen;
  end;
  with CreateLine(PlotSEV) do
  begin
    Name  := 'SEV';
    Color := clRed;
  end;
  with CreateLine(PlotTEV) do
  begin
    Name  := 'TEV';
    Color := clYellow;
  end;
end.
---
Eric
Laatst gewijzigd door Eric op di jan 18, 2011 7:01 pm, 1 keer totaal gewijzigd.

Plaats reactie