Pascal Willain Effective Ratio

If you need an Indicator or Signal developed or translated from other language, please post all Indicator development REQUESTS to this section here.

Moderator: admin

Pascal Willain Effective Ratio

Postby logicgate » Fri Jan 04, 2019 7:28 am

I thought it was better to open a thread for this indi instead of leaving the request and possibly the indi hidden inside the thread for another indicator. (it was inside this thread viewtopic.php?f=38&t=67194)

It is based on the effective volume indi.

Effective Ratio

In his book, Pascal defines the Effective Ratio as the total Effective Volume by Large Players divided by the total volume. This results in the percentage of volume that was accumulated or distributed by large players in a specific stock.

It is the Large Players Effective Volume divided by the total volume. So you take only the LEV output from the indi (do not include the small players EV).

Effective Ratio = EMA(250)( LEV(i) / Volume(i) ) M1 charts

250 = one day

You can have two versions of the Effective Volume Ratio.

The Large Effective Volume Ratio and the Total Effective Volume Ratio (which is the sum of large and small EV).

The LEV Ratio is used for buying.

The Total EV Ratio is used for shorting or exiting long position.
logicgate
FXCodeBase: Aspirant (Junior)
 
Posts: 680
Joined: Tue Dec 11, 2018 7:54 am

Re: Pascal Willain Effective Ratio

Postby Apprentice » Sat Jan 05, 2019 5:48 am

We do NOT have LEV data available
Effective Ratio = EMA(250)( EV(i) / Volume(i) )
I can write EV version only.
Effective Ratio = EMA(250)( EV(i) / Volume(i) )
Will this be ok?
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Pascal Willain Effective Ratio

Postby logicgate » Sat Jan 05, 2019 6:31 am

But dear friend Apprentice, how come? Here in the indi code it shows clearly it plots to different lines: The LEV and the SEV (large players and small players), and if you combine both, you get the Total effective volume.

For the large effective ratio you use the data of LEV only, for small effective ratio you use the data of SEV only, and you can also have the total effective ratio using the sum of both.

Code: Select all
{- 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 http://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.
logicgate
FXCodeBase: Aspirant (Junior)
 
Posts: 680
Joined: Tue Dec 11, 2018 7:54 am

Re: Pascal Willain Effective Ratio

Postby logicgate » Sat Jan 05, 2019 6:33 am

You can code a new Effective Vollume for MT4 using this formula? The other one here shows only one line.
logicgate
FXCodeBase: Aspirant (Junior)
 
Posts: 680
Joined: Tue Dec 11, 2018 7:54 am

Re: Pascal Willain Effective Ratio

Postby logicgate » Sat Jan 05, 2019 6:37 am

Check this code, this one is even better it plots three lines (Total, Small and Large)

Code: Select all
{- 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 http://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.
logicgate
FXCodeBase: Aspirant (Junior)
 
Posts: 680
Joined: Tue Dec 11, 2018 7:54 am

Re: Pascal Willain Effective Ratio

Postby logicgate » Sat Jan 05, 2019 6:40 am

You see? This last code I posted plots 3 lines with different colors, one for total, one for large players and one for small players.
logicgate
FXCodeBase: Aspirant (Junior)
 
Posts: 680
Joined: Tue Dec 11, 2018 7:54 am

Re: Pascal Willain Effective Ratio

Postby Apprentice » Sun Jan 06, 2019 6:48 am

Your request is added to the development list under Id Number 4409
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Pascal Willain Effective Ratio

Postby Apprentice » Mon Jan 07, 2019 5:27 pm

Try this version.
Effective Volume.mq4
(9.33 KiB) Downloaded 434 times
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Return to Indicator and Signal Requests

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 12 guests