Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Arrows - 50 SMA

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

    Strategy Arrows - 50 SMA

    Hi,

    i'm trying to create a simple strategy that shows an down arrow if the current bar closes below the 50 sma if it touched the previous bar and and up arrow if it closes above the sma if it touched the previous bar.

    See attachment. I'm pretty good with coding and working around the strategy builder. but for some reason, my settings just doesn't work. At this point, i don't want to auto trade just yet. I want to for now, just add arrows. If anyone can just walk me through it , i can do the rest but i'm not have good luck trying to get it to work.

    Thanks,


    #2
    Hello priceisking,

    Thank you for your note.

    Would you like to upload a copy of the script you've written in the builder which is not working?

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      code

      I've uploaded the code that it generated from the strategy.
      Attached Files

      Comment


        #4
        Hello priceisking,

        The issue is probably related to reusing the same tag name for each arrow. For example, each time you draw an arrow its going to be reused rather than creating a new one. This could be why you are not seeing them on evey condition.

        I would suggest adding the current bar to the name of your arrow, I have provided a screen shot of how you could do this in the builder.

        I used the following to write your logic, for an up arrow which may be a better approach. You could replicate this in the builder.

        Code:
        if(CurrentBar<60) return;
        			
        if(Close[0] > SMA1[0]	&& Close[1] < SMA1[1]	&& SMA1[1] > Low[1])
        Draw.ArrowUp(this, "Blah"+CurrentBar, true, 0, Low[0], Brushes.Red);
        Interested in the logic I put it into a strategy. The strategy will buy on an up arrow, work a stop below the previous bars low. Then after 2 bars, will begin to adjust the stop to the previous bars low as long as their was a higher low.

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

        Comment


          #5
          Thank you!

          Hi Alan,

          Thank you so much. I figured it out and works great now thanks to your help.


          Appreciate it.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          41 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          124 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          64 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          41 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          46 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X