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
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.