Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

multiple indicators referencing each other

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

    multiple indicators referencing each other

    Hi there all I'm just getting started and have walked through a few of the ninjascript online tutorials but haven't come across this yet.

    How do I create a command where I have multiple indicators such as MFI RSI and Stochastics for example and I'm looking for a trade entry only when all of them reach a threshold, to go long or short. IE RSI in upward momentum and above the 30 line Stochastics fast line crosses the slow line AND is above the 20 line. AND the MFI is ALSO rising. Then, enter Long. I've seen the if command but haven't seen how to create a condition where it won't execute unless other parameters are Also met. sort of a weighted set of conditions where each indicator is 33% and a trade isn't executed unless 100% of certainty is created?

    I hope I've explained that right. like the multiple keys needed to launch a nuclear missile you need the code the keys and no launch is possible unless all conditions are met. Conversely Such a set of conditions might help to keep from being shaken out of trades prematurely.... anyways I'm hoping someone understands what I'm talking about and takes the time to point me in the right direction. Thanks!!

    #2
    Hello Daryl Haaland,

    Thanks for your post and welcome to the NinjaTrader forums!

    If you are using the NT8 strategy builder then this will happen automatically as any "condition" you create in a set will be "anded" to the other conditions meaning that all conditions must be true for the "action" to occur. Reference: http://ninjatrader.com/support/helpG...gy_builder.htm

    If you are coding directly in ninjascript, which is based on C#, you can use the logical operator && to put together conditions, for example:

    if ((IsRising(RSI(14,3)) && RSI(14, 3)[0] > 30))
    {
    // execute if RSI is rising and is greater than 30
    }

    Reference: http://ninjatrader.com/support/helpG..._reference.htm (Click on the link "Operators" on that page to see the logical operator &&.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Would you use the condition Group button to create a prior set of conditions to ensure perhaps that an indicator like our example RSI here was in the overbought condition <20 for example, so we can guess that the 30 we are looking for has some momentum behind it? Sort of like taking the safety off of the gun we'd like to shoot, but not yet pulling the trigger until the upward and >30 conditions are also met? For that matter are there any video's out there that explain how to use the groups button in the condition builder?

      Originally posted by NinjaTrader_Paul View Post
      Hello Daryl Haaland,

      Thanks for your post and welcome to the NinjaTrader forums!

      If you are using the NT8 strategy builder then this will happen automatically as any "condition" you create in a set will be "anded" to the other conditions meaning that all conditions must be true for the "action" to occur. Reference: http://ninjatrader.com/support/helpG...gy_builder.htm

      If you are coding directly in ninjascript, which is based on C#, you can use the logical operator && to put together conditions, for example:

      if ((IsRising(RSI(14,3)) && RSI(14, 3)[0] > 30))
      {
      // execute if RSI is rising and is greater than 30
      }

      Reference: http://ninjatrader.com/support/helpG..._reference.htm (Click on the link "Operators" on that page to see the logical operator &&.

      Comment


        #4
        Hello Daryl Haaland,

        Thanks for your reply.

        For the RSI momentum, you could compare the RSI value of previous bars to see that it is trending up over however many bars you wish. if (RSI(14, 3)[0] >RSI(14, 3)[1] && RSI(14, 3)[1] > RSI(14, 3)[2] && etc etc. You can certainly create a condition group if you wish.

        Condition group examples are shown in the helpguide's condition builder section of Time Filters: https://ninjatrader.com/support/help...on_builder.htm
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by JTizz, Today, 01:20 PM
        0 responses
        2 views
        0 likes
        Last Post JTizz
        by JTizz
         
        Started by omermirza, Today, 12:39 PM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_Jim  
        Started by mballagan, Today, 01:02 PM
        0 responses
        5 views
        0 likes
        Last Post mballagan  
        Started by larkmail, Today, 12:30 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Kate  
        Started by Danila, Today, 11:08 AM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X