NexusFi: Find Your Edge


Home Menu

 





Call Reload NinjaScript (F5) as a function.


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one ozatrading with 3 posts (0 thanks)
    2. looks_two bdnt with 2 posts (2 thanks)
    3. looks_3 ktrader with 1 posts (1 thanks)
    4. looks_4 shazzmoe with 1 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 ktrader with 1 thanks per post
    4. looks_4 Big Mike with 1 thanks per post
    1. trending_up 4,846 views
    2. thumb_up 6 thanks given
    3. group 5 followers
    1. forum 9 posts
    2. attach_file 0 attachments




 
Search this Thread

Call Reload NinjaScript (F5) as a function.

  #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?
Cheap historycal L1 data for stocks
Stocks and ETFs
What broker to use for trading palladium futures
Commodities
Quantum physics & Trading dynamics
The Elite Circle
MC PL editor upgrade
MultiCharts
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
24 thanks
What is Markets Chat (markets.chat) real-time trading ro …
19 thanks
ApexTraderFunding.com experience and review
16 thanks
GFIs1 1 DAX trade per day journal
12 thanks
EG Indicators
11 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,471 since Jun 2009
Thanks Given: 33,250
Thanks Received: 101,674


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



Join the free Markets Chat beta: one platform, all the trade rooms!

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 Twitter 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: 21 since May 2023
Thanks Given: 0
Thanks Received: 8

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 July 11, 2023


© 2024 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 - Privacy Policy - Downloads - Top
no new posts