CurrentPosition.Profit always zero  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
novaleaf
Posts: 49
Joined: 17 Apr 2014
Has thanked: 9 times
Been thanked: 4 times

CurrentPosition.Profit always zero

Postby novaleaf » 07 May 2015

Hi I'm trying to construct my first strategy. I think I have figured out the way "managed orders" work now (always needing to emit the currently desired position) however I am wondering why CurrentPosition.Profit is always zero.

According to the Programmer Guide PDF:
CurrentPosition.Profit = CurrentPosition.OpenProfit – current OpenPL upon the open position or 0, if the position is closed.
CurrentPosition.ProfitPerContract – current OpenPL upon the open position per contract or 0, if the position is closed.
However my position is not closed. Indeed CurrentPosition.ProfitPerContract shows a value. Here is some example debug output of my CurrentPosition during a backtest (add strategy to a chart of SPY)

Code: Select all

CurrentPosition.Profit = 0
CurrentPosition.ProfitPerContract = 0.61
StrategyInfo.AvgEntryPrice = 210.33
CurrentPosition.OpenLots = 47
What am I doing wrong? Do I need to hook up a backtesting trading platform or something?

Thank you for your time,

-Jason

novaleaf
Posts: 49
Joined: 17 Apr 2014
Has thanked: 9 times
Been thanked: 4 times

Re: CurrentPosition.Profit always zero

Postby novaleaf » 07 May 2015

OK, the PDF doc is wrong.


I just output the value of CurrentPosition.OpenProfit and it is NOT zero. The two values (Profit and OpenProfit) are not the same.

I assume that Profit must be "closed profit".

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: CurrentPosition.Profit always zero  [SOLVED]

Postby Henry MultiСharts » 08 May 2015

Hello Jason,

CurrentPosition.Profit - always 0 (open position has no realized profit/loss).
CurrentPosition.OpenProfit – current OpenPL for the open position, returns 0 if position is closed.

I have updated the Wiki. The updated PDF will be uploaded soon.


Return to “MultiCharts .NET”