[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 189

 

I used to learn the basics of programming (25 years ago - Algol 60 :))) At that time, everything started with creating an algorithm (squares, rhombuses), and then this algorithm was described with a language. Now I don't see any algorithms or commands.

Do you guys have any recommendations for good tutorials on mql4? Preferably with concrete examples of expert writing, starting from the algorithm.

 
v721965 писал(а) >>

I used to learn the basics of programming (25 years ago - Algol 60 :))) At that time, everything started with creating an algorithm (squares, rhombuses), and then this algorithm was described with a language. Now I don't see any algorithms or commands.

Do you guys have any recommendations for good tutorials on mql4? Preferably with specific examples of EA writing, starting from the algorithm.

https://book.mql4.com/ru/

 
alvish >> :
pro please advise, according to mql5 language help there is no function iHighest how to calculate maximal high for N period? ... I have tried copyHigh and fmax, but only for a certain period and not that of course, help

Here's an example:

         int shift_Box_Start = iBarShift(NULL, 0, TimeBoxStart);
         Box_Start_High      = High[iHighest(NULL, 0, MODE_HIGH, shift_Box_Start- i, i+1)];
         Box_Start_Low       =  Low[iLowest(NULL,  0, MODE_LOW,  shift_Box_Start- i, i+1)];

Just make sure you get the shifters right.

 

1. Trying to run the EA in test mode with visualisation. The EA is simple: it generates a message through Alert. When Alert is in init, the message is given at start. When it is in start, the EA does not react to a new tick. What is the problem?

2. In the same test mode, I also start a script, which displays the values of Time[1], Close[1],... (for reference). I found out that these values are based on the current (actual) time and not on the time of ticks receipt and bars formed in the chart. What can be done?

 
Roger писал(а) >>

For EURGBP it returns - 0 (that's Alpari) short and -0.68 long and that's exactly in dollars.

For Alpari the swap calculation type is 0 and mine is 1,

I need to know all types of calculations though.

I tried all combinations: multiplication, division or no multiplication at all.

Here is the code that calculates all this and returns closest to the real swap value.

int a,b,c,d,dd;

dd=1;

double raznica;

for ( j=OrdersHistoryTotal( )-1; j>=OrdersHistoryTotal( )-21; j--) {

int a_=0,b_=0,c_=0,d_=0;

raznica=1000000;

OrderSelect(j, SELECT_BY_POS, MODE_HISTORY);

if(OrderSwap()!=0){

if(OrderType()==OP_BUY){

for(a=-dd;a<=dd;a++){

for(b=-dd;b<=dd;b++){

for(c=-dd;c<=dd;c++){

for(d=-dd;d<=dd;d++){

double gg=MathPow(MarketInfo(OrderSymbol(),MODE_SWAPLONG),a)*MathPow(OrderLots(),b)*MathPow(MarketInfo(OrderSymbol(),MODE_TICKVALUE),c)*MathPow(MarketInfo(OrderSymbol(),MODE_BID),d);

if(MathAbs(gg-OrderSwap())<raznica){raznica=MathAbs(gg-OrderSwap());a_=a;b_=b;c_=c;}

}}}}

Alert(" РЕАЛЬНЫЙ СВОП = "+OrderSwap()+"РАСЧЕТНЫЙ СВОП = "+gg+"\n a= "+a_+" b = "+b_+" c = "+c_+" d = "+d_);

}//if(OrderType()==OP_BUY){

if(OrderType()==OP_SELL){

for(a=-dd;a<=dd;a++){

for(b=-dd;b<=dd;b++){

for(c=-dd;c<=dd;c++){

for(d=-dd;d<=dd;d++){

gg=MathPow(MarketInfo(OrderSymbol(),MODE_SWAPSHORT),a)*MathPow(OrderLots(),b)*MathPow(MarketInfo(OrderSymbol(),MODE_TICKVALUE),c)*MathPow(MarketInfo(OrderSymbol(),MODE_BID),d);

if(MathAbs(gg-OrderSwap())<raznica){raznica=MathAbs(gg-OrderSwap());a_=a;b_=b;c_=c;}

}}}}

Alert(" РЕАЛЬНЫЙ СВОП = "+OrderSwap()+"РАСЧЕТНЫЙ СВОП = "+gg+"\n a= "+a_+" b = "+b_+" c = "+c_+" d = "+d_);

}//if(OrderType()==OP_SELL){

}//if(OrderSwap()!=0){

}//for ( j=OrdersHistoryTotal( )-1; j>=OrdersHistoryTotal( )-21; j--) {

I got no results either for Alpari or BROCO.

I.e.

MarketInfo(OrderSymbol(),MODE_SWAPLONG)

OrderLots()

MarketInfo(OrderSymbol(),MODE_TICKVALUE)

MarketInfo(OrderSymbol(),MODE_BID)

Not enough for swap calculation.

There must be something else, but what is it?

 
Thanks chief2000, but you wrote through the standard iHighest and iLowest, that's the problem, and they are not in mql 5
 
alvish >> :
Thank you chief2000, but you wrote through the standard iHighest and iLowest, that's the problem with mql 5.

Now I see that I didn't read the question carefully.

Do I really have to describe everything manually in version 5? Something's not right here - maybe there's a problem with the documentation?

 
there you go.
 
vasya_vasya >> :

For Alpari the swap calculation type is 0 and mine is 1,


Vasya, why are you bothering? I told you here 'Swaps in mql4' very briefly

i can go into details,

there are 4 variants in total

each with a different formula.

 
kaisa писал(а) >>

Vasya, why are you bothering? I told you here 'Swaps in mql4' briefly.

I can go into more detail if you need it,

there are 4 variants in total

for each a different formula

yes, can i have the other formulas?

Reason: