Open PnL of Portfolio trader

Questions about MultiCharts .NET and user contributed studies.
lewisthegood
Posts: 21
Joined: 08 Mar 2021
Been thanked: 1 time

Open PnL of Portfolio trader

Postby lewisthegood » 21 Oct 2021

I have instrument "A" with Signal 1 assigned with it, and instrument "B" with Signal 2 assigned with it. instrument "B" will always enter into the opposite direction from instrument "A" in order to hedge the trade. However, I do not how to show the whole portfolio's open PnL in C# (MC.NET). I can only find something like: " StrategyInfo.OpenEquity - StrategyInfo.ClosedEquity " which return the open PnL from the "Strategy". However, what I need is the open PnL of the whole portfolio across the Portfolio Trader (Net Net of the open PnL in Portfolio Trader). Any tips please.

User avatar
Svetlana MultiCharts
Posts: 645
Joined: 19 Oct 2017
Has thanked: 3 times
Been thanked: 163 times

Re: Open PnL of Portfolio trader

Postby Svetlana MultiCharts » 22 Oct 2021

Hello lewisthegood,

Please use Portfolio.OpenPositionProfit.

Code: Select all

using System; using System.Drawing; using System.Linq; using PowerLanguage.Function; using ATCenterProxy.interop; namespace PowerLanguage.Strategy { public class Portfolio_OpenPositionProfit : SignalObject { public Portfolio_OpenPositionProfit(object _ctx):base(_ctx){} protected override void Create() {} protected override void StartCalc() {} protected override void CalcBar() { Output.WriteLine(" OpenPositionProfit {0}", Portfolio.OpenPositionProfit); } } }

lewisthegood
Posts: 21
Joined: 08 Mar 2021
Been thanked: 1 time

Re: Open PnL of Portfolio trader

Postby lewisthegood » 22 Oct 2021

thank you


Return to “MultiCharts .NET”