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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        168 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        324 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        250 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        350 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        179 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X