Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

indicator line color control ...

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

    indicator line color control ...

    I'm back testing a strategy using the Strategy Analyzer, but have been having problems making my indicator lines change color based on conditions.
    The initial color definitions for the lines are working.

    protectedoverridevoid Initialize()
    {
    EMA(EMA1).Plots[0].Pen.Color = Color.Linen;
    EMA(EMA2).Plots[
    0].Pen.Color = Color.Red;

    Add(EMA(EMA1));
    Add(EMA(EMA2));

    CalculateOnBarClose =
    true;
    }
    protectedoverridevoid OnBarUpdate()
    {
    // EMA1 color control
    if ((Falling(EMA(EMA1)) == true) && (EMA(EMA1)[0] < EMA(EMA2)[0]))
    {
    EMA(EMA1).PlotColors[
    0][0] = Color.Red;
    }
    elseif ((Rising(EMA(EMA1)) == true) && (EMA(EMA1)[0] > EMA(EMA2)[0]))
    {
    EMA(EMA1).PlotColors[
    0][0] = Color.Lime;
    }
    elseif ((Falling(EMA(EMA1)) == true) && (EMA(EMA1)[0] > EMA(EMA2)[0]))
    {
    EMA(EMA1).PlotColors[
    0][0] = Color.Yellow;
    }

    #2
    Hello TJ,

    The reason for this is that the plotting is limited with the Strategy Analyzer since it is not a full chart being used.

    This will work on a live chart without issue.

    If you need to see these colors in a backtest then you would need to create an indicator using the EMA Calculations and change the plot colors from the called indicator.

    http://www.ninjatrader.com/support/f...ead.php?t=6651

    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      have connected o live data feed, charting of live data is working, but when I select this strategy, the coloring of the indicators is not working. Strategy is selected After the chart is up .. but does not change any indicator colors.
      Am I missing some type of Plot setup or something ??
      Or do I have to create my indicators .. then control the color ??
      Trying to use available EMA lines ...

      Comment


        #4
        Tj.Wheeler,

        Can you please send me your script so that I can review what you have written at this point?
        Cal H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        31 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, Yesterday, 02:41 AM
        0 responses
        14 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        22 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        40 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        34 views
        0 likes
        Last Post CarlTrading  
        Working...
        X