I am using the strategy builder in Ninja 8.0.0.11 for the first time. I created the simplest of strategies to start where the HMA crosses the EMA, enter an order. Cross above = Long and cross below = Short. Target was set at 250 ticks and trailing stop at 45 ticks. All was well and good when back testing even as much as 8 years worth of data. Then I went back and tried to change some parameters and it quit testing. I tried deleting the the strategy several times and starting over with a new name, same parameters and I get the same result. Make an edit and lose the results. When I mean lose the results I mean that it returns no test data. I even went with the most minor of edits by selecting the box to plot the indicators on the chart, nothing else, and still returned no results. I changed it back and no results.
Am I doing something wrong here? I have tried restarting Ninja and restarting my machine several times but nothing seems to fix this.
Also, I would like to add that the default for the ?MAs is 14, I have tried to change that and it always comes back to 14. I can set it to another number and in the code you will see 14. Reopen the strategy editor and you will see 14. I provided the simple code below for your reference. Thanks in advance.
Best regards,
Dolfan
PS. Message update... After initialing typing this message I figured I would go and unlock the code and manually edit. Got nothing to lose, right? POOF! As soon as I hit 'Unlock Code', the strategy disappeared from the list. What the sam hill! GEEZ is this not yet fully baked or what? Somebody tell me what I am doing wrong please!
//This namespace holds Strategies in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Strategies
{
public class wtf : Strategy
{
private HMA HMA1;
private EMA EMA1;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Strategy here.";
Name = "wtf";
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 = true;
}
else if (State == State.Configure)
{
HMA1 = HMA(14);
EMA1 = EMA(14);
SetProfitTarget("250", CalculationMode.Ticks, 0);
SetTrailStop("45", CalculationMode.Currency, 0, false);
}
}
protected override void OnBarUpdate()
{
// Set 1
if (CrossAbove(HMA1, EMA1, 0))
{
EnterLong(1, "");
}
// Set 2
if (CrossBelow(HMA1, EMA1, 0))
{
EnterShort(1, "");
}
}
}
}
Comment