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