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 SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        31 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        20 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        9 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        18 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        20 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X