Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to manually re-run indicator

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

    How to manually re-run indicator

    Hi - I have an indicator that reads data from a text file and draws lines on a chart, using the values in the text file. The lines are static once the user adds them.

    The indicator works as intended when I first add it to a chart, but in order to load new data and draw new lines I have to remove the indicator and add it again.

    Currently, I have the drawing portion of the code (DrawLines) run when state = State.Realtime. I tried to also add the DrawLines function to the State.Configure, thinking that the user could open the parameters, re-enter the filename and then it would run again (I thought that state triggered when the user opened and closed the UI) - but this did not work.

    Initially, I had the DrawLines occurring in OnBarUpdate, and this caused the lines to be re-written over each other for each bar, generating thousands of line objects on top of each other.

    What I would like is for the indicator to run once when added and then update (re-read the input file and execute DrawLines) upon a user command - after they have updated the text file and they want to add the new lines.

    Thanks for any assistance.

    #2
    Hello john_44573,

    I see that you are posting in NinjaTrader 7 section of the forums.

    In NinjaTrader 7 there is not a State property. When historical data is being processed, the Historical bool property will be true, and in real-time the Historical bool property will be false.

    Below is a link to the help guide.


    Typically, I would recommend adding a button, but this would not officially supported for NinjaTrader 7.

    The LongShortToolbar buttons and ToolbarShortcut indicators may give you some hints of unsupported code you could use.
    This strategy will add buttons to the chart toolbar to sell or buy 1 lot but only when certain condition is true. By default the condition to buy is that Price has to close above the prior two bar. Anything can be changed in the script so each trader can define his own discretionary entry […]

    The indicator allows you to draw chart objects with a single click by adding a drawing ToolBar on the left side of the chart. *Due to the very nature of the indicator, we might not able to support enhancement requests.


    You may want to consider moving to NinjaTrader 8. Adding buttons to the UserControlCollection is officially supported.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply, I did not realize I was in the NT 7 forum, that was by mistake. I'll report in the correct forum.

      Comment


        #4
        Hello john_44573,

        If this is for NinjaTrader 8, you can add a button to the UserControlCollection and trigger the actions in the button .Click event.

        Below is a link to the help guide.


        And a link to an example.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thank you for your response and I will look at this information. I did repost in the NT8 forum and will ask follow up questions there.

          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