MQL4 Learning - page 117

 

Calls function is really simple. Just you must write in code: name_of_fuctionst(arguments);

egzample:

void test_1(int a){

Print(a);

}

void test_2(){

Print("test2");

}

int test_3(int a, int b){

return(a+b);

}

int start()

{

test_1(456);

test_2();

int b = test_3(5,7);

Print("b");

}

Regards

 

Close Value On Bar Zero.

How does the iClose() function work? In other words when I look on my chart and identify a bar 0, shouldn't this function pick up the value of the close for that particular bar? In putting together an EA, I was able to tie-out bar 1 and bar 2 close values from the iClose() function with the previous bar's close value on the chart as well as the bar prior to this. What I noted was that my iClose() function for bar 0 is not picking up the last tick value for the last tick in the data.

See Attachments.

Files:
closevalue1.jpg  422 kb
closevalue2.jpg  424 kb
 

MT4 vectors?

Hello,

Is there any way to create a Vector in mq4 as a way to avoid the use of arrays?

I learnt to program in java, which allows Vectors, I was wondering if there was any way to use something similar for my EA.

thank you in advance.

 

Not familiar with Java too much, but from what I read, if you strip vector from added methods it is a simple one dimensional array of (anything). But since there is no way to replicate class methods in metatrader 4 in an acceptable way, you are stuck to arrays

JohnCrawdford:
Hello,

Is there any way to create a Vector in mq4 as a way to avoid the use of arrays?

I learnt to program in java, which allows Vectors, I was wondering if there was any way to use something similar for my EA.

thank you in advance.
 

my suggestion would be

take a look at plenty of EA, and see how other people do it

-----

 
forexsurfr:
How does the iClose() function work? In other words when I look on my chart and identify a bar 0, shouldn't this function pick up the value of the close for that particular bar? In putting together an EA, I was able to tie-out bar 1 and bar 2 close values from the iClose() function with the previous bar's close value on the chart as well as the bar prior to this. What I noted was that my iClose() function for bar 0 is not picking up the last tick value for the last tick in the data. See Attachments.

[lang=pl]iClose gives you back an close value. There is no close value for current candle. If need last tick value you shoul declare for exampe double LastTickValue

and before the end of strat function put LastTickValue = Bid/Ask (depends what you want). Then in the next tick you will have last tick price in this variable. I hope that is what you want.[/lang]

 

hot to get and set trendline color

HI,

I'm new to programming with metaeditor.I want to get the color of a trendline with a specific description with 'a_#' with # can be any number but 'a_' must be in all of them.

and How can I set the color for that trend line with that description?

Thanks

 

How to type the DN and UP of RSI in MT4?

i want to learn that how to use the loop or for or while ,TKS very much

 

How to tell if platform is frozen

Hey there,

Trying to figure out how to tell if a platform is frozen. I was going to write out a tick data EA that will populate a csv file with the time that the data is written out. Then, an outside app will be constantly reading that file,, and if it finds a timestamp longer than a couple minutes, it would raise a flag. Is there a more efficient way of doing this?

Thanks

 

Day Filter & Close All Order

Hello guys

Can somebody help/show me how to add "Day Filter" & "Close All Order" function. For e.g if someone doesn't want to trade on Friday(select friday for both function), then the function should not open any new trade on fridays and also should automatically close all open orders/pending orders of the previous days.

Thanks in advance :-)

Regards

Reason: