Announcement

Collapse
No announcement yet.

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 Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        574 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        332 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        553 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X