Backtest reports and scaling-in questions

I am simply using:
SetPositionSize( 1000, spsValue );
to set all of my entries and scale-ins to 1000 dollars per trade.

I am testing this scale-in strategy just on AAPL and studying the detailed backtest report. Why does it show my available cash shrinking way beyond the $3000 allocated to these 3 trades?
image

I've read you have to look at the detailed reports to see exactly what is going on within the scaling-in process, but on the TradeList report why does it show my positions iterating in backwards? See in the following snapshot the PositionValue column and Scale-In/Out seem to be going backward against the dates that I actually scaled in?
image

It is kind of hard to see those snapshots. Here is another one. See how the dates are ascending, yet the Positiion Value and Scale In/Out columns are descending? Why is this?

image

I think you answered your own question. You set the position size to $1000 for each trade and scale in. Based on the detailed report, you open one new position ($1000). Then you scale-in on that position (+$1000) and open a second new position ($1000), so now you have 2 positions with a total value of around $3000. Then you scale in to each of the first two trades (+$1000 and +$1000) and open a third trade (+$1000). Now your total value of open trades is approximately $6000.

This also explains the order of the trades in your trade list. The earliest trades opened are the ones that have the most scale-ins. All of this is driven by your own logic and the use of sigScaleIn.

4 Likes

Wait, I just want to buy $1000 worth, then if it goes down a little, buy another $1000 worth, and if it goes down a little more buy another $1000 worth, etc. Never increasing the size from one buy to the next. I'm a little confused. I do it like this:

Buy = myEntryCondition;
Sell = TradeExitCondition;

buy = ExRem( buy, LegacyExitCondition );
sell = ExRem( Sell, buy ); 

InLong = Flip( Buy, Sell );

DoScaleIn = IIf(InEntryNum == 2, ExRem( InLong AND Legacy2EntryCondition, Sell ),
				IIf(InEntryNum == 3, ExRem( InLong AND Legacy3EntryCondition, Sell ),
				IIf(InEntryNum == 4, ExRem( InLong AND Legacy4EntryCondition, Sell ),
				IIf(InEntryNum == 5, ExRem( InLong AND Legacy5EntryCondition, Sell ),
				IIf(InEntryNum == 6, ExRem( InLong AND Legacy6EntryCondition, Sell ), 
				IIf(InEntryNum == 7, ExRem( InLong AND Legacy7EntryCondition, Sell ),
				0 ))))));

printf( " DoScaleIn: " + NumToStr(  DoScaleIn ) + "\n" ); 

Buy = sigScaleIn * DoScaleIn; 

SetPositionSize( 1000, spsValue );

What am I doing something wrong here?

Ahhhh, after rereading your post Matt, I figured I would change this:
Buy = sigScaleIn * DoScaleIn;
to
Buy = DoScaleIn;

and now it evenly buys $1000 / entry.

Thank you