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

Calculation on prices

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

    Calculation on prices

    Hi there,

    Within the development of indicators on NT6.5/7 can you, for example:
    Take the high and low of the previous bar's price and then the high and low prices on the close of the current bar.
    Then calculate as follows: (high - low close of current) / (high - low previous) = x.

    If x < y make an indicator.

    Can this or something similar be done?

    Cheers,

    Z

    #2
    Hello zhorny,

    Yes, this is possible with NinjaScript. Please see here for a tutorial on conditional plots:


    That tutorial uses a conditional operator, but you can also use if statements to evaluate.

    double x = (High[0] - Low[0]) / (High[1] - Low[1]);

    if (x < y)
    Plot0.Set(1);
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Excellent.
      Can one do the same on other indicators e.g. MACD and Volume?
      Next step...learn how to program!

      Comment


        #4
        Yes, it would work pretty much the same with other indicators as well. To get strated with NinjaScript, you should look at using the strategy wizard. This offers a point and click interface. You define conditions by selecting within a GUI and can then view the code for these selections.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by The_Sec, 04-16-2024, 02:29 PM
        3 responses
        15 views
        0 likes
        Last Post NinjaTrader_ChristopherS  
        Started by hurleydood, 09-12-2019, 10:45 AM
        15 responses
        1,097 views
        0 likes
        Last Post Leeroy_Jenkins  
        Started by danieldunn2024, Today, 03:06 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by cre8able, Yesterday, 04:16 PM
        1 response
        16 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by cre8able, Yesterday, 04:22 PM
        1 response
        14 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X