Changes

Jump to navigation Jump to search

4.1 How Indicators and Signals are Calculated

404 bytes added, 16:16, 12 September 2017
[[File:FormasStudyASX.png|right|Format Study]]
In MultiCharts .NET all studies (indicators and signals) are applied to the chart via the Insert Study window. Indicators can be applied to any chart symbol by clicking the right mouse button on the subchart to see the shortcut menu and selecting Insert Study. The constructor and the '''Create()''' method for study classes will be executed once when a study is selected, now indicators will create plots and signals will create orders. The '''StarCalc()''' method of study class is called every time before the calculation starts. The script begins to work through all of the historic bars of the symbol and on each bar the '''CalcBar()''' method is called. After the calculation of all historic bars, studies switch to the Real-time calculation on Close of every bar mode. For indicators, calculation on every tick received in real time can be selected. To do so, right-click on the chart to see the shortcut menu, select Format Indicators, select the indicator, then select Format, select the Properties tab and check the Update on Every Tick check box. For signals, calculation on every tick received in real time is activated by enabling the [[Signal_Settings#Intra-Bar_Order_Generation|IOG]] option. To do so, right-click on the chart to see the shortcut menu, select Format Signals, select the signal, then select Format, select the Properties tab and check the Enable Intra-Bar Order Generation check box.
==For Advanced Users==
MultiCharts. NET is a multithread application and it is important to know in which threads studies are created, executed and deleted. There is a main thread (UI) and working threads, where the calculation of indicators and signals is executed.
<span style="color:#ff0000">Important!
Please keep in mind that most methods and basic class properties of indicators, signals and functions are not thread-safe. It means that simultaneous work from several threads (which are created explicitly or implicitly) with methods and properties may lead to incorrect inner data and as the result to crashes in program. It is done in order to speed up calculation.
</span>
Starting from the moment of applying a study to a chart, scanner or portfolio, several stages occur before receiving the calculation results.

Navigation menu