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

Notification

Icon
Error

Options
Go to last post Go to first unread
mkine  
#1 Posted : Wednesday, October 29, 2008 12:58:38 AM(UTC)
mkine

Rank: Newbie

Groups: Registered, Registered Users
Joined: 4/27/2007(UTC)
Posts: 4

I'm new for MSX programming and have no idea on the following issue, hope someone can help:
I wanted to write 2 indicators, named A and B, while both these indicators need to refer to another 2 indicators Y and Z
For example:
(assume all are written using VC6 and included in the same DLL)
Y is 10 days moving average, Z is RSI
A is having close lower than 10 MA + RSI above 70 + current bar is a black candle then return true
B return true when a Bearish MACD Crossover happen above 10 MA and with RSI below 30
When i call A and B in Metastock, is that possible for me to reuse the data array calculated in Y and Z in order to avoid any reculcalation?
Appreciated for the help in advance. Thx.
MK
wabbit  
#2 Posted : Wednesday, October 29, 2008 1:53:33 AM(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)
MK,

It sounds like you are trying to do something very obscure?? Anyway....

If my understanding is correct, then if you pass the output of the first calls to the .dll as arguments to the subsequent calls, there wont be any recomputation:
Code:

myMov:=extfml("mydll.myMovingAverage",CLOSE,10); {Y}
myRSI:=extfml("mydll.myRSI",CLOSE,14); {Z}

conditionA:=extfml("mydll.myConditionA",myMov, myRSI); {pass the previous results as arguments}

conditionB:=extfml("mydll.myConditionB",MACD(), myMov, myRSI); {pass the previous results as arguments}

{plot}
myMov; {this has already been calculated and wont be done again}

or something along those lines...

All of what you are attempting is more easily done in the native MSFL, but you might be using it as a learning exercise?

Hope this helps.


wabbit [:D]

mkine  
#3 Posted : Friday, October 31, 2008 9:25:01 AM(UTC)
mkine

Rank: Newbie

Groups: Registered, Registered Users
Joined: 4/27/2007(UTC)
Posts: 4

Many thanks wabbit, but is that possible i can use some variable (e.g. static) / function to avoid passing the calculated value to and from Metastock?
Is that you mean the MSFL will be the solution? Appreciated if you can give me more information on this.
Thanks again.
MK
wabbit  
#4 Posted : Friday, October 31, 2008 6:52:53 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)
mkine wrote:
Y is 10 days moving average, Z is RSI
A is having close lower than 10 MA + RSI above 70 + current bar is a black candle then return true
B return true when a Bearish MACD Crossover happen above 10 MA and with RSI below 30


Something like this?

Code:

Y:=mov(CLOSE,10,e);
Z:=RSI(CLOSE,14);

A:=CLOSE<Y and Z>70 and black();
B:={provide more definition here for bearish MACD cross above 10MA} and Z<30;

{return}
A;
B;


I don't think there is any need for MSX programming here? If you want to use MSX, then just do the whole computation in one function:

extfml("mydll.myfunction"); {no arguments}

in the MSX: compute the MA, RSI, Black() and MACD, and do all the comparisons required to return one value. Otherwise, if you need to "remember" previous value for the current chart, you will need some structure that will contain all the information to identify THIS chart and its timeframe, and store all the relevant deatils; you might save a millisecond on computation(?) but it is going to cost memory, and depending on the speed of your RAM this may be slower than the CPU calculation?



wabbit [:D]

mkine  
#5 Posted : Monday, November 10, 2008 12:03:04 AM(UTC)
mkine

Rank: Newbie

Groups: Registered, Registered Users
Joined: 4/27/2007(UTC)
Posts: 4

many thanks wabbit
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.