Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Text only indicator per bar / Property

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

    Text only indicator per bar / Property

    I would like to create an indicator that displays text in its own indicator window that displays text data per bar. I have tried a couple of things, and nothing is working. I would like to be able to create a method or property in my indicator that I can set the value from my strategy. (1) What is the code to set a property, I can't seem to get set { } working.
    (2) Can I display text only in my indicator and should I be using DrawingText. Thanks

    #2
    1. Not sure what you mean by creating something that can be set by the strategy. You mean something like a parameter? If so, please open up the SMA indicator and take a look how the Period parameter is done. Please look carefully at the Variables region and Properties region of the code. Pay special attention to what is capitalized and what is not.

    2. Please try using DrawOnPricePanel = false along with DrawText().
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Properties make sense, here is what I am trying to do with the strategy communicating back to the indicator.

      Indicator property
      publicstring DisplayData
      {
      get { return strData; }
      set { strData = value; }
      }

      Strategy code - dynamically sets a value in the indicator
      protectedoverridevoid OnBarUpdate()
      {
      MyCustomIndicator().DisplayData = "CS";
      }


      Back in the indicator code.
      protectedoverridevoid OnBarUpdate()
      {
      if (strData == "CS")
      {
      Values[
      0].Set(100);
      Plots[
      0].Pen = new Pen(Color.Yellow);
      }
      else
      {
      Values[
      0].Set(100);
      Plots[
      0].Pen = new Pen(Color.Blue);
      }
      }

      So if I set the property in my strategy, I am wanting it to dynamically reflect back into the indicator, and then I can have the indicator do something.

      Comment


        #4
        This is not supported. If you want the strategy to change something, just program what you want it to change directly into the strategy.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        589 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        342 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        555 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        552 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X