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

MA Cross - Color Change

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

    MA Cross - Color Change

    Hi, I've just using ninjatrader, what a great platform.

    I've no knowledge about ninjascript, can some one help me code this simple indicator.

    - There 2 EMA
    - If first EMA above second EMA, first EMA's color is green.
    - If first EMA below second EMA, first EMA's color is red.
    - Only first EMA will show on chart, second EMA only use for reference for the color change, not showing on chart.

    Example:

    - There are EMA3 and EMA100
    - If EMA3 above EMA100, EMA3 color is green.
    - If EMA3 below EMA100, EMA3 color is red.
    - EMA100 don't not appear on chart.

    Please help, would be really appreciated.

    #2
    Originally posted by njnja View Post
    Hi, I've just using ninjatrader, what a great platform.

    I've no knowledge about ninjascript, can some one help me code this simple indicator.

    - There 2 EMA
    - If first EMA above second EMA, first EMA's color is green.
    - If first EMA below second EMA, first EMA's color is red.
    - Only first EMA will show on chart, second EMA only use for reference for the color change, not showing on chart.

    Example:

    - There are EMA3 and EMA100
    - If EMA3 above EMA100, EMA3 color is green.
    - If EMA3 below EMA100, EMA3 color is red.
    - EMA100 don't not appear on chart.

    Please help, would be really appreciated.
    Code:
     
    [COLOR=black][FONT=Courier New]      [COLOR=blue]protected[/COLOR] [COLOR=blue]override[/COLOR] [COLOR=blue]void[/COLOR] OnBarUpdate()[/FONT]
    [FONT=Courier New]      {[/FONT]
    [FONT=Courier New]          [COLOR=blue]if[/COLOR] (CurrentBar == 0) [COLOR=blue]return[/COLOR];[/FONT]
     
    [FONT=Courier New]          [COLOR=blue]if[/COLOR](EMA(Input, fastPeriod)[0] > EMA(Input,slowPeriod)[0])[/FONT]
    [FONT=Courier New]          {[/FONT]
    [FONT=Courier New]              MyEMAGreen.Set(EMA(Input, fastPeriod)[0]); [/FONT]
    [FONT=Courier New]              MyEMAGreen.Set(1, EMA(Input, fastPeriod)[1]); [/FONT]
    [FONT=Courier New]          }[/FONT]
    [FONT=Courier New]          [COLOR=blue]else[/COLOR][/FONT]
    [FONT=Courier New]          {[/FONT]
    [FONT=Courier New]              MyEMARed.Set(EMA(Input, fastPeriod)[0]);[/FONT]
    [FONT=Courier New]              MyEMARed.Set(1, EMA(Input, fastPeriod)[1]); [/FONT]
    [FONT=Courier New]          }[/FONT]
    [FONT=Courier New]      }[/FONT][/COLOR]
    Attached Files
    Last edited by roonius; 04-11-2009, 01:21 PM.

    Comment


      #3
      Thanks alot roonius, perfect

      Comment


        #4
        Signal Arrows - EMA Cross

        Can somebody make this alert...?
        Signal Arrows + Sound
        The alert should be produced by a cross of EMA 4 and EMA 8.
        Thank you!

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Irukandji, Yesterday, 02:53 AM
        2 responses
        17 views
        0 likes
        Last Post Irukandji  
        Started by adeelshahzad, Today, 03:54 AM
        0 responses
        3 views
        0 likes
        Last Post adeelshahzad  
        Started by CortexZenUSA, Today, 12:53 AM
        0 responses
        3 views
        0 likes
        Last Post CortexZenUSA  
        Started by CortexZenUSA, Today, 12:46 AM
        0 responses
        1 view
        0 likes
        Last Post CortexZenUSA  
        Started by usazencortex, Today, 12:43 AM
        0 responses
        5 views
        0 likes
        Last Post usazencortex  
        Working...
        X