Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ninjascript strategy question

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

    ninjascript strategy question

    I have spent last 8 hrs trying to get a system to go long when the SMA shifts from neg to pos position. SMA > SMA(1) I have tried the obvious ENTER LONG. HELP

    I'm using the wizard (not a programmer)

    Carl Williams

    #2
    Carl, welcome to our forums - can you please post what you have setup so far in the wizard as conditions?You would likely need to include the condition as well that the SMA was falling before, so that you only get an entry and the changing point of the slope and not a continuous entry, as the condition you have posted would be true for bars where the MA is normally rising as well...

    Comment


      #3
      ninjascript strategy question

      Bertrand, TY for bringing me back to earth. I was a programmer in early 80's but haven't even tried with the languages of today (compared to FORTRAN AND RPG). You are 100% right, every bar was traded. How do I set a flag?AT START OF STRATEGY, ALL FLAGS ARE AT ZERO

      A IF CLOSE > SMA
      Y IF UPFLAG > 0
      Y GO TO A
      N ADD 1 TO UPFLAG
      CLR DOWNFLAG
      EXIT ALL ORDERS
      GO LONG @ CURRENT PRICE + 1
      GO TO A
      N IF DOWNFLAG > 0
      Y GO TO A
      N ADD 1 DOWNFLAG
      CLR UPFLAG
      EXIT ALL ORDERS
      GO SHORT @ CURRENT PRICE – 1
      GO TO A
      This is basically what I want. In the wizard, how can I set a flag??
      Thanks, Carl

      Comment


        #4
        You are welcome Carl, for flags in the wizard you can work with the so called user variables - http://www.ninjatrader.com/support/f...ad.php?t=15417

        More setups using the ConditionBuilder tool would be found here as well - http://www.ninjatrader.com/support/h...on_builder.htm

        I've also attached a different way to realize this setup, if you check for the SMA one bar ago to be smaller than the value 2 bars > you would directly express the turning over condition only, that would not be true on sections where the SMA is just rising...
        Attached Files

        Comment


          #5
          Thank you - i'll work on it

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          571 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          331 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          549 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          550 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X