NexusFi: Find Your Edge


Home Menu

 





anyone have example send key for NT8 to do F5?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one tulanch with 1 posts (0 thanks)
    2. looks_two rleplae with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 marpol with 1 posts (0 thanks)
    1. trending_up 1,890 views
    2. thumb_up 0 thanks given
    3. group 5 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread

anyone have example send key for NT8 to do F5?

  #1 (permalink)
 tulanch 
Salt Lake City, UT
 
Experience: Intermediate
Platform: SC, NT, MT
Broker: AMP
Trading: NQ ES YM Bonds
Posts: 265 since Mar 2010
Thanks Given: 50
Thanks Received: 386

Does any one have a way to simulate the F5 ninjascript reload

I have a need for my nt8 indicator to reload itself

this inid has an added data series, makes use of tick data and uses only previous N number of base data series bars for it's summation calculation. When a new base bar forms it needs to redo the summation calculations, which utilize the added data series. This makes it very difficult to simply remove previous bar data - it is much easier to reload.

ForeceRefreash() seems to only re-render gathered data. It does not seem to re-process tic data like a F5 reload does.

I recall using SendKey in NT7.

Any way to do something like this in NT8?

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Deepmoney LLM
Elite Quantitative GenAI/LLM
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Exit Strategy
NinjaTrader
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
Build trailing stop for micro index(s)
Psychology and Money Management
 
  #3 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863


Hello try something like this :

define this in the beginning of your indicator

 
Code
public class WindowHandleInfo
		{
			private delegate bool EnumWindowProc(IntPtr hwnd, IntPtr lParam);

			[DllImport("user32")]
			[return: MarshalAs(UnmanagedType.Bool)]
			private static extern bool EnumChildWindows(IntPtr window, EnumWindowProc callback, IntPtr lParam);

			private IntPtr _MainHandle;

			public WindowHandleInfo(IntPtr handle)
			{
				this._MainHandle = handle;
			}

			public List<IntPtr> GetAllChildHandles()
			{
				List<IntPtr> childHandles = new List<IntPtr>();

				GCHandle gcChildhandlesList = GCHandle.Alloc(childHandles);
				IntPtr pointerChildHandlesList = GCHandle.ToIntPtr(gcChildhandlesList);

				try
				{
					EnumWindowProc childProc = new EnumWindowProc(EnumWindow);
					EnumChildWindows(this._MainHandle, childProc, pointerChildHandlesList);
				}
				finally
				{
					gcChildhandlesList.Free();
				}

				return childHandles;
			}

			private bool EnumWindow(IntPtr hWnd, IntPtr lParam)
			{
				GCHandle gcChildhandlesList = GCHandle.FromIntPtr(lParam);

				if (gcChildhandlesList == null || gcChildhandlesList.Target == null)
				{
					return false;
				}

				List<IntPtr> childHandles = gcChildhandlesList.Target as List<IntPtr>;
				childHandles.Add(hWnd);

				return true;
			}
		}
the moment you want to have F5 pressed, call it like this :

 
Code
					IntPtr handle = ChartControl.Handle;					
										
					// We need the child window
					List <IntPtr> allChildWindows = new WindowHandleInfo(handle).GetAllChildHandles();
					

					if (allChildWindows.Count > 0)
					{
						const int WM_KEYDOWN = 0x100;
						const int WM_KEYUP = 0x101;
						int hWnd  = allChildWindows[0].ToInt32();
							

						Thread.Sleep(100);
						uint wparam  =(uint)System.Windows.Forms.Keys.F5;
						uint lparam  = 0x414f0001;
						PostMessage(allChildWindows[0], (uint) WM_KEYDOWN, (int)System.Windows.Forms.Keys.End, lparam);
						Thread.Sleep(100);
						wparam  =(uint)System.Windows.Forms.Keys.F5;
						lparam  = 0xC14f0001;
						PostMessage(allChildWindows[0], (uint)WM_KEYUP, wparam, lparam);
					}
you can use the spyxx from visual studio, to see the messages and validate the right window is addressed

have fun!

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 marpol 
San Francisco, CA
 
Experience: Advanced
Platform: IB-TWS, Ninja, Wave59, R
Broker: IB, IQFeed
Trading: ZB
Posts: 37 since Sep 2013
Thanks Given: 0
Thanks Received: 26

I can not understand your situation and why you need to use F5. at the close of every bar NT8 will run through your code. so if you are summing the last 5 bars like this sumBars = Close[4] +Close [3] + Close[2] + Close[1] + Close[0]; then it will always update and move forward (like a moving average). Maybe if you explain your strategy or exactly what you want to do we can help point you in the right direction....there really should not be a need to hit F5.

Reply With Quote




Last Updated on April 13, 2017


© 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