logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
IsacCosta  
#1 Posted : Monday, July 14, 2008 7:17:02 PM(UTC)
IsacCosta

Rank: Newbie

Groups: Registered, Registered Users
Joined: 7/15/2008(UTC)
Posts: 2

Hello, my name is Isac and this is my first post in this forum. I hope you guys could help and I hope I can contribute somehow.

I have a question about MDK. When using MQL4 of Metatrader, it is possible to output more than one data arrays, up to eight in fact, meaning if I am writing a Bollinger Band indicator, I can output both the upper band, the reference moving average and the lower band. With MetaStock Formula Language, I know that it is possible to simply write the variables used in calculation like:

UpperBand;
RefMovAvg;
LowerBand;

And the indicator will plot three lines in the chart, one for each data array.

Is this possible using the MDK? Is there a way to do this with the psResultArray member (MSXDataInfoRec) of the MSXResultRec?

I have seen an example in another post, where the DLL exports two functions, one for each band. If this is the best solution, would you have some ideas to save double processing of the data? I mean, for each function call, I would need to perform the exact same operations, but when outputing the upper band I will sum the stddevs to the avg and for the lower band, I will subtract the stddevs, that's the only difference.

I'm interested in this to experiment my own indicators with the MDK, such as Pivot Points, HiLo Activator, etc. It would be a shame if I have to duplicate the processing by copying the code for each output I need to produce.

Thanks in advance for any information.

wabbit  
#2 Posted : Monday, July 14, 2008 7:48:26 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Hi Isac,

Welcome to the Forum.

Only one data array is returned from an external function call. Such is life! To avoid having to rewrite the code for the upper and lower bands, pass an argument selecting which to return? Another way is to write another .dll which is called by the external function .dll (you might even consider writing all the functionality in libraries which are compatible with both MT4 and MS?). To avoid having indicators computed multiple times, why not exploit the RAM on the users machine and store the results from the first computation(s) and retrieve these from memory when needed?

Here's an interesting problem, try to recreate the IndicatorCounted() function for MS and apply this in your code! (there is not much actual need for this function as MS only has a max of 65500 bars per chart where MT4 can have so much more information, that the time taken to process the limited MS information is still short enough for intraday and intrabar trading, but it makes for an interesting challenge whilst learning about writing codes for MS).


Hope this helps.

wabbit [:D]


IsacCosta  
#3 Posted : Tuesday, July 15, 2008 9:10:01 AM(UTC)
IsacCosta

Rank: Newbie

Groups: Registered, Registered Users
Joined: 7/15/2008(UTC)
Posts: 2

Thank you very much, Wabbit, I guess we should be creative to design workaround for these limitations. It would be nice to have multiple output data arrays. I will think about your suggestion. I wonder why I am finding so difficult to see code snippets for MDK on the net.
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.