NexusFi: Find Your Edge


Home Menu

 





Voice Commands for NinjaTrader -- ENABLED!


Discussion in NinjaTrader

Updated
    1. trending_up 1,788 views
    2. thumb_up 1 thanks given
    3. group 1 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread

Voice Commands for NinjaTrader -- ENABLED!

  #1 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

I was really surprised to find that Ninatrader 64bit on Windows 8 will recognize voice commands (through a microphone).

I have been able to push the buttons on Chart Trader (by speaking " Buy Market" , " Sell Bid", "push F3", et cetera), "Switch (to) Control Panel", and all sorts of cool things. It is not perfect, and not everything can be clicked or selected, but it is a great start!

However it it not quite good enough for production trading (in my opinion). I want to have tighter control over the commands (very specific commands not to be confused with other NT controls / buttons) and then potentially train Windows Voice Recognition for only a small set of these types of commands.

I found some code that might possibly work if it was able to be integrated into an indicator. The Ninja C# is not a problem for me (finally), but I"m not a deep C# coder, so perhaps there is a C# whiz who could get the voice recognition code into the Ninja indicator framework.

I found this code...by paqogomez

c# - Smart Way to [AUTOLINK]Handle[/AUTOLINK] Voice Commands in Code to Action a Command - Stack Overflow

this particular code looks elegant...(from that web page), though I don't understand it...any way to get this in a Ninja Indicator? Thanks!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using MyApp.SpeechMethods;

namespace MyApp
{
class Program
{
static void Main(string[] args)
{
var methods = new MySpeechMethods();
MethodInfo myMethod;
myMethod = SpeechFactory.GetSpeechMethod("Time Please");
myMethod.Invoke(methods, null);
myMethod = SpeechFactory.GetSpeechMethod("Volume Down");
myMethod.Invoke(methods, null);
myMethod = SpeechFactory.GetSpeechMethod("Volume Up");
myMethod.Invoke(methods, null);
}
}

public static class SpeechFactory
{
private static Dictionary<string, MethodInfo> speechMethods = new Dictionary<string, MethodInfo>();
public static MethodInfo GetSpeechMethod(string speechText)
{
MethodInfo methodInfo;
var mySpeechMethods = new MySpeechMethods();
if (speechMethods.Count == 0)
{
var methodNames =
typeof (MySpeechMethods).GetMethods(BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.Instance);
var speechAttributeMethods = methodNames.Where(y => y.GetCustomAttributes().OfType<SpeechAttribute>().Any());
foreach (var speechAttributeMethod in speechAttributeMethods)
{
foreach (var attribute in speechAttributeMethod.GetCustomAttributes(true))
{
speechMethods.Add(((SpeechAttribute)attribute).SpeechValue, speechAttributeMethod);
}
}
methodInfo = speechMethods[speechText];
}
else
{
methodInfo = speechMethods[speechText];
}

return methodInfo;
}
}
}

namespace MyApp.SpeechMethods
{
public class MySpeechMethods
{
[Speech("Time Please")]
[Speech("Whats the Time")]
[Speech("What Time is it")]
public void GetTime()
{
Console.WriteLine(DateTime.Now.ToLocalTime());
}

[Speech("Volume Down")]
public void VolumeDown()
{
Console.WriteLine("Volume Down 1");
}

[Speech("Volume Up")]
public void VolumeUp()
{
Console.WriteLine("Volume Up 1");
}
}

[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple = true)]
public class SpeechAttribute : System.Attribute
{
public string SpeechValue { get; set; }

public SpeechAttribute(string textValue)
{
this.SpeechValue = textValue;
}
}

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Deepmoney LLM
Elite Quantitative GenAI/LLM
ZombieSqueeze
Platforms and Indicators
Better Renko Gaps
The Elite Circle
Exit Strategy
NinjaTrader
need some ninjascript help
Traders Hideout
 

  #3 (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,392 since Jun 2009
Thanks Given: 33,170
Thanks Received: 101,530


I don't believe that has anything to do with NinjaTrader.

It's just using WinForms, and that API has the support you describe (voice recognition and ability to push buttons).

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 Twitter Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

Yes, it seems to be a global ability. I used the wrong word "Enabled".... it has nothing to do with Ninja. (However it seems Ninja could clean up the internal labels to give more accuracy for voice commands).

But I would like to create my own custom vice commands for Ninja.

For example to speak "Go Short at 102.5" This would use the selected ATM and place the order at that price.

When you speak "Close" there are two Closes, one for the window and one on Chart Trader to close a position. So, then you cannot simply say Close, you have to say Close and then tell speech recognition which Close to press.

If you have a multi instrument chart with TF on it, and also another single instrument chart with TF. You cannot just say "Switch TF", you have to say "Switch TF" and then tell it which chart to go to.

Or, to select a certain ATM: "Select ATM MyATM"

So, for me while the voice recognition is cool, it is not good enough for live trading. It could be made Ninja specific and smarter with an indicator that processed specific non-window commands.

....the code above seems elegant and concise, but I don't know how to get it into an indicator.

Started this thread Reply With Quote
  #5 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

If you speak "Buy Ask" then it presses the "Buy Ask" button and leaves the mouse pointer on the Chart Trader panel instead of on the Chart panel.

It would be better to be able to say "Go Long Ask" and not have the mouse pointer move at all.

It may seem subtle, but the fewer the mouse actions (automated or manual) the better.

The idea is to not use the mouse much for chart trading.

Started this thread Reply With Quote





Last Updated on September 11, 2014


© 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