Login Page - Create Account

Support Board


Date/Time: Sat, 22 Feb 2025 08:32:25 +0000



Limiting # of trades per day using scGetTradeStatisticsForSymbol

View Count: 1769

[2019-07-29 00:44:13]
Yoda - Posts: 106
Using https://www.sierrachart.com/index.php?page=doc/ACSIL_Members_Functions.html#scGetTradeStatisticsForSymbol I'm trying to set the maximum number of trades per day. I have the following code which works if each trade only has one entry and one exit:

s_ACSTradeStatistics TradeStatistics;
sc.GetTradeStatisticsForSymbol(0, 1, TradeStatistics);
int DailyTotalTrades = TradeStatistics.TotalTrades();
int DailyTotalShortTrades = TradeStatistics.TotalShortTrades;
int DailyTotalLongTrades = TradeStatistics.TotalLongTrades;

// Allow up to 4 trades per day
if (DailyTotalTrades < 4 && DailyTotalShortTrades < 4 && DailyTotalLongTrades < 4)
  // Then okay to trade;

However, as soon as as trade has multiple targets / stops, SC counts each target/stop hit has a trade. So for example, my code stops trading for the day if the first trade of the day hits 4 targets.

I'd like for SC to ignore the multiple child trades and only count the parent trade. Any suggestions on how I can do this?
[2019-07-29 17:26:33]
Sierra Chart Engineering - Posts: 104368
We are going to add new Flat to Flat statistics, to that structure which you can then use. For the definition of a flat to flat trade, refer to:
Trade Activity Log: Order Fill Matching and Flat to Flat Definition

The other thing is that when you use multiple targets and stops, just simply increase the number of trades that will cause the trading to stop based upon the number of targets you have.
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-07-29 18:25:23]
Yoda - Posts: 106
We are going to add new Flat to Flat statistics

That is great thank you.

when you use multiple targets and stops, just simply increase the number of trades

Good thought, however when I tried that it didn't work because not all trades hit their targets. So for example, if I wanted to allow 4 flat-to-flat trades and each of these trades had 4 targets (ignoring stops for a moment), I set the max # of trades to 16. But then I found that some trades immediately stopped out. Others only hit 1 or 2 targets before stopping out. The end result was this method proved unreliable and I ended up exceeding the max # of trades.
[2021-01-05 21:52:18]
HenKer - Posts: 8
Hey Yoda
I've been looking for exactly this kind of thing for a long time. I'd love to use the code but I've got no idea where to use it.
Would be great if someone could tell me what I have to do on Sierra Chart in order to load this code and for it to work.
Many thanks!

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

Login

Login Page - Create Account