How to code? - page 339

 

Hi apprentice coder!

I have got a include file which use it, and the input for it is the "Close" from mql4.

I don't now why the coder has done it this way... :-o

Bye, AT

 

Whenever you use price arrays they have to be declared like that (that is because mt is trying to prevent price changes by the code)

 

Hi!

How can I make the code to work with M5 and H1 data? So I need the display/data for MA(CD) of H1 and M5. So

I took this code to get the values... But it dowsn't work, or better I don't get it...

Any ideas?

int h1shift = iBarShift(NULL,PERIOD_H1,iTime(NULL,PERIOD_M5,i),true);

MACDH1=iMACD(NULL,PERIOD_H1,12,26,9,PRICE_CLOSE,MODE_SIGNAL,h1shift+1);

Thanks for help!

Bye, AT

 
at120:
Hi!

How can I make the code to work with M5 and H1 data? So I need the display/data for MA(CD) of H1 and M5. So

I took this code to get the values... But it dowsn't work, or better I don't get it...

Any ideas?

int h1shift = iBarShift(NULL,PERIOD_H1,iTime(NULL,PERIOD_M5,i),true);

MACDH1=iMACD(NULL,PERIOD_H1,12,26,9,PRICE_CLOSE,MODE_SIGNAL,h1shift+1);

[/PHP]

Thanks for help!

Bye, AT

Try like this (it will display corresponding H1 data for the current chart) :

[PHP] int h1shift = iBarShift(NULL,PERIOD_H1,Time);

MACDH1=iMACD(NULL,PERIOD_H1,12,26,9,PRICE_CLOSE,MODE_SIGNAL,h1shift+1);

If you want to use M5 data, then you have to do the same procedure for M5 time frame too - but it will not work correctly if your chart time frame is higher than M5 or H1

 

Hi Mladen!

Again, thanks a lot for your answer and help!

This code now is simpler and it works for me fine.

Now I have an other problem with one of "my" subfunction...

See the code, as output I get a zero... :-//

and a warning from the compiler: "indicator buffer is less than needed" ?!

Do you have any idea why?

Thanks for your support!

Bye, AT

test.mq4

Files:
test.mq4  2 kb
 
at120:
Hi Mladen!

Again, thanks a lot for your answer and help!

This code now is simpler and it works for me fine.

Now I have an other problem with one of "my" subfunction...

See the code, as output I get a zero... :-//

and a warning from the compiler: "indicator buffer is less than needed" ?!

Do you have any idea why?

Thanks for your support!

Bye, AT

test.mq4

Check it out now : _test.mq4

Files:
_test.mq4  2 kb
 

Hi Mladen!

This one worked! ;-)) Thanks man!

BTW, I have also an test_indi where I have the problem, it shows me sometimes two arrows on one bar.

This shouldn't be. I just want one arrow on bar (either up or down arrow) and I want it not on actual bar,

so I got this piece of code but I didn't got the right value?! What I'm doing wrong?

Any idea?

Thanks for your help!

Bye, AT

test_indi.mq4

Files:
test_indi.mq4  2 kb
 
at120:
Hi Mladen!

This one worked! ;-)) Thanks man!

BTW, I have also an test_indi where I have the problem, it shows me sometimes two arrows on one bar.

This shouldn't be. I just want one arrow on bar (either up or down arrow) and I want it not on actual bar,

so I got this piece of code but I didn't got the right value?! What I'm doing wrong?

Any idea?

Thanks for your help!

Bye, AT

test_indi.mq4

Add these two lines right before the two if conditions you have in code :

CrossUp = EMPTY_VALUE;

CrossDown = EMPTY_VALUE;

It should prevent what you are having

 

Hi Mladen!

Thanks for input!

I have added these two lines, but without any success...

See the picture...

Maybe the problem restults from the fact, that the value is not in between the range?

because range/limit is: +18 for e.g. buy and -50 for a sell...

Bye, AT

Files:
test_indi.jpg  33 kb
 

Hi guys!

An other "interessting" point is, that I have some indis with no vaule.

When I use it on M5 (which is the indi for) I get no value, if I use it with H1,

I get some values!? What I'm doing wrong?

It's the same indi as test, the only thing I changed was the formular of IndicatorOutput (somthing like MACD1 * 23)

Thanks for help and inputs!

Bye, AT