Login Page - Create Account

Support Board


Date/Time: Fri, 14 Mar 2025 11:14:30 +0000



Post From: Bug in sc.GetFlatToFlatTradeListEntry()

[2022-04-11 19:05:28]
Trader & Sierra++ developer - Posts: 110
I confirm the issue.

I tried with a dedicated test study (code below), on different symbols, and using both trade simulation mode and a 'real' trading service (SC trade simuator service with a freshly created account).

The following sequence gives no way to know if the current ftf trade is open or closed :
BUY => TradeQty=1, MaxOpenQty=1, MaxClosedQty=0
BUY => 2/2/0
SELL => 2/2/1
BUY => 3/2/1
SELL => 3/2/2
SELL => 3/2/2 = same as previous

Here is my code for testing :


#define _LOG_M(...) {SCString msg;msg.AppendFormat(__VA_ARGS__);sc.AddMessageToLog(msg, 0);}

SCSFExport scsf_Test(SCStudyInterfaceRef sc){
  if (sc.SetDefaults){
    sc.FreeDLL = 1;
    sc.GraphName = "Test";
    sc.AutoLoop = 0;
    sc.MaintainTradeStatisticsAndTradesData = true;
    sc.GraphRegion = 0;
    return;
  }

  int size = sc.GetFlatToFlatTradeListSize();
  _LOG_M("starting loop %d", size);
  for (int i = size; i > 0; i--){
    s_ACSTrade currTrade;
    if (sc.GetFlatToFlatTradeListEntry(i-1, currTrade))
      _LOG_M("q=%.2f moq=%.2f mcq=%.2f", currTrade.TradeQuantity, currTrade.MaxOpenQuantity, currTrade.MaxClosedQuantity);
  }
}

I guess there should be another field to give that information as in the Trade Activity Log.
Date Time Of Last Edit: 2022-04-11 19:07:01