Hi,
I am using CBT in amibroker. I don't know how to sclale in 1 share to my open position (short or long).
I could't find any answer to this question online.
SetUp = IIf(BuyScale, 1, IIf(ShortScale, -1, 0));
StaticVarSet(Name() + "SetUp", SetUp);
//Custom Backtest.......
for (Openpos = bo.getfirstopenpos(); Openpos; Openpos = bo.getnextopenpos())
{
ScaleSetUp = StaticVarGet(openPos.Symbol + "SetUp");
if (OpenPos.IsLong AND ScaleSetUp[bar] > 0)
{
bo.ScaleTrade(bar, openPos.Symbol, openPos.IsLong(), pClose, ?1share);
}
else if (!OpenPos.IsLong AND ScaleSetUp[bar] < 0)
{
bo.ScaleTrade(bar, openPos.Symbol, openPos.IsLong(), pClose, ?1share);
}
}