The below strategy only contains like 300 lines from top to bottom including variables and properties, but it kills my PC when I try to do a backtest!So much so, I converted it over to NT8 from NT7 to try and improve backtesting performance, but no joy. My PC is only 2 years old, and no other progs are open and running while I'm trying this.
Can anyone see anything obvious that I can do to get this to run quickly and efficiently on a portfolio of forex? I've tried already doing each currency one by one, and it still kills my machine. Have got lucky and have a couple of results, so I know the code is working, but overall, I've wasted hours and still got a lot of testing to do.
Thanks all,
Steve
public class zzRSIdblretrace : Strategy
{
#region Variables
// Wizard generated variables
private int rSIOverbought = 80; // Default setting for RSIOverbought
private int rSIOversold = 1; // Default setting for RSIOversold
private int stopLong = 1;
private double stopShort = 0;
private double profitShort = 0;
private int BarCountOverbought = 0;
private int BarCountRetest = 0;
private int BarCountBreaklow = 0;
private int Trendperiod = 50;
private double x1=1.0;
private int p1 = 6;
private int s1 = 3;
private int AvTR=0;
private int movav=300;
private int movavshort=50;
private bool Notrade= true;
private bool Overbought= false;
private bool Retest= false;
private bool Breaklow= false;
private bool Oversold= false;
private bool rolA= true;
private bool rolB= false;
private bool rolC= false;
private bool rolD= false;
private bool rolE= false;
private bool rolF= false;
private bool rolG= false;
private bool rolH= false;
#endregion
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Strategy here.";
Name = "zzRSIdblretrace";
Calculate = Calculate.OnBarClose;
EntriesPerDirection = 1;
EntryHandling = EntryHandling.AllEntries;
IsExitOnSessionCloseStrategy = true;
ExitOnSessionCloseSeconds = 30;
IsFillLimitOnTouch = false;
MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
OrderFillResolution = OrderFillResolution.Standard;
Slippage = 0;
StartBehavior = StartBehavior.WaitUntilFlat;
TimeInForce = TimeInForce.Gtc;
TraceOrders = false;
RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
StopTargetHandling = StopTargetHandling.PerEntryExecution;
BarsRequiredToTrade = 20;
// Disable this property for performance gains in Strategy Analyzer optimizations
// See the Help Guide for additional information
IsInstantiatedOnEachOptimizationIteration = false;
}
else if (State == State.Configure)
{
}
}
Comment