NexusFi: Find Your Edge

Home Menu


Multicharts .NET Preserves Certain Data in Optimizer in Error

Discussion in MultiCharts

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

Search this Thread

Multicharts .NET Preserves Certain Data in Optimizer in Error

  #1 (permalink)
Las Vegas
Experience: Intermediate
Platform: MultiCharts .NET
Trading: CL
Posts: 26 since Oct 2015
Thanks Given: 7
Thanks Received: 37

I've been programming in c#/.NET on Multicharts for a while. Once you start working with more complex, and larger datasets you can't really rely on the standard VariableSeries<> anymore. That type carries a value for every. single. bar.

So I started trying to be more efficient. I used the List<> type where I could insert values to keep the same [0] as most recent. You can also resize the list so it only carries relevant numbers of values and doesn't just continually expand. The results are pretty impressive, much faster load times for strategies, indicators, and the optimizer runs faster as well.

However, there's something I discovered that needs to be kept in mind:

When using things like lists or specifying doubles right under the public class level, MultiCharts .NET in general will pass previous values if you simply "recalculate" a study. For indicators it does this as well, you'll see it if you click click on the indicator title to "mute" it, then click it back on again. This issue persists into the optimizer as well. Whatever your previous parameter check had as values gets passed as the first values for the next iteration. That's a big problem because it starts showing results in the optimizer that are completely different even if you apply those specific parameters.

This appears to happen because MultiCharts .NET doesn't load the entire script each time it reloads. It fills in parameter values but then starts the reload process at the StartCalc override.

To solve this issue, you need to clear Lists or single declaration in the StartCalc override.

The end result looks something like this:

protected override void StartCalc(){

m_xaverage1.Price = Bars.Close;
m_xaverage1.Length = MacroTrendLength;
m_xaverage2.Price = Bars.Close;
m_xaverage2.Length = ShorterLengthAvg;


askEffAvg = 0;
bidAbsorbAvg = 0;
bidEffAvg = 0;
askAbsorbAvg = 0;
combineAsk.Value = 0;
combineBid.Value = 0;


Just putting this out there in case someone starts pulling their hair out with frustration because MC .NET isn't behaving the way it seems it should.

Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
Exit Strategy
Pivot Indicator like the old SwingTemp by Big Mike
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
22 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #2 (permalink)
FuManChou's Avatar
Saint Paul, Minnesota, United States
Experience: Beginner
Platform: MultiCharts
Broker: Edge Clear LLC
Trading: MNQ
Posts: 100 since Jun 2019
Thanks Given: 1,127
Thanks Received: 120

Just wondering. Have you reached out to the MultiCharts team and see what they say? Is it working as designed or a limitation in MC?

FYI. I have two licenses (MC + MC.NET) and have not used MC.NET much.

Reply With Quote

Last Updated on November 16, 2021

© 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