Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Looking for basic script to add arrows and signals to graph

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

    Looking for basic script to add arrows and signals to graph

    I am looking to identify candle stick patterns when certain conditions are met, but i can't seem to figure out the logic needed to apply these to my graph. Would i need to use onbarupdate method?

    #2
    Below is add arrow up and down :


    Comment


      #3
      Hello hdshev,

      Thank you for your post.

      The built in Candle Stick Pattern indicator may be of use to you:



      If you're defining your own conditions to identify a candlestick pattern and want to draw something on the chart when this occurs, you could use a drawing tool like cincai suggested. Calling the tool within OnBarUpdate would be recommended. To ensure you're drawing the tool on each bar for which the conditions are met you'd want to use a unique tag name for each. For example:

      protected override void OnBarUpdate()
      {
      if(your conditions for entry)
      {
      Draw.Text(this, "myText" + CurrentBar, "My Pattern found", 0, High[0] + (2 * TickSize));
      }
      }

      This would print "My Pattern found" 2 ticks above the high of the bar the conditions were true for. You could do something similar if you instead wanted to draw an arrow above the bar.

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

      Comment


        #4
        thank you! this is great!

        Comment


          #5
          Based on certain criteria, I have added the following code:

          Draw.ArrowDown(this, "tag1", true, 0, High[0] + 1, Brushes.Red);

          The arrow appears for the latest condition but removes prior arrows. How do I get all the arrows for the conditions to stay on the chart without removing them?

          I want the arrows under or on top of the bar to stay on for all conditions met historically.

          Thanks.
          Last edited by givemefood; 03-18-2024, 01:54 PM.

          Comment


            #6
            Hello givemefood,

            Thanks for your notes.

            To have arrows remain drawn on the chart historically you would need to use a unique tag name in your Draw.ArrowDown() method. See the notes below from the Draw.ArrowDown() help guide documentation.

            "tag: A user defined unique id used to reference the draw object.

            For example, if you pass in a value of "myTag", each time this tag is used, the same draw object is modified. If unique tags are used each time, a new draw object will be created each time."


            This is typically done by using CurrentBar for the tag parameter in the Draw.ArrowDown() method since the CurrentBar value will be different on each bar.

            For example, the code might look something like this:

            Draw.ArrowDown(this, "tag1" + CurrentBar, true, 0, High[0] + 1, Brushes.Red);

            CurrentBar: https://ninjatrader.com/support/help...currentbar.htm

            <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

            Comment


              #7
              Thank you. That worked.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Mindset, 04-21-2026, 06:46 AM
              0 responses
              89 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by M4ndoo, 04-20-2026, 05:21 PM
              0 responses
              135 views
              0 likes
              Last Post M4ndoo
              by M4ndoo
               
              Started by M4ndoo, 04-19-2026, 05:54 PM
              0 responses
              68 views
              0 likes
              Last Post M4ndoo
              by M4ndoo
               
              Started by cmoran13, 04-16-2026, 01:02 PM
              0 responses
              119 views
              0 likes
              Last Post cmoran13  
              Started by PaulMohn, 04-10-2026, 11:11 AM
              0 responses
              69 views
              0 likes
              Last Post PaulMohn  
              Working...
              X