I am testing a system in which one particular position is scaled in/out daily 
to achieve a given target value on the Close.  The results of my scaling aren't 
as accurate as the test requires.

I am using the custom backtester and start the scaling after executing all 
other entry/exit signals and after calling updatestats(bar,1).

At that point, I find the open position to be scaled (call it openpos) and use 
openpos.getpositionvalue() to determine the current value of that postiion.

Last, I scale the position with:

bo.scaletrade   
(bar, 
openpos.symbol, 
new _value > openpos.getpositionvalue(),
openpos.getprice(bar,“c”),
abs(new_ value - openpos.getpositionvalue()
);

where new_value is the target value for the position on the Close and comes 
from calculations earlier in the test.

The actual value of the position after the Close (and updatestats(bar,2)) is 
usually different from new_value by something in the range of +/- 2%.  This is 
with roundlotsize and commissions set to zero, and a very largin margin 
allowance so that the position is not capped.

That's not bad, but probably not good enough for the purpose of this test.

Any suggestions on how to hone the scaling so that I get within +/- 0.5% of the 
target value?


Thanks,
David






Reply via email to