Count number trade in a system.

Login or Register

Please login or register in order to view and post in the Forum.

2 posts / 0 new
Last post
robmak
Last seen: 4 years 10 months ago
Joined: 07/30/2014 - 16:18
Count number trade in a system.

Hello, I'm trying to code a breakout system. Is there a way to limit the amount of trades from the break out. Let's say i only want to do 5 round turns either short/long for the day. After this limit it stops.
Is there a token that keeps track of the number of trades in a day?

Thanks

0
Eddy_F
Last seen: 2 months 1 week ago
Joined: 07/30/2014 - 16:18
Trade Number Token (TNUM)

Hi,
the token you need is TNUM, it will count how many trade you have entered since the start of the backtest (see definition below)
If you want to limit the number of trade to 5 per day, then
1) at the first bar of the day (POS=1), you need to save the current TNUM into V#1 set(V#1,TNUM)
2) in the trade confirmation rule, you need to add something like
Entry rule = true and TNUM < (V#1+5)

Here an old example of TNUM (used to restrict the number of trade to 1 per day..)
https://www.linnsoft.com/articles/tutorial-backtesting-entries-exits-tar...

Cheers
Eddy

New Backtesting RTL Token TNUM (Trade Number)
The RTL token TNUM can be used in a Trading Signal to determine, during backtesting, how many trades have been entered into for the instrument being backtested. TNUM will be zero at the beginning of the backtest for each instrument indicating no trades have taken place yet. Each entry into a new long or new short position will cause TNUM to be incremented by one. If a "Buy More" or "Sell More" rule is triggered to add to an existing position, TNUM is not incremented. This token enables a trading system to consider whether any trades have yet been executed during the backtest of the instrument and/or how many trades the system has triggered thus far.