- ago
Steps to reproduce:
1. Add the following two parameter settings ("AddParameter()") to (any) trading strategy like so:
( I used "Gap Closer" )

CODE:
using WealthLab.Backtest; using WealthLab.Core; using System.Linq; namespace WealthScript1 {    public class GapCloser : UserStrategyBase    {       public GapCloser() : base()       {          AddParameter("Entry Limit %", ParameterType.Double, 4.0, 0.5, 5.0, 0.1); // 0          AddParameter("RSI Limit", ParameterType.Double, 50.0, 50.0, 100.0, 0.1); // 1       }       public override void Initialize(BarHistory bars)       {          gapSize = 2.5;          longOnly = true;          lastCompleteBar = bars.Count - 1;          StartIndex = 1;       }       public override void Execute(BarHistory bars, int idx)       {          if (idx < lastCompleteBar)          {             openTradeBar = bars.Open[idx + 1];             gapDown = bars.Low[idx] - openTradeBar;             gapUp = openTradeBar - bars.High[idx];             if (gapUp > gapSize) gapsUp++;             if (gapDown > gapSize) gapsDown++;          }          else          {             PlaceTrade(bars, TransactionType.Buy, OrderType.Limit, bars.Low[idx] - 0.01);             PlaceTrade(bars, TransactionType.Short, OrderType.Limit, bars.High[idx] + 0.01);          }                                if (gapDown > gapSize)             PlaceTrade(bars, TransactionType.Buy, OrderType.Limit, openTradeBar);          if (gapUp > gapSize && !longOnly)             PlaceTrade(bars, TransactionType.Short, OrderType.Limit, openTradeBar);          foreach (Position openPos in OpenPositions)             if (openPos != null)                ClosePosition(openPos, OrderType.Limit, openPos.PositionType == PositionType.Long ? bars.Low[openPos.EntryBar - 1] : bars.High[openPos.EntryBar - 1]);             if (idx == lastCompleteBar)             {                int closedGapsDown = GetPositions(false).Where(p => p.PositionType == PositionType.Long && !p.IsOpen).Count();                int closedGapsUp = GetPositions(false).Where(p => p.PositionType == PositionType.Short && !p.IsOpen).Count();                int gapsDown = GetPositions(false).Where(p => p.PositionType == PositionType.Long).Count();                int gapsUp = GetPositions(false).Where(p => p.PositionType == PositionType.Short).Count();                                if ( gapsUp > 0)                   DrawHeaderText(closedGapsUp + " Gaps Up Closed (" + (closedGapsUp * 100 / gapsUp) + "%)", WLColor.Red, 12);                if ( gapsDown > 0)                   DrawHeaderText( closedGapsDown + " Gaps Down Closed (" + (closedGapsDown * 100 / gapsDown) + "%)", WLColor.Green, 12);             }       }       double gapUp, gapDown, gapSize, openTradeBar = 0;       int lastCompleteBar, gapsUp, gapsDown;       bool longOnly;    } }


2. Optimize both parameters with "Shrinking Window" (or any other optimizer)

3. At the end of optimization WL window becomes frozen

In Preferences->Backtest only "Metrics Report" is selected. (happens if only "Positions" is selected also)

Single Symbol Mode, Symbol "SPY" (happens for other symbols or Portfolio also)

Nothing unusual in Preferences->Backtest or Strategy Settings.
0
248
5 Replies

Reply

Bookmark

Sort
- ago
#1
If I change the second AddPatrameter() to this:
CODE:
AddParameter("RSI Limit", ParameterType.Double, 50.0, 50.0, 100.0, 0.2); // 1

(step is 0.2 now instead of 0.1 before) it freezes just a short moment...
0
Cone8
 ( 24.57% )
- ago
#2
fwiw, no freeze for me. Not with 0.1, 0.2 or with Shrinking or Exhaustive optimizations.
0
- ago
#3
I ran the code in Post #0 - it finishes normally.
0
Glitch8
 ( 10.41% )
- ago
#4
Is it possible one of your custom extensions is in play here?
0
- ago
#5
I am investigating with a fresh install....
0

Reply

Bookmark

Sort