NexusFi: Find Your Edge


Home Menu

 





Call Reload NinjaScript (F5) as a function.


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one wavey with 3 posts (0 thanks)
    2. looks_two ozatrading with 3 posts (0 thanks)
    3. looks_3 bdnt with 2 posts (2 thanks)
    4. looks_4 hedgeplay with 2 posts (0 thanks)
      Best Posters
    1. looks_one cvetkisa with 2 thanks per post
    2. looks_two bdnt with 1 thanks per post
    3. looks_3 Big Mike with 1 thanks per post
    4. looks_4 ktrader with 1 thanks per post
    1. trending_up 7,211 views
    2. thumb_up 6 thanks given
    3. group 9 followers
    1. forum 14 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 ozatrading 
washington+dc/usa
 
Experience: Intermediate
Platform: NinjaTrader
Trading: cocoa, sugar
Posts: 8 since Dec 2012
Thanks Given: 0
Thanks Received: 0

I need to call reload ninjascript AKA default "F5". Ninjatrader does not support that automatically. I was wondering if anyone had made this code. Please share. Thank you.


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
$134M Ground Entry Contract in Disputed Final Review Aft …
Prediction Markets & Event Contracts
Wood Mackenzie Drops $200 Oil Forecast -- Airspace Expir …
Prediction Markets & Event Contracts
Beijing Summit Closes: Xi Pledges Hormuz Help -- $1.14B …
Prediction Markets & Event Contracts
UCL Final Kicks Off at Noon ET: PSG at 56.5% as Iran May …
Prediction Markets & Event Contracts
CFTC Advances Prediction Markets Regulation -- Chairman …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
22 thanks
2026 Jlab journal
10 thanks
Trying to learn Volume and price action correlation
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
5 thanks
  #2 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557


ozatrading View Post
I need to call reload ninjascript AKA default "F5". Ninjatrader does not support that automatically. I was wondering if anyone had made this code. Please share. Thank you.

Probably closest you will get is using SendKey to send an F5 keyboard press.

Mike




We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on X Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #3 (permalink)
 ozatrading 
washington+dc/usa
 
Experience: Intermediate
Platform: NinjaTrader
Trading: cocoa, sugar
Posts: 8 since Dec 2012
Thanks Given: 0
Thanks Received: 0



Big Mike View Post
Probably closest you will get is using SendKey to send an F5 keyboard press.

Mike

Yes u right, but it is working only for the ACTIVE window. Does not work for multi-workspaces. If anyone found a solution besides the SendKey. Please answer. Thx Mike. Thx Guys. Great FORUM!!!.


Started this thread Reply With Quote
  #4 (permalink)
 
ktrader's Avatar
 ktrader 
glostrup, denmark
 
Experience: Advanced
Platform: Custom platform
Broker: CQG
Trading: Futures, Options, Stocks
Posts: 249 since Aug 2011
Thanks Given: 152
Thanks Received: 275


ozatrading View Post
I need to call reload ninjascript AKA default "F5". Ninjatrader does not support that automatically. I was wondering if anyone had made this code. Please share. Thank you.

Yes, you can use the HistoricalDataManager to load dataseries.

Heres an example of how to load the first dataseries of the currentchart this specific example must be in an indicator because of how it obtains the bar-dataseries to reload, but you can use the datamanager from anywhere and use any barseries).

Since the method gets an ArrayList you can ofcourse reload multiple series with the same call (just add each to the arraylist - for instance loop through the BarsArray of the ChartControl and add each to reload all dataseries of the current chart (this is what "F5" does)

 
Code
Bars b = this.ChartControl.BarsArray[0];		
ArrayList br = new ArrayList();	
DateTime f =b.From;
DateTime t =b.To;
if (b.Count>0 && b.GetTime(0)<b.From) f=b.GetTime(0).Date;
if (b.Count>0 && b.GetTime(b.Count-1)>b.To)t=b.GetTime(b.Count-1).Date;			
HistoricalDataManager.BarsRequested barsToLoad = new HistoricalDataManager.BarsRequested(b.Instrument, b.Period, f,t) {
   Session = b.Session
};			
br.Add(barsToLoad);
new HistoricalDataManager.RequestBarsFromProvider(null).DoReloadFromProvider(br);
--ktrader


Reply With Quote
Thanked by:
  #5 (permalink)
 ozatrading 
washington+dc/usa
 
Experience: Intermediate
Platform: NinjaTrader
Trading: cocoa, sugar
Posts: 8 since Dec 2012
Thanks Given: 0
Thanks Received: 0


ktrader View Post
Yes, you can use the HistoricalDataManager to load dataseries.

Heres an example of how to load the first dataseries of the currentchart this specific example must be in an indicator because of how it obtains the bar-dataseries to reload, but you can use the datamanager from anywhere and use any barseries).

Since the method gets an ArrayList you can ofcourse reload multiple series with the same call (just add each to the arraylist - for instance loop through the BarsArray of the ChartControl and add each to reload all dataseries of the current chart (this is what "F5" does)

 
Code
Bars b = this.ChartControl.BarsArray[0];		
ArrayList br = new ArrayList();	
DateTime f =b.From;
DateTime t =b.To;
if (b.Count>0 && b.GetTime(0)<b.From) f=b.GetTime(0).Date;
if (b.Count>0 && b.GetTime(b.Count-1)>b.To)t=b.GetTime(b.Count-1).Date;			
HistoricalDataManager.BarsRequested barsToLoad = new HistoricalDataManager.BarsRequested(b.Instrument, b.Period, f,t) {
   Session = b.Session
};			
br.Add(barsToLoad);
new HistoricalDataManager.RequestBarsFromProvider(null).DoReloadFromProvider(br);
--ktrader

will work around that. thanks for the code!


Started this thread Reply With Quote
  #6 (permalink)
 cvetkisa 
United Kingdom
 
Experience: Advanced
Platform: NinjaTrader
Trading: EUR/USD
Posts: 3 since Sep 2011
Thanks Given: 0
Thanks Received: 7

ChartControl.HotKey((Keys) HotKeyManager.ChartHotKeys.ReloadNinjaScript);


Reply With Quote
Thanked by:
  #7 (permalink)
 shazzmoe 
Denver Colorado
 
Experience: Advanced
Platform: NinjaTrader
Trading: ES
Posts: 10 since Aug 2012
Thanks Given: 0
Thanks Received: 3

has anyone found a way to reload NinjaScript without using a send key in NT8?

I've run into issues where the chart window loses focus and it sends the F5 key press to another window


Reply With Quote
  #8 (permalink)
bdnt
Boston MA USA
 
Posts: 2 since May 2023
Thanks Given: 0
Thanks Received: 2

I needed this as well, and found this undocumented way...

ChartControl.OnReloadNinjaScriptHotKey(this, new System.Windows.Input.KeyEventArgs(Keyboard.PrimaryDevice, PresentationSource.FromVisual(chartControl), 0, Key.F5));


Reply With Quote
Thanked by:
  #9 (permalink)
cmelody
Zaanstad, Netherlands
 
Posts: 24 since May 2023
Thanks Given: 0
Thanks Received: 11

What about calling the function ForceRefresh()? You can read about it on the NinjaTrader website


Reply With Quote
  #10 (permalink)
bdnt
Boston MA USA
 
Posts: 2 since May 2023
Thanks Given: 0
Thanks Received: 2



cmelody View Post
What about calling the function ForceRefresh()? You can read about it on the NinjaTrader website

ForceRefresh only triggers the visuals to re-render, it does not reload the scripts/indicators/strategies running the chart.


Reply With Quote
Thanked by:




Last Updated on April 29, 2025


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts