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 Geovanny Suaza, 02-11-2026, 06:32 PM
0 responses
662 views
0 likes
Last Post Geovanny Suaza  
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
0 responses
376 views
1 like
Last Post Geovanny Suaza  
Started by Mindset, 02-09-2026, 11:44 AM
0 responses
110 views
0 likes
Last Post Mindset
by Mindset
 
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
0 responses
575 views
1 like
Last Post Geovanny Suaza  
Started by RFrosty, 01-28-2026, 06:49 PM
0 responses
580 views
1 like
Last Post RFrosty
by RFrosty
 
Working...
X