I am trying to set my initial position size to 100 shares. if additional
conditions are met, I want to add 200 shares, 300 shares, and 400 shares.
I can't get this code to work...it will only do equal amounts of shares for
each sigscalein.
Can someone PLEASE help?
SetPositionSize(100,spsShares);
Buy=buy rule
Sell=sell rule
priceatbuy=0;
enter = 0;
for( i = 0; i < BarCount; i++ )
{
if( priceatbuy == 0 AND Buy[i] )
{
priceatbuy = BuyPrice[i];
}
if( priceatbuy > 0 )
{
if( enter == 2 AND Close[i] < priceatbuy)
{
// add to your position
enter = 3;
Buy[i] = sigScaleIn;
// SetPositionSize(400,spsShares);
}
if( enter == 1 AND Close[i] < priceatbuy)
{
// add to your position
enter = 2;
Buy[i] = sigScaleIn;
// SetPositionSize(300,spsShares);
}
if( enter == 0 AND Close[i] < priceatbuy)
{
// add to your position
enter = 1;
Buy[i] = sigScaleIn;
// SetPositionSize(400,spsShares);
}
if( Sell[i] )
{
Buy[ i ] = 0;
enter = 0;
priceatbuy = 0; // reset price
}
}
}