Login Page - Create Account

Support Board


Date/Time: Thu, 12 Feb 2026 07:19:41 +0000



[Programming Help] - Position Data Empty

View Count: 17

[2026-02-11 21:07:59]
Gradient - Posts: 197
Hi,

I'm attempting to sum the PnL for different symbols across different charts.

I created a s_PositionData structure for each symbol.

I've noticed that the PnL for the chart that the study is applied to has the correct PnL, but the PnL for the opposite chart is incorrect.

For example,

Given 2 charts, A and B, each chart is performing the same calculation. The PnL for each respective chart is correct but each chart's calculation of the opposite chart's PnL is incorrect.

This underspecifies the total pnl (i.e. sum of both charts PnL)

I've attached a screenshot of the issue.

In the screenshot, Pos represents the open quantity for the current symbol, PnL is the total pnl across each symbol(i.e. each chart), CPnL is the current symbol's pnl, OPnL is the pnl for the other chart's symbol.

Given that PnL(i.e. total pnl) is the sum of CPnL(current chart's pnl) and OPnL(other chart's pnl), it's apparent that the OPnL is zero.

How can this be?

Also, OpenPnL is some extremely large number that is incorrect.


Code Snippet

SCString otherSymbol=sc.GetChartSymbol(otherChartID.GetInt());

//Declare Position Data Structures
s_SCPositionData PositionData;
s_SCPositionData otherPositionData;

//Initialize Position Data Structures
sc.GetTradePosition(PositionData);
sc.GetTradePositionForSymbolAndAccount(otherPositionData,otherSymbol,sc.SelectedTradeAccount);

//Declare PnL Variables
double pnlTotal;
double currentSymbolPnL;
double OpenPnL;
double otherSymbolPnL;

OpenPnL=PositionData.TradeStatsOpenProfitLoss;
currentSymbolPnL=PositionData.DailyProfitLoss;
otherSymbolPnL=otherPositionData.DailyProfitLoss;
pnlTotal=currentSymbolPnL+otherSymbolPnL;

//STORING CURRENT POSITION QUANTITY
sc.Subgraph[52][sc.Index]=PositionData.PositionQuantity;
  
//STORING PNL TOTAL
sc.Subgraph[53][sc.Index]=pnlTotal;
  
//STORING CURRENT AND OTHER SYMBOL PNL
sc.Subgraph[54][sc.Index]=currentSymbolPnL;
sc.Subgraph[55][sc.Index]=otherSymbolPnL;
Date Time Of Last Edit: 2026-02-11 22:02:59
imageSierra Other Symbol Position Data Error.png / V - Attached On 2026-02-11 21:07:53 UTC - Size: 4.32 KB - 7 views

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account