Portfolio Backtester leaves open trades

Questions about MultiCharts and user contributed studies.
Sphinx
Posts: 1
Joined: 27 Aug 2014

Portfolio Backtester leaves open trades

Postby Sphinx » 27 Aug 2014

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!

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Portfolio Backtester leaves open trades

Postby Henry MultiСharts » 27 Aug 2014

Hello Sphinx,

Please verify your exit conditions:
https://www.multicharts.com/trading-sof ... t_Executed


Return to “MultiCharts”