Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Reload NinjaScript from within a script

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

    Reload NinjaScript from within a script

    Is there any way in NinjaScript to perform the same action as the F5 hotkey - Reload NinjaScript?
    Without using the

    SendKeys.SendWait("{F5}") approach?

    I am looking for a more automated way to work-around the disconnect between a global line from a time-based chart with an end-of-session anchor point, and the way a tick chart implements the display of that line: the tick chart fails to update the anchor point correctly after initial plot.

    The SendKeys approach is undesirable because it requires focus to shift to the time-based chart hosting the script that draws the global lines. If I have to shift focus to the time chart, I may as well continue to do so manually and press F5 manually, which is what I do currently to keep the lines in sync.

    I would have liked for NT to keep the end-points in sync as part of the base functionality of global lines, but that is not what happens.
    Last edited by jculp; 10-14-2023, 12:25 PM.

    #2
    Hello jculp,

    Thanks for your post.

    No, there are no supported NinjaScript-specific methods or properties to reload Ninjascripts programmatically. You would have to use the SendKeys approach as you have noted.

    We are tracking interest in the ability to programmatically reload NinjaScripts in an existing internal feature request ticket and I have added your vote. This request is being tracked under the number SFT-1579.

    As with all feature requests, interest is tracked before implementation is considered, so we cannot offer an ETA or promise of fulfillment. If implemented, it will be noted on the Release Notes page of the Help Guide.

    Release Notes — https://ninjatrader.com/support/help...ease_notes.htm

    Further, here is a demonstration video showing that when a global line is drawn on a 1-minute chart, that line is also drawn on a 1000-tick chart with the same start/end values as the 1-minute chart: https://brandonh-ninjatrader.tinytak...Nl8yMjIzMzc1MA

    This forum thread will be open for other community members to share their insights.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Thanks for the info. I know that a global line will initially plot correctly on a tick chart. I am looking for the best way to keep the tick chart plot updated when I am using a line whose end-point anchor is end-of-session. I am plotting a single value for the duration of the session: both anchor points have the same y-value. I may switch over to a global ray, although that comes with an additional challenge for what I am doing.

      Comment


        #4
        Hello jculp,

        Thanks for your notes.

        Please share a screenshot showing the behavior you are reporting and what you are trying to accomplish so I may accurately assist.
        • To send a screenshot with Windows 10 or newer I would recommend using the Windows Snipping Tool.
        • Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save it as a jpeg file and send the file as an attachment.

        Also, send a reduced exported copy of a test script that reproduces the reported behavior so that I may test the script on my end. Note that a reduced copy refers to a copy of the script that contains the minimum amount of code needed to reproduce the issue. All other code is commented out or removed.

        To create a copy of your script to modify, open a New > NinjaScript Editor, select your script, right-click in the Editor, select 'Save as', name the script, and click OK.​

        To export the script, go to Tools > Export > NinjaScript AddOn and ensure the 'Export as compiled assembly' checkbox is unchecked.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #5
          The disconnect between end-of-session anchor point and tick chart treatment of it, is a feature of NT lines, not a feature of a script. You can observe the same behavior by drawing a manual line on a time-based chart. Set the end anchor point to 4pm CDT today and make it global. Open a tick chart say, 500 ticks and observe the line. It will initially plot at the tick time scale equivalent to 4pm, but the end line often remains fixed at that same x-coordinate even when the tick time scale has changed or moved past it. See this thread for more detail: https://forum.ninjatrader.com/forum/...on-tick-charts

          I am using a script to draw the lines because I use multiple lines, and reloading the script updates all the tick-chart lines. I would like to find a way to auto-reload the script.

          Comment


            #6
            Hello jculp,

            Thanks for your notes.

            Unfortunately, there are no supported NinjaScript methods or properties to auto reload Ninjascripts programmatically.

            We are tracking interest for adding this feature and you vote has been added to the feature request as noted in post # 2.

            When/if implemented, it will be noted on the Release Notes page of the Help Guide.

            Release Notes — https://ninjatrader.com/support/help...ease_notes.htm

            This forum thread will be open for other community members to share their insights on possible unsupported code to accomplish this.​
            <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            606 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            353 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            560 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            561 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X