• Join us

problems with an EA

To add comments, please log in or register
mkowal
22
mkowal  
hi, I have just started my adventure with MQL4 and I am really impressed with the possiblities of the system. I have written a simple custom indicator which doesn't work as it should. It is an indicator which should calculate the highest and lowest values of a day, and draw the highest and the lowest lines during the whole next day. the indicator does the job as it should, but only once - when the next bar comes, all values drop down to zero... I have no idea why.... . everything looks like it's ok - but well it doesn't work. Would anybody help me ? attached is the custom indicator. It also doesn't want to print on the screen the short name of the indicator.... Thank you in advance, mkowal
Matt
77
Matt  

You have this declaration both in global and under start():

double TodayHigh, PreviousHigh, TodayLow, PreviousLow;

I'm not sure, but I think that means they'll be cleared out on new tik when Start is run. I'd try commenting out "//" the extra declaration in the start function. Not near my MT4 machine, so no solid backup on that, but that's my gut feeling after glancing at the code.

-matt

mkowal
22
mkowal  
I have changed the following section: limit=Bars-1; for(i=limit+1; i>=0; i--) {. .. and it works.... !!! and of course I removed the double declaration of variables. thank you. But still no short name appears on the screen... :)
To add comments, please log in or register