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

EMA offset

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

  • MTBIN
    replied

    Hi all,


    Firstly, this post has helped me out a lot today! Thank you to jpatri for asking and starting this post, ChelseaB for the suggestion of creating the indicator and s.kinra for the strategy. I have used the strategy s.kinra has provided and created an indicator.


    So as my way of giving back, here is the EMABands Indicator with an image that I have created based on your work and I am using in my strategy. I hope this helps someone and that they can pay it forward as well.


    Oh, and a side note, it would be great if NinjaTrader could tune up the Strategy Builder with more options to create without going to the code, for us non-coder types. The Indicator Builder is in dire need of an overhaul also!
    Attached Files

    Leave a comment:


  • s.kinra
    replied
    Hello jpatri,
    You can use as below:
    Code:
    [INDENT]if(CrossAbove(Close, Ema_upr, 1)[/INDENT][INDENT=2]{
    // your code here
    }[/INDENT][INDENT]else if(CrossBelow(Close, Ema_lwr, 1)[/INDENT][INDENT=2]{
    // Your code here
    }[/INDENT]
    Hope it helps!

    Leave a comment:


  • jpatri
    replied
    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

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    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.

    Leave a comment:


  • jpatri
    replied
    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

    Leave a comment:


  • s.kinra
    replied
    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

    Leave a comment:


  • s.kinra
    replied
    Hello jpatri,
    Can you share your strategy so it would be easier to help.

    Leave a comment:


  • jpatri
    replied
    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

    Leave a comment:


  • s.kinra
    replied
    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!

    Leave a comment:


  • jpatri
    started a topic EMA offset

    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..

Latest Posts

Collapse

Topics Statistics Last Post
Started by royhagerman, Today, 04:30 AM
0 responses
1 view
0 likes
Last Post royhagerman  
Started by haas88, 03-21-2024, 02:22 AM
18 responses
208 views
0 likes
Last Post haas88
by haas88
 
Started by Board game geek, Today, 02:20 AM
0 responses
6 views
0 likes
Last Post Board game geek  
Started by knighty6508, Today, 01:20 AM
2 responses
15 views
0 likes
Last Post knighty6508  
Started by franatas, Today, 01:53 AM
0 responses
5 views
0 likes
Last Post franatas  
Working...
X