Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 18:37:29 +0000



ACSIL function for Daily Total P/L for all symbols

View Count: 2069

[2018-10-09 09:47:41]
Marmany - Posts: 307
Using
s_ACSTradeStatistics TradeStatistics;
sc.GetTradeStatisticsForSymbol(0, 1, TradeStatistics);
int DailyTotalPL = TradeStatistics.ClosedProfitLoss();
Generates the Daily P&L for only the current symbol.
I require Daily P&L for Closed Trades for all symbols traded on the chart. The value is available on the Trade Statistics tab of the Trade Activity Log (1st row, RH column), but I find no way of accessing in ACSIL.

Please advise.
[2018-10-09 15:17:19]
Sierra Chart Engineering - Posts: 104368
This is definitively not supported. A chart is only for one symbol.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2018-10-09 16:24:05]
Marmany - Posts: 307
During the day I change symbols e.g. Dax AM and NQ PM, and base some strategy elements on total P&L for all symbols.
The value is displayed by the Trading Profit Management Status Study.

As the value is already calculated for display under the Trade Statistics tab of the Trade Activity Log I was hoping that you could enable access via an ACSIL function.
[2020-09-24 18:20:29]
User36703 - Posts: 29
I would be also very happy if developers could implement this. Would be great for risk management features.
[2020-09-25 06:08:10]
Marmany - Posts: 307
For info, I currently control overall position via Global Profit / Loss Management and using the Trading Profit Management Study to display the value on chart.
[2020-09-25 19:52:17]
Sierra Chart Engineering - Posts: 104368
Currently there is this function:
sc.GetTotalNetProfitLossForAllSymbols

Documentation:
sc.GetTotalNetProfitLossForAllSymbols()
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2020-09-26 18:06:29]
User100912 - Posts: 104
This code works for me:

#include "sierrachart.h"
SCDLLName("Daily PL")
/*==========================================================================*/
SCSFExport scsf_DailyPL(SCStudyInterfaceRef sc)
{
  SCSubgraphRef Subgraph_StatusText = sc.Subgraph[0];

  SCInputRef Input_HorizontalPosition = sc.Input[0];
  SCInputRef Input_VerticalPosition = sc.Input[1];
  SCInputRef Input_DrawAboveMainPriceGraph = sc.Input[2];
  SCInputRef Input_TransparentLabelBackground = sc.Input[3];

  if (sc.SetDefaults)
  {
    // Set the configuration and defaults

    sc.GraphName = "Daily PL";
    sc.AutoLoop = 0;//Manual looping
    sc.GraphRegion = 0;
    sc.ValueFormat = 0;

    Subgraph_StatusText.Name = "Status Text";
    Subgraph_StatusText.LineWidth = 10;
    Subgraph_StatusText.DrawStyle = DRAWSTYLE_CUSTOM_TEXT;
    Subgraph_StatusText.PrimaryColor = RGB(255, 255, 255);
    Subgraph_StatusText.SecondaryColor = RGB(0, 0, 160);
    Subgraph_StatusText.SecondaryColorUsed = true;
    Subgraph_StatusText.DisplayNameValueInWindowsFlags = 1;

    Input_HorizontalPosition.Name.Format("Initial Horizontal Position From Left (1-%d)", (int)CHART_DRAWING_MAX_HORIZONTAL_AXIS_RELATIVE_POSITION);
    Input_HorizontalPosition.SetInt(20);
    Input_HorizontalPosition.SetIntLimits(1, (int)CHART_DRAWING_MAX_HORIZONTAL_AXIS_RELATIVE_POSITION);

    Input_VerticalPosition.Name.Format("Initial Vertical Position From Bottom (1-%d)", (int)CHART_DRAWING_MAX_VERTICAL_AXIS_RELATIVE_POSITION);
    Input_VerticalPosition.SetInt(90);
    Input_VerticalPosition.SetIntLimits(1, (int)CHART_DRAWING_MAX_VERTICAL_AXIS_RELATIVE_POSITION);

    Input_DrawAboveMainPriceGraph.Name = "Draw Above Main Price Graph";
    Input_DrawAboveMainPriceGraph.SetYesNo(false);
    
    Input_TransparentLabelBackground.Name = "Transparent Label Background";
    Input_TransparentLabelBackground.SetYesNo(false);

    

    return;
  }


  // Do data processing
  SCString TextToDisplay;
  double PL = 0;
  PL = sc.GetTotalNetProfitLossForAllSymbols(1);
  TextToDisplay.Format("%.2f", PL);

  int HorizontalPosition = Input_HorizontalPosition.GetInt();
  int VerticalPosition = Input_VerticalPosition.GetInt();

  int DrawAboveMainPriceGraph = Input_DrawAboveMainPriceGraph.GetYesNo();
  int TransparentLabelBackground = Input_TransparentLabelBackground.GetYesNo();

  sc.AddAndManageSingleTextUserDrawnDrawingForStudy(sc, false, HorizontalPosition, VerticalPosition, Subgraph_StatusText, TransparentLabelBackground, TextToDisplay, DrawAboveMainPriceGraph, 0);
  

}

Date Time Of Last Edit: 2020-09-26 18:08:28
[2020-10-01 12:22:57]
User36703 - Posts: 29
Thank you very much, now it works. I just need to set int variable to 1 - sc.GetTotalNetProfitLossForAllSymbols(1) which means one day.
[2021-04-13 11:37:56]
User36703 - Posts: 29
Is there any simple ACSIL function which tracks only closed PNL for specified time period for all symbols? Thank you.

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

Login

Login Page - Create Account