Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EMA offset

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

    EMA offset

    Hello,
    I would like to build a strategy in Strategy Builder that plots a 21 day EMA line with a 21 day EMA line plotted 24 ticks above and a 21 day EMA line 24 ticks below the first EMA plot. I am hoping to create three paralleled EMA lines, then use them in a cross strategy.

    I have not been able to make the off sets work, can anyone help with this?

    Thank you,
    Joe P..

    #2
    Hello jpatri,
    You can use as below:-
    Code:
    Plot1[0] = ema[0];
    Plot2[0] = ema[0] + 24 * TickSize;
    Plot3[0] = ema[0] - 24 * TickSize;
    Hope it helps!

    Comment


      #3
      Hello s.kinra,
      Thank you very much for your rely to my request!
      Your solution appears to be ninjascript code? I am not able to find (plot) in the strategy builder and I am inept at coding. If there is a Strategy Builder solution you can suggest I would be grateful.
      Thank you,
      jpatri

      Comment


        #4
        Hello jpatri,
        Can you share your strategy so it would be easier to help.

        Comment


          #5
          Hello jpatri,
          I believe there is some limitation of Strategy Builder & you won't be able to get what you're expecting. You can have the plot in Strategy Builder by selecting Add to Chart, but it won't allow you to add ticks to it.
          I am attaching a sample strategy for reference, it will add the three moving averages you're looking for so you can add your logic in this to get working.
          EMAoffset.zip

          Comment


            #6
            Hello s.kinra,
            Thank you for the file, it worked perfectly. It is plotting a center 21 day EMA, with a 21 day EMA 24 ticks above and another 24 ticks below.
            I am now trying to load it into Ninjascript editor to try add the rest of my strategy.
            Thank you!
            jpatri

            Comment


              #7
              Hello Joe P.,

              s.kinra is correct in that while you can apply an offset to an indicator plot for a condition, this does not change the indicator plot on the chart and does not visually add the offset to the indicator with 'Plot on chart' enabled.

              My recommendation would be to create an indicator (and not a strategy) with the code that s.kinra has suggested which has 3 plots and sets these plot values with an offset. Then call this indicator from your strategy in the strategy builder.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Chelsea B.
                Thank you for your input!
                .kinra's solution did work perfectly. I was able to plot the three EMA lines as I wanted.
                Now I am trying to figure out how to attach a cross over function to place a buy order as the price crossed above or below each of the 24 tick extremes. Since I am not a coder, I am working it slowly.

                Thank all for you help with the 24 tick plots, This is a very helpful blog!

                jpatri

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by LeroyO, Today, 04:09 PM
                0 responses
                1 view
                0 likes
                Last Post LeroyO
                by LeroyO
                 
                Started by sidlercom80, Today, 04:57 AM
                2 responses
                29 views
                0 likes
                Last Post NinjaTrader_Jim  
                Started by Tartagliagroup, Today, 02:11 PM
                1 response
                9 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by rickyblah12, Today, 01:33 PM
                1 response
                12 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by rcloutier, Today, 01:17 PM
                4 responses
                14 views
                0 likes
                Last Post rcloutier  
                Working...
                X