Hello, I'd like to know the best way to construct a time series, such as:
1) price difference between two securities
2) percentage change of a single security
and use these in multiple strategies/indicators without copy/pasting the code?
is there such a thing as a synthetic security? or another "best practice" to do this?
Thank you much,
-Jason
Best way to make synthetic data for indicators+strategies?
Re: Best way to make synthetic data for indicators+strategie
I see that I can add multiple instruments to a chart, and then using thisIndicator.MaxDataStream and this.BarsOfData() I should be able to access the data to construct my synthetic.
However what's the best way to share this with other indicators or strategies? I am guessing that I should have my "master" indicator do the computation of the synthetic, then store that in a thread-safe global for consumption by other indicators/strategies. Is this the best practice?
However what's the best way to share this with other indicators or strategies? I am guessing that I should have my "master" indicator do the computation of the synthetic, then store that in a thread-safe global for consumption by other indicators/strategies. Is this the best practice?
Re: Best way to make synthetic data for indicators+strategie
after more research (i'm a noob) I see this.AddIndicator() , so I am assuming that the best practice is to put the reusable logic into indicators and to instantiate new copies of these in each dependent study.
I suppose that'll work, but it would be nice to have a single instance of the dependency.
if someone could provide a better idea, please do let me know.
I suppose that'll work, but it would be nice to have a single instance of the dependency.
if someone could provide a better idea, please do let me know.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Best way to make synthetic data for indicators+strategie
Synthetic data can be created outside of MultiCharts and then imported/mapped into MultiCharts to be shown as a chart data series.
If you want your synthetic data to be calculated in MultiCharts then you can plot is as an indicator.
You can use the AddIndicator method to access objects of one study from the another one. Example here.
It can also be done with the help of IChartCustomDrawer. When you are calling EventDraw you can send the DrawContext parameter. You can specify regular coordinates and convert them into bar coordinates with it. Check "DrawContext Environment" in the help file for more information.
Here is an example how to plot candles with gradient colors in MC .Net using IChartCustomDrawer. There is also a prebuilt indicator called _Market_Depth_on_Chart_2_ that can be used for reference. Another example here.
If you want your synthetic data to be calculated in MultiCharts then you can plot is as an indicator.
Please check the prebuilt Spread__Diff indicator.1) price difference between two securities
Please check the prebuilt PercentChg indicator.2) percentage change of a single security
You can use the AddIndicator method to access objects of one study from the another one. Example here.
It can also be done with the help of IChartCustomDrawer. When you are calling EventDraw you can send the DrawContext parameter. You can specify regular coordinates and convert them into bar coordinates with it. Check "DrawContext Environment" in the help file for more information.
Here is an example how to plot candles with gradient colors in MC .Net using IChartCustomDrawer. There is also a prebuilt indicator called _Market_Depth_on_Chart_2_ that can be used for reference. Another example here.
Re: Best way to make synthetic data for indicators+strategie
Hi Henry, thank you for those details. I will go the AddIndicator () route to reuse computations.
Is there somewhere I can read descriptions of the pre-built functions/indicators/signals?
Is there somewhere I can read descriptions of the pre-built functions/indicators/signals?
-
- Posts: 26
- Joined: 30 Jan 2014
- Been thanked: 4 times
Re: Best way to make synthetic data for indicators+strategie
Use database, such as MSSQL, Access, Dbase, Excel, etc..
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Best way to make synthetic data for indicators+strategie
We have an article where we add description of the prebuilt studies when time permits. At the moment we are occupied with the urgent support inquiries and first public beta of MC 9.0 so the article is far away from being compelete. We will add descriptions of codes as soon as we have opportunity.Is there somewhere I can read descriptions of the pre-built functions/indicators/signals?
The most of the studies are the industry standard. You can find the description over the Internet.
Thank you for understanding.