Flexible Position Sizing based on ROC

Hi,

I try to implement a flexible position sizing method in an EOD system and couldn't find anything related in the forum, so I created this new topic. To calculate the position size for every new position I use the formula below:

maxPos = 10;
possize_periodsshort =21; 
possize_periodsmid =  126; 
possize_periodslong =  252; 
maxPercentage = IIF(ROC(c, possize_periodsshort)>0,100/3,0) + IIF(ROC(c, possize_periodsmid)>0,100/3,0) + IIF(ROC(c, possize_periodslong)>0,100/3,0);
SetPositionSize(maxPercentage/maxPos,spsPercentOfEquity);

Unfortunately, I’ve the bad feeling, that the system snoops into the future and set the position size based on the trade and not on the signal period. So I changed the formula using Ref().

maxPercentage = IIF(Ref(ROC(c, possize_periodsshort),-1)>0,100/3,0) + IIF(Ref(ROC(c, possize_periodsmid),-1)>0,100/3,0) + IIF(Ref(ROC(c, possize_periodslong),-1)>0,100/3,0);

The results drop significantly.
I would appreciate your expertise on whether my suspicions regarding snooping are correct or not. Any other hints are always welcome. :slight_smile:

Thanks,
Torsten

  1. In the formula window, Tools => code check will test for future leak.
  2. Check your buyprice = close if entering EoD.
  3. Plot your entry and exit signals on the chart so you can visualize what's happening
PlotShapes( Buy * shapecircle, colorlime, 0, L-ATR(1));
PlotShapes( BuyPrice * shapsmallecircle, colorwhite, 0, L-ATR(1));
2 Likes

Hi C_M,

thanks for the hints, found the error.