Simplified Data Management using tsMarketData

rjelles
Posts: 32
Joined: 04 Feb 2010
Location: Calgary, AB Canada
Has thanked: 6 times
Been thanked: 17 times
Contact:

Simplified Data Management using tsMarketData

Postby rjelles » 18 Sep 2013

Working with the DataLoader offers powerful extensions to strategies and indicators, but requires some coding effort to manage the data requests, event handling, and subsequent data calculations and keeping things synchronized with data on the current chart.

Attached is a MultiCharts.NET project with a new class (tsMarketData) that wraps the IDataLoader interface and provides a number of extensions and optional event handlers that help to simplify working with multiple data streams.

For example, once data has been loaded, you can access prices, moving averages, Keltner Channel, etc. without having to write any additional code:
For example:
double barPrice = mktData.BarPrice(BarsBack, PriceType.Close);
double avgPrice = mktData.BarAvgPrice(AvgLen, BarsBack, PriceType.Close);
int bb = mktData.BarByDate(Date[0]);
barPrice = mktData.BarPriceByDate(Date[0], PriceType.Close);

To help get started, I have also provided an indicator (_tsSectorRotation) that loads two symbol lists that you can choose to indicate bullish/bearish market trends. The rate of change for each symbol is calculated, and the average for bullish and bearish symbols are subtracted from each other and plotted. There is no fixed limit on the number of symbols in each list.

I'll be adding more notes on usage and updating these components regularly at http://www.traderscience.com, but I hope the internal comments and sample code will help to get started. Please pass along any problems or suggestions here and I'll look that them as quickly as possible.

Good luck!

Jeff
http://www.TraderScience.com

(Project file updated Sept 19/13 - added ability to plot each symbol in addition to histogram)
Attachments
traderScienceMarketData_20130919.pln
MC.Net project with tsMarketData, _tsSectorRotation
(9.33 KiB) Downloaded 217 times
Last edited by rjelles on 19 Sep 2013, edited 2 times in total.
These users thanked the author rjelles for the post:
MidKnight

rjelles
Posts: 32
Joined: 04 Feb 2010
Location: Calgary, AB Canada
Has thanked: 6 times
Been thanked: 17 times
Contact:

Re: Simplified Data Management using tsMarketData

Postby rjelles » 19 Sep 2013

Attached is a snapshot of the _tsSectorRotation indicator, plus an example of setting the inputs.

For the Input settings snapshot, several futures instruments on the Globex exchange and the eSignal datafeed were specified.

Jeff
Attachments
_tsSectorRoation_Indicator.png
Sector Rotation Indicator on Chart
_tsSectorRoation_Indicator.png (49.5 KiB) Viewed 570 times
_tsSectorRotation_Inputs.png
Snapshot of Input Settings for Sector Rotation
_tsSectorRotation_Inputs.png (24.09 KiB) Viewed 560 times
These users thanked the author rjelles for the post (total 2):
MidKnightvking

hughesfleming
Posts: 121
Joined: 22 Apr 2014
Has thanked: 33 times
Been thanked: 31 times

Re: Simplified Data Management using tsMarketData

Postby hughesfleming » 17 Jun 2014

This is excellent. Thank you.

Alex
These users thanked the author hughesfleming for the post:
rjelles


Return to “User Contributed Studies”