Login Page - Create Account

Support Board


Date/Time: Mon, 03 Feb 2025 12:49:18 +0000



FlatToFlatClosedProfitLoss

View Count: 874

[2019-09-13 16:28:38]
Marmany - Posts: 308
From GetTradeListEntry s_ACSTrade both FlatToFlatMaximumOpenPositionProfit and FlatToFlatMaximumOpenPositionLoss are available but only ClosedProfitLoss is there (i.e. value for last exit).
The Trade Activity log has a FlatToFlat Profit/Loss column. Is it possible to add FlatToFlatClosedProfitLoss to s ACSTrade?
Please advise
[2019-09-16 11:05:58]
Sierra Chart Engineering - Posts: 104368
What you need to do instead is use this new function:
Automated Trading From an Advanced Custom Study: sc.GetFlatToFlatTradeListEntry()
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
[2019-11-14 21:00:36]
ForgivingComputers.com - Posts: 994
What you need to do instead is use this new function:
Automated Trading From an Advanced Custom Study: sc.GetFlatToFlatTradeListEntry()

Support: Please update this entry to include the "function it is the same as" (I assume it is sc.GetTradeListEntry).

Thanks.
[2019-11-14 21:47:49]
Sierra Chart Engineering - Posts: 104368
The documentation has been corrected.
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
[2019-11-14 23:23:00]
T44 - Posts: 363
If someone has time: How would I convert this to get the flat to flat P&L rather than the final contract which was closed in a multi lot position?

s_SCPositionData FillData;
RetVal = sc.GetTradePosition(FillData);
LastTradeProfitLoss = FillData.LastTradeProfitLoss;

Thanks.
[2019-11-15 03:39:18]
Sierra Chart Engineering - Posts: 104368
You would use this function and get the very last flat to flat trade:
Automated Trading From an Advanced Custom Study: sc.GetFlatToFlatTradeListEntry()
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
[2019-11-15 16:16:02]
ForgivingComputers.com - Posts: 994
I am testing the Get Flat to Flat TradeList using the example given for sc.GetTradeList Entry, but modifying the two function names like this:

  
  std::vector <s_ACSTrade> TradesList;

  s_ACSTrade TradeEntry;
  int Size = sc.GetFlatToFlatTradeListSize(); // <------------------ Here

  for (int Index = 0; Index < Size; Index++)
  {
    if (sc.GetFlatToFlatTradeListEntry](Index, TradeEntry)) // <----------- and Here
      TradesList.push_back(TradeEntry);
  }

  for (unsigned int TradeIndex = 0; TradeIndex < TradesList.size(); TradeIndex++)
  {
double ProfitLoss = TradesList[TradeIndex].ClosedProfitLoss;
}


My results in sim after one trade using this code do not match the ClosedPL from the Trade Activity Log. Am I doing something wrong?
attachmentTest_Flat_to_Flat_Closed_Profit.cpp - Attached On 2019-11-15 16:10:04 UTC - Size: 1.12 KB - 374 views
Attachment Deleted.
[2019-11-16 12:55:18]
Sierra Chart Engineering - Posts: 104368
Check these field values and make sure they match with the Trade Activity Log:

  SCDateTime  OpenDateTime;
  SCDateTime  CloseDateTime;
  int      TradeType;      // +1=long, -1=short
  t_OrderQuantity32_64  EntryQuantity;
  t_OrderQuantity32_64  ExitQuantity;
  double    AverageEntryPrice;
  double    AverageExitPrice;

Also refer to:
Trade Activity Log: Understanding and Setting the Start Date-Time for a Trades List
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
Date Time Of Last Edit: 2019-11-16 12:55:33
[2019-11-18 17:32:26]
ForgivingComputers.com - Posts: 994
Thanks for this. I checked the numbers and they matched. It turns out I needed to do the currency conversion for the Forex Pair.

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

Login

Login Page - Create Account