Login Page - Create Account

Support Board


Date/Time: Sat, 22 Feb 2025 08:58:45 +0000



Post From: Help with code

[2021-01-21 10:10:04]
HenKer - Posts: 8
Hi all

I'm hoping someone would be kind enough to help me with this query.

I have no coding experience at all but have come across some very useful code on here that another user used to limit his number of daily trades. I often lose serious money by over-trading so would like to apply his code so the software stops me from trading too much in a day. Could somebody please let me know what I need to do with this piece of code in order to apply it?

This is the code:

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;

This is the original thread:
Limiting # of trades per day using scGetTradeStatisticsForSymbol

Many thanks in advance!