Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Indicator only plots on one instrument

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

    Indicator only plots on one instrument

    Hi,

    I have a “simple” indicator that will plot “B” and “S” When the moving average over CCI is crossed.
    The signal works fine ONLY ON ONE INSTRUMENT! (6E)
    When I switch instruments it will not plot.

    Also, is there a way to may the "B" and "S" font size bigger when it plots?

    Please help…. In layman’s terminology.

    Thanks.
    J

    protectedoverridevoid Initialize()
    {
    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
    Overlay = true;
    }

    ///<summary>
    /// Called on each bar update event (incoming tick)
    ///</summary>
    protectedoverridevoid OnBarUpdate()
    {
    // Condition set 1
    if (CrossBelow(SMA(CCI(14), 20), CCI(14), 1))
    {
    DrawText("My text" + CurrentBar, "B", (int) (Close[0]), Low[0]+ -6 * TickSize, Color.DarkGreen);
    }

    if (CrossAbove(SMA(CCI(14), 20), CCI(14), 1))
    {
    DrawText("My text" + CurrentBar, "S", (int) (Close[0]), High[0] + 6 * TickSize, Color.Red);
    }
    // Use this method for calculating your indicator values. Assign a value to each
    // plot below by replacing 'Close[0]' with your own formula.
    // Plot0.Set(Close[0]);
    }

    #2
    Joshua,

    I see nothing in your code to indicate why this issue would occur. If you would like me to look into it further, please send your indicator to [email protected].
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Hi Adam,

      I didnt think there was anything wrong as well... Compliled o.k.
      I just emailed the indicator Support@NT.

      Thanks for taking a look.
      J

      Comment


        #4
        Originally posted by Joshua 1:8 View Post
        // Condition set 1
        if (CrossBelow(SMA(CCI(14), 20), CCI(14), 1))
        {
        DrawText("My text" + CurrentBar, "B", (int) (Close[0]), Low[0]+ -6 * TickSize, Color.DarkGreen);
        }

        if (CrossAbove(SMA(CCI(14), 20), CCI(14), 1))
        {
        DrawText("My text" + CurrentBar, "S", (int) (Close[0]), High[0] + 6 * TickSize, Color.Red);
        }
        the red as highlighted is the erroneous code. replace it with a 0 (zero).

        Comment


          #5
          Woohoo!! That worked!

          Thank you very much Bukkan!

          J

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by usazencort, Today, 01:16 AM
          0 responses
          1 view
          0 likes
          Last Post usazencort  
          Started by kaywai, 09-01-2023, 08:44 PM
          5 responses
          603 views
          0 likes
          Last Post NinjaTrader_Jason  
          Started by xiinteractive, 04-09-2024, 08:08 AM
          6 responses
          22 views
          0 likes
          Last Post xiinteractive  
          Started by Pattontje, Yesterday, 02:10 PM
          2 responses
          21 views
          0 likes
          Last Post Pattontje  
          Started by flybuzz, 04-21-2024, 04:07 PM
          17 responses
          230 views
          0 likes
          Last Post TradingLoss  
          Working...
          X