Best way to make synthetic data for indicators+strategies?

Questions about MultiCharts .NET and user contributed studies.
novaleaf
Posts: 49
Joined: 17 Apr 2014
Has thanked: 9 times
Been thanked: 4 times

Best way to make synthetic data for indicators+strategies?

Postby novaleaf » 22 Apr 2014

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

novaleaf
Posts: 49
Joined: 17 Apr 2014
Has thanked: 9 times
Been thanked: 4 times

Re: Best way to make synthetic data for indicators+strategie

Postby novaleaf » 22 Apr 2014

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?

novaleaf
Posts: 49
Joined: 17 Apr 2014
Has thanked: 9 times
Been thanked: 4 times

Re: Best way to make synthetic data for indicators+strategie

Postby novaleaf » 23 Apr 2014

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.

User avatar
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

Postby Henry MultiСharts » 23 Apr 2014

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.
1) price difference between two securities
Please check the prebuilt Spread__Diff indicator.
2) percentage change of a single security
Please check the prebuilt PercentChg 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.

novaleaf
Posts: 49
Joined: 17 Apr 2014
Has thanked: 9 times
Been thanked: 4 times

Re: Best way to make synthetic data for indicators+strategie

Postby novaleaf » 23 Apr 2014

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?

CarseWhite
Posts: 26
Joined: 30 Jan 2014
Been thanked: 4 times

Re: Best way to make synthetic data for indicators+strategie

Postby CarseWhite » 24 Apr 2014

Use database, such as MSSQL, Access, Dbase, Excel, etc..

User avatar
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

Postby Henry MultiСharts » 25 Apr 2014

Is there somewhere I can read descriptions of the pre-built functions/indicators/signals?
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.

The most of the studies are the industry standard. You can find the description over the Internet.
Thank you for understanding.


Return to “MultiCharts .NET”