I'm trying to backtest a system right now and I want to limit my trades per day to a certain number. Does anyone know how I can do that? I have been trying: Inputs: MaxTrade(2); Var: TradeCount(0); If marketposition <> 0 then TradeCount = TradeCount + 1; If time = 1300 then TradeCount = 0: {to reset to zero everyday} {Before my entry instructions} If marketposition = 0 and TradeCount < MaxTrades then begin It doesn't seem to be working. Depending on where I put the first "if" statement in my code it either does only one trade per day always or does too many trades per day. Can anyone offer some help? Also, does anyone know how to program to trail and stop out below the last low? Thanks
If marketposition <> 0 then TradeCount = TradeCount + 1; You're adding a value on each bar when a position is open.
Thanks for the help. I went to the tradestation forums and found the answer. It is a simple function called "EntriesToday". And now I also understand why my try with TradeCount = TradeCount + 1 wasn't working. Thanks!
EasyLanguage has a lot of really useful variables - I like that EntriesToday one. CurrentContracts (or CurrentShares) is also handy when using multiple exits. There are a couple functions you might look at too, including ExitOnClose, SetStopLoss, and SetPercentTrailing. They execute intra-bar so they are handy. Chabah