Here is what happens when click Bactest on an instrument:
Then, I choose my strategy I want to backtest:
As you can see, the parameters have not changed.
I then open the output window, and it says:
**NT** Failed to call method 'Initialize' for strategy 'Mymoneymaker/b66c95fa84c0440fa26f72f7d404a518': Unexpected initial token 'Integer' when populating object. Expected JSON object or array. Path '', line 1, position 1.
What do I do to fix this error so I can backtest this strategy?
The strategy I am trying to backtest is:
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// Based upon APEX's Momentum Scalping Strategy
/// </summary>
[Description("Based upon APEX's Momentum Scalping Strategy")]
public class Mymoneymaker : Strategy
{
#region Variables
// Wizard generated variables
private int profitTarget = 6; // Default setting for ProfitTarget
private int stopLoss = 9; // Default setting for StopLoss
// User defined variables (add any user defined variables below)
#endregion
private int target1 = 6;
private int stoploss1 = 9;
/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
Add(ApexDiagnosticExpectedVolume("4, 0, true"));
CalculateOnBarClose = true;
}
private void GoLong()
{
EnterLongStop(DefaultQuantity, High[1] + (3 * TickSize), "MomLong");
SetProfitTarget("MomLong", CalculationMode.Price, High[1] + (Target1*TickSize));
SetStopLoss("MomLong", CalculationMode.Price, High[1] + (Stoploss1*TickSize), false);
}
private void GoShort()
{
EnterShortStop(DefaultQuantity, Low[1] - (3 * TickSize), "MomShort");
SetProfitTarget("MomShort", CalculationMode.Price, Low[1] - (Target1*TickSize));
SetStopLoss("MomShort", CalculationMode.Price, Low[1] - (Stoploss1*TickSize), false);
}
protected override void OnBarUpdate()
{
if (Position.MarketPosition != MarketPosition.Flat) return;
// Long Condition
if (ApexDiagnosticExpectedVolume("4, 0, true").ActualVolumeDataSeries[1] > ApexDiagnosticExpectedVolume("4, 0, true").ExpectedVolumeDataSeries[1]
&& Close[1] > Open[1])
{
GoLong();
}
// Short Condition
if (ApexDiagnosticExpectedVolume("4, 0, true").ActualVolumeDataSeries[1] > ApexDiagnosticExpectedVolume("4, 0, true").ExpectedVolumeDataSeries[1]
&& Close[1] < Open[1])
{
GoShort();
}
}
#region Properties
[Description("Momentkum Strategy")]
[GridCategory("Parameters")]
public int Target1
{
get { return target1; }
set { target1 = Math.Max(1, value); }
}
[Description("")]
[GridCategory("Parameters")]
public int Stoploss1
{
get { return stoploss1; }
set { stoploss1 = Math.Max(1, value); }
}
#endregion
}
}
-Stearno

Comment