Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

my chart indicator section not showing my indecator name

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

    my chart indicator section not showing my indecator name

    my script compile without error .but in my chart indicator section not showing my indecator name. pls tell me how solve this

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    i would plan to design this indicator for each and every tick by tick LTP how many times repeated and it will be counted.

    ex.
    LTP | LTP repeated count
    1879 | 34
    1881 | 38
    1885 | 60
    ​------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    using System.Collections.Generic;
    using System.Windows.Media;
    using NinjaTrader.NinjaScript;
    using NinjaTrader.NinjaScript.Indicators;

    namespace NinjaTrader.NinjaScript.Strategies
    {
    public class TickRepetitionCounter : Strategy
    {
    private Dictionary<double, int> tickCounts;
    private double lastTickValue;

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = "Tick Repetition Counter";
    Name = "TickRepetitionCounter";
    Calculate = Calculate.OnEachTick;
    IsFillLimitOnTouch = false;
    BarsRequiredToTrade = 1;
    tickCounts = new Dictionary<double, int>();
    }
    }

    protected override void OnBarUpdate()
    {
    double currentTickValue = Close[0];

    if (tickCounts.ContainsKey(currentTickValue))
    {
    tickCounts[currentTickValue]++;
    }
    else
    {
    tickCounts.Add(currentTickValue, 1);
    }

    lastTickValue = currentTickValue;

    PrintTickCounts();
    }

    private void PrintTickCounts()
    {
    ClearOutputWindow();

    foreach (KeyValuePair<double, int> tickCount in tickCounts)
    {
    Print("Value: " + tickCount.Key + "\tNumber of Times Repeated: " + tickCount.Value);
    }
    }

    private void ClearOutputWindow()
    {
    for (int i = 0; i < 100; i++)
    {
    Print("");
    }
    }
    }
    }


    Last edited by alagu; 06-20-2023, 10:19 AM.

    #2
    Hello, thanks for writing in. When you get a script that compiles, but does not show up in the Indicator/Strategy list, always first check the Log tab of the Control Center for any errors. This line is causing the initialization error:
    AddChartIndicator(new Plot(new Pen(Brushes.Transparent, 0), "Tick Count"));

    Did you mean to use AddPlot?

    Comment


      #3
      my script compile without error .but in my chart indicator section not showing my indecator name. pls tell me how solve this

      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

      i would plan to design this indicator for each and every tick by tick LTP how many times repeated and it will be counted.

      ex.
      LTP | LTP repeated count
      1879 | 34
      1881 | 38
      1885 | 60
      ​------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      using System.Collections.Generic;
      using System.Windows.Media;
      using NinjaTrader.NinjaScript;
      using NinjaTrader.NinjaScript.Indicators;

      namespace NinjaTrader.NinjaScript.Strategies
      {
      public class TickRepetitionCounter : Strategy
      {
      private Dictionary<double, int> tickCounts;
      private double lastTickValue;

      protected override void OnStateChange()
      {
      if (State == State.SetDefaults)
      {
      Description = "Tick Repetition Counter";
      Name = "TickRepetitionCounter";
      Calculate = Calculate.OnEachTick;
      IsFillLimitOnTouch = false;
      BarsRequiredToTrade = 1;
      tickCounts = new Dictionary<double, int>();
      }
      }

      protected override void OnBarUpdate()
      {
      double currentTickValue = Close[0];

      if (tickCounts.ContainsKey(currentTickValue))
      {
      tickCounts[currentTickValue]++;
      }
      else
      {
      tickCounts.Add(currentTickValue, 1);
      }

      lastTickValue = currentTickValue;

      PrintTickCounts();
      }

      private void PrintTickCounts()
      {
      ClearOutputWindow();

      foreach (KeyValuePair<double, int> tickCount in tickCounts)
      {
      Print("Value: " + tickCount.Key + "\tNumber of Times Repeated: " + tickCount.Value);
      }
      }

      private void ClearOutputWindow()
      {
      for (int i = 0; i < 100; i++)
      {
      Print("");
      }
      }
      }
      }


      ​​

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      558 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      545 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X