Output bar-by-bar PL% to a file
Author: daivd_leake
Creation Date: 8/29/2016 8:56 AM
profile picture

daivd_leake

#1
Hi -

I would like to output the bar-by-bar PL (and preferably inclusive of commissions). Where the sum of this bar-by-bar PL column would just equal the net PL for the time period

I am using setShareSize to determine position size within the strategy

I've tried with the following code inside the bar loop, however this doesn't equal the total net PL

Anything suggestions on how to achieve this?

Thanks
David

CODE:
Please log in to see this code.


profile picture

Eugene

#2
QUOTE:
(and preferably inclusive of commissions)

This is not an option. As you can find in the QuickRef, NetProfitAsOfBar returns the profit excluding commissions.
profile picture

daivd_leake

#3
Ok... is it possible including Commissions?
profile picture

Eugene

#4
No. Like I just mentioned in a different thread, position sizing is an overlay that kicks in after your Strategy has finished executing all theoretical trades in Raw Profit mode with 1 share. So, no to commissions, position sizing, slippage etc. That's by design.
profile picture

daivd_leake

#5
To frame this so my question is perhaps clearer, as I think we're getting wires crossed here

Is it possible to extract an equity curve on a bar-by-bar basis? (Gross, non-position sized, etc - whatever the required permutation looks like!)




profile picture

Eugene

#6
I admit I should've been more precise. In addition to saying "no" to "commissions, position sizing, slippage etc.", I should've also mentioned equity curve (cash curve, drawdown curve etc). You could find the whys and whereabouts in the Wiki FAQ and several forum posts by Cone and yours truly.

To extract an equity curve, right-click on the Equity tab (or MS123 Visualizers tabs that support it), select "Copy Equity Curve Data to Clipboard".

Side note: why would you want to do it? We've got all sorts of performance visualizers to double up your analysis power.
profile picture

daivd_leake

#7
To run any standard portfolio optimisation (weights across assets, strategies) you need to input returns over time

So my preference is to avoid doing this manually across larger portfolios or parameters

If this doesnt exist, then fine - but I do think it's a natural question to ask - apologies if it annoyed you!
profile picture

Eugene

#8
It may be possible to achieve one way or another but to get there first I had to understand your objective. So if you're after exporting an equity curve (returns over time) programmatically then you might consider taking a look at this non-standard technique:

Interacting Dynamically with Portfolio Level Equity
profile picture

daivd_leake

#9
Thanks