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 argusthome, 03-08-2026, 10:06 AM
        0 responses
        85 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        48 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        29 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        32 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        67 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X