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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        166 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        321 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        246 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        350 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        179 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X