Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Edit = Strategy LOST

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Strategy Edit = Strategy LOST

    I posted this in Strategy Development, then realized it was probably meant to go here.

    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, "");
    }

    }
    }
    }

    #2
    Hello Dolfan,

    Thank you for your post.

    I will continue to work with you on the other thread: http://www.ninjatrader.com/support/f...ad.php?t=86574

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by cre8able, 02-11-2023, 05:43 PM
    3 responses
    236 views
    0 likes
    Last Post rhubear
    by rhubear
     
    Started by frslvr, 04-11-2024, 07:26 AM
    8 responses
    113 views
    1 like
    Last Post NinjaTrader_BrandonH  
    Started by stafe, 04-15-2024, 08:34 PM
    10 responses
    46 views
    0 likes
    Last Post stafe
    by stafe
     
    Started by rocketman7, Today, 09:41 AM
    3 responses
    11 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by traderqz, Today, 09:44 AM
    2 responses
    10 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X