Login Page - Create Account

Support Board


Date/Time: Sun, 06 Jul 2025 01:42:38 +0000



[Programming Help] - ASCIL Trade Statistics

View Count: 77

[2025-06-29 15:54:19]
Gradient - Posts: 154
Hi,

I have a couple questions regarding accessing PnL and other Statistics via ACSIL.

Is this information isolated to the live environment?

I've run backtests that use the sc.GetTradeStatisticsForSymbolV2 to monitor the running PnL for the purpose of setting a daily limit and periodically this limit is breached.

For Example:
n_ACSIL::s_TradeStatistics TradeStatistics;
  if (sc.GetTradeStatisticsForSymbolV2(n_ACSIL::STATS_TYPE_DAILY_ALL_TRADES, TradeStatistics))
  {

     pnl= TradeStatistics.ClosedTradesProfitLoss;
  }
  
  if(pnl <= -dailyDrawdown.GetFloat()){
    
    
     symbolLimit=1;
     sc.SetAlert(1,"Symbol Limit Met");
  }
  

I've also used the sc.GetTotalNetProfitLossForAllSymbols method as a means of managing exposure across multiple instruments and it too doesn't appear to be working properly during backtesting.

For Example:
double pnl;
int& accountLimit=sc.GetPersistentInt(0);

  if (sc.IsFullRecalculation){
          
    sc.GetPersistentInt(0)=0;
          
        
    }
  
  pnl=sc.GetTotalNetProfitLossForAllSymbols(1);
  
  if(pnl <= -accountDrawdown.GetFloat()){
    
    
    accountLimit=1;
    sc.SetAlert(1,"Account Limit Met");
  }


I checked the documentation here:ACSIL Interface Members - Functions: sc.GetTradeStatisticsForSymbolV2()

which states to see this link:Automated Trading From an Advanced Custom Study for more information on the method;

but these links create a circular reference, they're just pointing to each other.

Can someone provide a link to the documentation for retrieving Statistics in both live and simulated trading?
Date Time Of Last Edit: 2025-06-29 15:55:13
imageStatistics Circular Reference.png / V - Attached On 2025-06-29 15:52:47 UTC - Size: 11.09 KB - 9 views
[2025-06-29 22:40:03]
Gradient - Posts: 154
I ran some additional tests.

The PnL is being computed properly albeit minus commissions but trades are still being taken despite the PnL being at the daily limit.

Running additional tests. Possible that some method is being called on a lag.

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

Login

Login Page - Create Account