Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I have written a indicator for controlling a single windows form so it has a TrackBar control that when is sliding, as well a horizontal line (DrawHorizontalLine method) is sliding. I need to use update() method because OnBarUpdate() method need to be called every time TrackBar.Value change, reglardless a new tick income.
This is my purpose but the code doesn´t work. I think it is because Update() method is not working.
Here is the Windows form code:
And here is the indicator code:
How do I update OnBarUpdate() when I slide trackBar?
Thank you very much!
Can you help answer these questions from other members on NexusFi?
I wouldn't call OnBarUpdate() just to update a horizontal line, it is supposed to be used by NT whenever a bar changes, or tick arrives, depending on the CalculateOnBarClose settings. I refactored your code a little I hope you don't mind.
Thank you very much!! Your code is fine and it has saved my NinjaTrader programmer live! Sorry by delay.
I have read out on events and event handlers. I am interested on winform will be a .exe file and not a .dll file and so I have coded a static class for .dll (StaticMemberTest.Class1) which is call by ninjatrader indicator.
This static class has a event I want to be handled by ninjatrader indicator but this not working.
Here post the new codes:
For form (.exe):
For static class (.dll):
And the NinjaTrader indicator code:
All Visual Studio code is compiled in .NET 3.0, for compatibility issues with NinjaTrader.
I think the problem is on the method public void OnNewValueHandler(object sender, EventArgs e) but I don´t know which is the solution.
In my windows form code, private void OnNewValueHandler(object sender, EventArgs e) is for testing event handler work fine. But when I implement it in my indicator code, the event handler is not called.
The static class approach works only if you access the dll from multiple methods within the same Application Domain. The Ninjascript is running in NinjaTrader Application Domain, and your WinForms exe is running in its own Application Domain. If you want them to communicate, you need to implement some sort of Inter-Application Communication or IAC mechanism. A few ideas on technologies you could use:
- TCP/IP sockets (similar to NTDirect.dll)
- named pipes
- some shared database (MS SQL with ServiceBroker enabled for PUSH, for example)
- Message Queuing (MSMQ, NServiceBus, RabbitMQ etc)
- web services (WCF full-duplex)
- shared memory ( actually there was a dll for TradeStation sometime ago, I forgot the name)
The shared/static class will not work for this. There was a discussion on that here on futures.io (formerly BMT), I can't find the link though.
J