MQL4 Learning - page 132

 
Ovo:
Most EAs follow trades by a magic number. In such case you may enter zero to magic number for taking care of manual trades.

Mmmm, thanks Ovo, I will have a look at that .

That could be an idea.

Thanks.

Tomcat98

 
Tomcat98:
Mmmm, thanks Ovo, I will have a look at that .

That could be an idea.

Thanks.

Tomcat98

Just make sure that some EA is not using 0 as a magic number

 
sebastianK:
Man, there is thousands of sources there. Did not think that they are so opened

They are too big to hide everything. Sure there are things that are hidden, but they are, unlike metatrader, aware that if they do not help coders, the coders will go somewhere else. And, the best help in learning coding is to see how somebody that already knows to do it does it

 

Just a warning to coders : metatrader have changed in build 646 how file functions are working (already found that FileReadString() works differently than before - if you find that you are having problems with low level file operations, check each and every result of each and every file function before checking anything else - almost sure that the problem you have will be located in one of the file functions)

So, once again, they are changing functions on the fly and we are, once again, forced to find out what did they change and they did not tell a single word about it

 

Can you please explain what is the exact change (I am having trouble with one such code)?

 
checkin:
Can you please explain what is the exact change (I am having trouble with one such code)?

One simple example : before FileReadString(handle,65536); would read either 65536 bytes or less. Now, if the file is shorter than those 65536 bytes it reads 0 bytes (at least that is the case I had in one code part that was causing problems)

When I changed it to FileReadString(handle,0) it started to work again. But it is obvious that they are messing with file functions again

 
mladen:
One simple example : before FileReadString(handle,65536); would read either 65536 bytes or less. Now, if the file is shorter than those 65536 bytes it reads 0 bytes (at least that is the case I had in one code part that was causing problems) When I changed it to FileReadString(handle,0) it started to work again. But it is obvious that they are messing with file functions again

And now it works again.

Getting a bit tired from things not working one day and then working the other day (or vice versa) without any sign of updates or being notified that something is changed. This is not a way how a coding language is developed

 
mladen:
And now it works again. Getting a bit tired from things not working one day and then working the other day (or vice versa) without any sign of updates or being notified that something is changed. This is not a way how a coding language is developed

That is the same impression that I got too : that something sometimes works and then it does not. I can not understand why it happens

 

Hi,

I want to save the Highest and Lowest MACD Values of the actual underlying with follwing function:

double MACD_Max = 0;

double MACD_Min = 10000;

for(int i = (Bars-1); i>=0; i--)

{

if(iMACD(Symbol(),IndiTimeframe,12,26,9,PRICE_CLOSE,MODE_MAIN,i)>MACD_Max)

MACD_Max = iMACD(Symbol(),IndiTimeframe,12,26,9,PRICE_CLOSE,MODE_MAIN,i);

if(iMACD(Symbol(),IndiTimeframe,12,26,9,PRICE_CLOSE,MODE_MAIN,i)<=MACD_Min)

MACD_Min = iMACD(Symbol(),IndiTimeframe,12,26,9,PRICE_CLOSE,MODE_MAIN,i);

Print("i = "+i+" MACD_Max = "+MACD_Max+ " MACD_Min = "+ MACD_Min+ " IndiTimeframe = "+ IndiTimeframe + "akutell = "+iMACD(Symbol(),IndiTimeframe,12,26,9,PRICE_CLOSE,MODE_MAIN,i) );

}

I am not getting the correct values, but don't no why?!

 
sunshineh:
Hi,

I want to save the Highest and Lowest MACD Values of the actual underlying with follwing function:

double MACD_Max = 0;

double MACD_Min = 10000;

for(int i = (Bars-1); i>=0; i--)

{

if(iMACD(Symbol(),IndiTimeframe,12,26,9,PRICE_CLOSE,MODE_MAIN,i)>MACD_Max)

MACD_Max = iMACD(Symbol(),IndiTimeframe,12,26,9,PRICE_CLOSE,MODE_MAIN,i);

if(iMACD(Symbol(),IndiTimeframe,12,26,9,PRICE_CLOSE,MODE_MAIN,i)<=MACD_Min)

MACD_Min = iMACD(Symbol(),IndiTimeframe,12,26,9,PRICE_CLOSE,MODE_MAIN,i);

Print("i = "+i+" MACD_Max = "+MACD_Max+ " MACD_Min = "+ MACD_Min+ " IndiTimeframe = "+ IndiTimeframe + "akutell = "+iMACD(Symbol(),IndiTimeframe,12,26,9,PRICE_CLOSE,MODE_MAIN,i) );

}

I am not getting the correct values, but don't no why?!

What is the value of IndiTimeFrame?

If it is not 0 than you have to retrieve the values differently. Also, you are retrieving the maximal and minimal value of macd of the whole chart (all the bars visible on the chart not just in the current window)

Reason: