C
C#2mo ago
Dash

Looking for help with database injection in NinjaTrader - Advanced(I think)

I'm using NinjaTrader to build a fully automated trading bot. Right now the issue I'm having is that Ninjatrader doesn't auto-update stock tickers, and there is no way to bulk add new tickers, nor is there a supported way to add them programmatically. I'm currently trying to figure out how I'd add them programmatically and could use a hand. The way I want to do it right now is to clone an Instrument that already exists - (Example: Instrument oldInstr = Instrument.GetInstrument("MOGU");) - Change the "FullName" parameter, and add the new object to the database. Unfortunately the FullName parameter is readonly, and because I haven't been able to create a unique Instrument, I can't test adding it to the database yet. I was able to use reflection to see the methods for the objecs and I see a DbAdd function that looks like how I would add it to the DB, but it doesn't allow me to change the FullName, nor does it accept anything other than a bool. So what I'm assuming I need to do is like I said above using the DbAdd function. Support saying it's not supported: https://forum.ninjatrader.com/forum/ninjatrader-8/add-on-development/1302818-bulk-addition-of-instruments#post1302821 The DbAdd Function to be used: NinjaTrader.Cbi.Instrument - OBJECT DbAdd - METHOD Void DbAdd(Boolean) - ATTRIBUTES PrivateScope, Public, HideBySig - CALLINGCONVENTION Standard, HasThis - CALLINGCONVENTION True - IsPublic?
NinjaTrader Support Forum
As I've mentioned in previous posts, I made an addon to open a strategy automatically based on a scanner I made. One of the issues I recently noticed is that its not creating about 5% of the hits. I found the reason it's not hitting them is because the instruments don't exist in ninjatrader. This brings me to my question, Is
1 Reply
Dash
Dash2mo ago
I think I figured it out. Using the TypeDiscriptor I was able to determine that the FullName cant be set because it's being retrieved from another object that is nested within the Instrument. Replace the Name of that object, and the FullName changed. I'll update if I need any further assistance.