Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How do I reference current chart ticker symbol only?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How do I reference current chart ticker symbol only?

    Hello, I have created a dictionary with different tick sizes, ratios and dollar increments for both minis and micros. It is as follows:

    Dictionary<string, TickerInfo> tickerData = new Dictionary<string, TickerInfo>();

    /// Populate the dictionary with ticker data
    /// Format for new tickers is as follows: Minimum Tick Size, Mini Tick Value, Mini Ratio, Micro Tick Size, Micro Tick Value, Micro Ratio
    /// double.NaN repesents a value that is unavailable
    tickerData.Add("NQ", new TickerInfo(0.25, 5.00, 20.00, 0.25, 0.50, 2.00));
    tickerData.Add("ES", new TickerInfo(0.25, 12.50, 50.00, 0.25, 1.25, 5.00));
    tickerData.Add("RTY", new TickerInfo(0.10, 5.00, 50.00, 0.10, 0.50, 5.00));
    tickerData.Add("CL", new TickerInfo(0.01, 10.00, 1000.00, 0.01, 1.00, 100.00));
    tickerData.Add("NG", new TickerInfo(0.001, 10.00, 10000.00, 0.001, 1.00, 1000.00));
    tickerData.Add("GC", new TickerInfo(0.10, 10.00, 100.00, 0.10, 1.00, 10.00));
    tickerData.Add("SI", new TickerInfo(0.005, 25.00, 5000.00, 0.005, 5.00, 1000.00));
    tickerData.Add("HG", new TickerInfo(0.0005, 12.50, 25000.00, 0.0005, 1.25, 2500.00));
    tickerData.Add("PL", new TickerInfo(0.10, 5.00, 50.00, 0.10, double.NaN, double.NaN)); // For "PL", where x is represented as NaN
    tickerData.Add("ZC", new TickerInfo(0.25, 12.50, 50.00, 0.125, 1.25, 10.00));
    tickerData.Add("ZS", new TickerInfo(0.25, 12.50, 50.00, 0.125, 1.25, 10.00));
    tickerData.Add("ZW", new TickerInfo(0.25, 12.50, 50.00, 0.125, 1.25, 10.00));

    /// Add other ticker data here...​

    Later, I want to reference which ticker is open on the current chart that the indicator is enabled on, and be able to reference these numbers based on the given ticker. Well, when I Print(Instrument.FullName); it shows up with "NQ 6-24" for example. I'm afraid this wont help because if I were to do:

    if (Instrument.FullName == "NQ") etc. etc.

    Then the FullName would not match the name in my dictionary. I don't want to edit my code every time I change expiry's. There must be a way to access just the symbol right?

Latest Posts

Collapse

Topics Statistics Last Post
Started by CarlTrading, 03-31-2026, 09:41 PM
1 response
72 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by CarlTrading, 04-01-2026, 02:41 AM
0 responses
39 views
0 likes
Last Post CarlTrading  
Started by CaptainJack, 03-31-2026, 11:44 PM
0 responses
63 views
2 likes
Last Post CaptainJack  
Started by CarlTrading, 03-30-2026, 11:51 AM
0 responses
63 views
0 likes
Last Post CarlTrading  
Started by CarlTrading, 03-30-2026, 11:48 AM
0 responses
53 views
0 likes
Last Post CarlTrading  
Working...
X