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 sjsj2732, Yesterday, 04:31 AM
        0 responses
        39 views
        0 likes
        Last Post sjsj2732  
        Started by NullPointStrategies, 03-13-2026, 05:17 AM
        0 responses
        290 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        289 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        135 views
        1 like
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        96 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Working...
        X