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

Supp/Res lines for PointAndFigure Chart

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

    Supp/Res lines for PointAndFigure Chart

    I am new to NinjaScript, but not to programming.

    I am trying to draw two horizontal lines dynamically to represent Support and Resistance lines on a Point and Figure chart.

    I would like each line to represent the current support/resistance looking at the current bar and the previous bar only.

    For example, if the current bar is Os, then the Support line should be drawn just below the bottom O. As the O bar continues down, the Support line should be moved to the lowest O in the bar and an Alert sounded.

    The same for the current bar being Xs, except the Resistance line is drawn just above the top X in the bar. As the X bar continues up, the Resistance line should be moved to the highest X in the bar and an Alert sounded.

    Sounds simple and it probably is. Here are some questions...
    1. How do I determine if the bar is Os or Xs?
    2. How do I issue an Alert sound?
    3. How do I draw the horizontal support / resistance line

    Can anyone recommend a good book for Ninja Script 8?

    Currently, I am trying to modify an existing indicator labeled: SRLinesRB.

    Any help will be appreciated.

    Thanks,
    Ron
    Attached Files

    #2
    Hello Ron,

    Thank you for your note.

    The bars on a PF chart alternate between O and X, thus to determine what the last bar was you could find what the current bar is and assume the last bar was the opposite.

    I have written a condition (attached) which determines if the current bar is an X, and if so will draw a green arrow up, set an off an alert, set a variable equal to the low of the current bar and then draw a line at that low. Otherwise it will draw a red arrow to denote it’s a O Bar.

    See Drawline section of our helpguide:


    See Alert Section of our helpguide:


    If you would like to take on learning NinjaScript, 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 with tutorials can be found below:


    The entire Alphabetical Reference can be found with the following link:


    The best way to begin learning NinjaScript is to use the Strategy Wizard. With the Strategy Wizard you can setup conditions and variables and then see the generated code in the NinjaScript Editor by clicking the View Code button.

    I'm also proving a link to a pre-recorded set of videos 'Strategy Wizard 301' and 'NinjaScript Editor 401' for you to view at your own convenience.
    Strategy Wizard 301 - https://www.youtube.com/watch?v=FmBi...56536A44DD7105
    NinjaScript Editor 401 - https://www.youtube.com/watch?v=K8v_...56536A44DD7105

    If you are new to C#, to get a basic foundation for the concepts and syntax used in NinjaScript I would recommend this section of articles in our help guide first:


    I am also linking you to the Educational Resources section of the Help Guide to help you get started with NinjaScript: http://www.ninjatrader.com/support/h..._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.

    There is a also a growing library of user submitted custom indicators (100+) that can be downloaded from our support form. Please look in the NinjaScript File Sharing section of our support forum as you may find what you are looking for there: http://www.ninjatrader.com/support/f...splay.php?f=37

    You can also contact a professional NinjaScript Consultants or Educators who would be eager to create or modify this script at your request or assist you with your script. Please let me know if you would like a list of professional NinjaScript Consultants or Educators who would be happy to create or modify any script at your request or assist you in learning NinjaScript.

    Please let me know if I may be of further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Hi Alan.

      Thanks for the response.

      I am working in NT8. The sample code you sent did not compile, nor are functions such as DrawArrowUp found in the Help Guide, so I assume this is NT7 code.

      I will make some effort to convert the code to NT8 in the interim (unless you have an NT8 version).

      Thanks again,
      Ron

      Comment


        #4
        And attached is the converted code.

        Thanks,
        Ron
        Attached Files

        Comment


          #5
          Hello ronhb107,

          You are correct that indicator was for NT7, my apologies.

          I have attached the indicator I created in NT7 for NT8.

          Please let us know if you need further assistance.
          Attached Files
          Alan P.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by sidlercom80, 10-28-2023, 08:49 AM
          167 responses
          2,260 views
          0 likes
          Last Post jeronymite  
          Started by warreng86, 11-10-2020, 02:04 PM
          7 responses
          1,361 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by Perr0Grande, Today, 08:16 PM
          0 responses
          5 views
          0 likes
          Last Post Perr0Grande  
          Started by elderan, Today, 08:03 PM
          0 responses
          9 views
          0 likes
          Last Post elderan
          by elderan
           
          Started by algospoke, Today, 06:40 PM
          0 responses
          10 views
          0 likes
          Last Post algospoke  
          Working...
          X