Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Daily Price range

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

    Daily Price range

    Hi

    I'm trying to find a way to receive an alert every time the daily open and close are more than x% of the total price range (min-max of the day).

    1. if I want to apply the same alert to several charts (30-50 charts) what is the best way to do it? creating a Strategy (with the Builder)?

    2. as a start I can't really find a proper syntax to do that. I thought of:
    Open[1]>=(High[1]*0.8)

    open 1 bar ago >= 80% value of the High 1 bar ago

    assuming a 20% range from the max of the day

    But the results (I'm asking the strategy to colour the bars) are not right, since ALL the bars get coloured!

    Many thanks!

    Mp

    #2
    Hello Mp. Thanks for the post.

    The best way to do this would be to make an indicator rather than a strategy. To get 20 percent of the daily range you would take the high minus the low from the CurrentDayOHL indicator, then compare the open price to the high minus that value.

    Ex:

    Code:
    if (CurrentDayOHL().CurrentOpen[0] >= (CurrentDayOHL().CurrentHigh[0] - (.2 * (CurrentDayOHL().CurrentHigh[0] - CurrentDayOHL().CurrentLow[0]))))
    For the close you would do the following:

    Code:
    if (Close[0] >= (CurrentDayOHL().CurrentHigh[0] - (.2 * (CurrentDayOHL().CurrentHigh[0] - CurrentDayOHL().CurrentLow[0]))))
    Please let me know if I may be of any further assistance.

    Comment


      #3
      Thank you for the reply

      Never done an indicator. Will try to.

      can't see the whole line code you pasted.

      Comment


        #4
        Hello Mp.

        Thanks for the reply.

        The whole line is there, just scroll right in the code block and you will see the rest of it.

        Please let me know if you have any questions on the material.

        Comment


          #5
          ok/ this is my test. all fine (sort of) but there is not plots where I would expect some. the section below is empty.
          Attached Files
          Last edited by percma; 03-08-2018, 03:35 AM.

          Comment


            #6
            Hello.

            Thanks for the reply.

            The examples I provided are only the conditions that would evaluate to true or false. You must add logic inside of the if blocks to tell the script what it should do if those conditions are true. To add plot values, you must fill the Value[] series. Please see the SMA code for an example of how to use plots. You can view the code of any native indicator in NinjaTrader with the NinjaScript editor.

            We have a fully documented help guide which will help you get started with Ninja Script. You will find language references to all of the methods and functions you will be using. You will also see a tutorial section which will help you create your first indicator and get you started with some of these concepts.
            A link to our Help Guide can be found below:*https://ninjatrader.com/support/help...injascript.htm
            *
            I am also linking you to the Educational Resources section of the Help Guide to help you get started with NinjaScript:*
            *https://ninjatrader.com/support/help..._resources.htm
            You will find Reference Samples online as well as some Tips and Tricks for both indicators and strategies:
            Click here to see our NinjaScript Reference Samples:*http://www.ninjatrader.com/support/f...splay.php?f=30
            Click here to see our NinjaScript Tips:*http://www.ninjatrader.com/support/f...ead.php?t=3229
            *
            These samples can be downloaded, installed and modified from NinjaTrader and hopefully serve as a good base for your custom works.

            Please let us know if we may be of any further assistance.

            Comment


              #7
              thank you for the reply. I think I will need to find another solution. Unfortunately I don't have now the time to learn how to do that with Ninja script.

              regards
              M

              Comment

              Latest Posts

              Collapse

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