Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Strategy Compiles but Can't Enable

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

    Strategy Compiles but Can't Enable

    Hello,

    Little problem. The 2 lines of code that are a problem I denoted with " ** ". I'm able to compile "Group A", but can't enable the strategy.
    When I remove the 2 lines, I'm able to compile and enable the "Group B" strategy. I can't figure out what's wrong with those 2 lines of code.
    No errors. Nothing in the logs for either group of commands. Can someone assist?

    (Group "A")
    if ((Close[0] > SMA(26)[0]) &&
    (MACD(12, 26, 9)[1] < MACD(12, 26, 9)[0] && MACD(12, 26, 9)[1] < MACD(12, 26, 9)[2]) &&
    ** ((MACD(12, 26, 9)[9] < MACD(12, 26, 9)[6] && MACD(12, 26, 9)[9] < MACD(12, 26, 9)[12] && MACD(12, 26, 9)[9] < MACD(12, 26, 9)[3]) ||
    ** (MACD(12, 26, 9)[10] < MACD(12, 26, 9)[7] && MACD(12, 26, 9)[10] < MACD(12, 26, 9)[13] && MACD(12, 26, 9)[10] < MACD(12, 26, 9)[4])))
    {
    Draw.ArrowUp(this, @"Up " + Convert.ToString(CurrentBars[0]), false, 0, (Low[0] + (-4 * TickSize)) , Brushes.Lime);
    }

    -------------------------------------------------------------------

    (Group "B")
    if ((Close[0] > SMA(26)[0]) &&
    (MACD(12, 26, 9)[1] < MACD(12, 26, 9)[0] && MACD(12, 26, 9)[1] < MACD(12, 26, 9)[2]))
    {
    Draw.ArrowUp(this, @"Up " + Convert.ToString(CurrentBars[0]), false, 0, (Low[0] + (-4 * TickSize)) , Brushes.Lime);
    }

    #2
    Hi, thanks for posting. I moved your post to the strategy development section of the forum.

    With group A, Do you have a BarsAgo check for the maximum lookback e.g.

    Code:
    if(CurrentBar < 10)
        return;
    
    //process Group A here
    It's working on the test script that I made. I attached it to this post for reference. If you want to test this, add the .cs file to Documents\NinjaTrader 8\bin\Custom\Strategies and compile.

    Kind regards,
    -ChrisL
    Attached Files
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Sometimes you just need a fresh set of eyes. Thanks for the assist Chris. Everything's running fine.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Jonafare, 12-06-2012, 03:48 PM
      5 responses
      3,985 views
      0 likes
      Last Post rene69851  
      Started by Fitspressorest, Today, 01:38 PM
      0 responses
      2 views
      0 likes
      Last Post Fitspressorest  
      Started by Jonker, Today, 01:19 PM
      0 responses
      2 views
      0 likes
      Last Post Jonker
      by Jonker
       
      Started by futtrader, Today, 01:16 PM
      0 responses
      7 views
      0 likes
      Last Post futtrader  
      Started by Segwin, 05-07-2018, 02:15 PM
      14 responses
      1,792 views
      0 likes
      Last Post aligator  
      Working...
      X