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 kevinenergy, 02-17-2023, 12:42 PM
          118 responses
          2,778 views
          1 like
          Last Post kevinenergy  
          Started by briansaul, Today, 05:31 AM
          0 responses
          9 views
          0 likes
          Last Post briansaul  
          Started by traderqz, Yesterday, 12:06 AM
          11 responses
          28 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by PaulMohn, Today, 03:49 AM
          0 responses
          9 views
          0 likes
          Last Post PaulMohn  
          Started by inanazsocial, Today, 01:15 AM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_Jason  
          Working...
          X