I am trying to figure out how Strategy Analzyer is calculating cumulative profit. I am using a multi-instrument strategy, which is why this question is more difficult than it might appear.
Here is the setup:
V - initial account value
Ea, Eb, Ec: entry prices for stocks A, B, C
Xa, Xb, Xc: exit prices for stocks A, B, C
Na, Nb, Nc: quantities traded for stocks A, B, C
Now assume that I am trading as follows:
Na = V/3/Ea
Nb = V/3/Eb
Nc = V/3/Ec
I will have the following profit:
P = Na * (Xa - Ea) + Nb * (Xb - Eb) + Nc * (Xb - Ec)
The relative cumulative profit should therefore be:
Pr = P / V
Of course the backtester does not know what V was, so there is a difficulty in specifying this. This is where AccountSize *should* come in, but NinjaTrader ignores that during backtesting.
What I can see from the Strategy Analyzer's summary page is that my strategy was resulting in $4,751.66 of total net profit. My original account value was $20,000 - resulting in a relative cumulative profit of $4,751.66 / $20,000 = 23.8%
What Strategy Analyzer is reporting is 165.41%. I have no idea how it created that number and what I notice is that this number does not change, regardless of the initial account value I set inside my strategy. What I feel might be happening, is that it relative profit is calculated per trade as follows:
(Xa - Ea) / Ea * (Xb - Eb) / Eb * (Xc - Ec) / Ec
Unfortunately, this is of no use to me. I need relative cumulative profit as well as all reports in Strategy Analyzer referenced to my initial account value.
Questions:
* can you please explain/confirm to me, how the Strategy Analyzer calculates cumulative profits?
* is there any way to change that behavior?
I am seeing much more issues in creating a multi-instrument strategy with NinjaTrader's. Is my use-case something you were not targeting with NinjaTrader?
Thank you,
best regards, Felix
Comment