Hi,
I'm a new MS-user and have built a really simple strategi that I want to backtest in Portfolio Backtester. The problem is that the code seems to execute just fine for the first 2,000 trades or so but leaves the last 50 trades open and I don't understand why even though they should be closed according to my ExitBars-condition. The code looks like this:
Inputs:
Price( Close ),
Length( 20 ),
NumDevs( 2 ),
ExitBars( 5 ) ;
Variables:
var0( 0 ) ;
var0 = BollingerBand( Price, Length, -NumDevs ) ;
condition1 = CurrentBar > 1 AND Price < var0 ;
If MarketPosition = 0 AND condition1 Then
Buy ( "BOLL LE" ) This Bar on Close ;
condition2 = BarsSinceEntry = ExitBars ;
If condition2 Then
Sell ( "BOLL TX" )This Bar on Close ;
Anyone has an idea why this happens?
Thanks in advance!
Portfolio Backtester leaves open trades
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Portfolio Backtester leaves open trades
Hello Sphinx,
Please verify your exit conditions:
https://www.multicharts.com/trading-sof ... t_Executed
Please verify your exit conditions:
https://www.multicharts.com/trading-sof ... t_Executed