Page 1 of 2

iSMI function needed

Posted: Tue Sep 15, 2009 1:57 am
by MarketSlayer
I found the code for a SMI Stochastic Momentum Indicator and I have no clue how to add this code to a library or something so I can call it like I do iStochastic etc.
Anyone know how to do it.....
See attached SMI indicator for the source code....
Thanks

Re: iSMI function needed

Posted: Tue Sep 15, 2009 9:31 am
by rowdy
MarketSlayer wrote:I found the code for a SMI Stochastic Momentum Indicator and I have no clue how to add this code to a library or something so I can call it like I do iStochastic etc.
Anyone know how to do it.....
See attached SMI indicator for the source code....
Thanks


Shut down MT4. Move this file to the Program Files/MetaTrader4/Experts/Indicators folder. Restart MT4. You will see it show up in the custom indicators panel in MT4 Navigator. Drag and drop into chart.

If your question is about how to call it up in a program, then you need to use the iCustom function in mql4. Go to www.mql4.com for more details.

Posted: Tue Sep 15, 2009 1:20 pm
by MarketSlayer
Yes, my question is how to make it a function that I call and pass the same parameters to it, just like iStochastic etc. I would like to be able to retrieve this across time frames etc etc...I am not sure how to modify the code to call the data from different time frames. Can anyone help on this?
Thanks

Posted: Wed Sep 16, 2009 12:16 am
by rowdy
MarketSlayer wrote:Yes, my question is how to make it a function that I call and pass the same parameters to it, just like iStochastic etc. I would like to be able to retrieve this across time frames etc etc...I am not sure how to modify the code to call the data from different time frames. Can anyone help on this?
Thanks


Slayer,
Use iCustom-
http://docs.mql4.com/indicators/iCustom

double val=iCustom(NULL, 0, "MS SMI",0,0); returns the current value for the white line on the current chart timeframe.
double val=iCustom(NULL, PERIOD_H1, "MS SMI",1,0); returns the current value for the red line on the H1 timeframe.

If you want to pass values, MS SMI uses four external inputs-

Period_Q
Period_R
Period_S
Signal

To Pass 5,6,7,2 on the M15 timeframe and get the value for the white line-
double val=iCustom(NULL, PERIOD_M15, "MS SMI",5,6,7,2,0,0);

Posted: Wed Sep 16, 2009 12:59 am
by MarketSlayer
I did use that, thanks soo much, that was great to get to work finally....

One item I am struggling with is the hard coding of a pair/currency... I want to create a dashboard with a list of multiple pairs.
When I set the symbol ="EURUSD" it bombs.

double a = iCustom(symbol,i, "MS SMI", 5,6,7,2,0,0) ;// Fast Line
double b = iCustom(symbol,i, "MS SMI", 5,6,7,2,1,0) ; // Slow Line

Any ideas??

Posted: Wed Sep 16, 2009 9:43 am
by rowdy
MarketSlayer wrote:I did use that, thanks soo much, that was great to get to work finally....

One item I am struggling with is the hard coding of a pair/currency... I want to create a dashboard with a list of multiple pairs.
When I set the symbol ="EURUSD" it bombs.

double a = iCustom(symbol,i, "MS SMI", 5,6,7,2,0,0) ;// Fast Line
double b = iCustom(symbol,i, "MS SMI", 5,6,7,2,1,0) ; // Slow Line

Any ideas??


Not sure, make sure symbol is defined as a string. Try using "EURUSD" instead of the variable symbol in the iCustom and see if that works. Also, do a search of iCustom in www.mql4.com. Here is a thread that may offer some help-
http://forum.mql4.com/21870

Posted: Wed Sep 16, 2009 8:31 pm
by flinux
A dashboard like that ?

Image

:wink:

Posted: Thu Sep 17, 2009 11:37 am
by MarketSlayer
Sure, what did you do to make it work across pairs? Can you post your code please?
Thanks, this looks great..I am struggling with the just showing an icon or the value of the indicator....

Posted: Thu Sep 17, 2009 12:11 pm
by flinux
OK.
Enjoy it.

Posted: Thu Sep 17, 2009 12:40 pm
by MarketSlayer
Nice work my comrad....
I had to update one piece for my Forex.com platform/feed.
string q[] = {"EURUSDFXF","GBPUSDFXF","USDJPYFXF","EURJPYFXF","GBPJPYFXF","USDCHFFXF","USDCADFXF","NZDUSDFXF"};
I updated the suffix to the pair text label... ahhhhhh that was the missing link.
QUESTION - explain your letters...is it B=Buy, S=Sell, W=Wait??
Thanks again.
Great lesson learned here..
Slayer of the Markets....LOL