Questions from Beginners MQL5 MT5 MetaTrader 5 - page 270

 
sergey2671:
Good afternoon, I have an EA written on mt4 can be remade on mt5
Freelancing will help you.
 
sergey2671:
Hello, I have an EA written in mt4, can I convert it to mt5?
Of course you can. Start studying MQL5.
 
zfs:
Freelancing will help you.
And how do we do it
 
Could you tell me how to write code that would put the last 3 prices of a tick into an array. or a link to a program with such or similar code. Thanks in advance.
 
soroko:
Could you suggest how to write code that the array would store the last 3 prices of the tick. Or give me a link to a program with such or similar code. Thank you in advance.

Forum on trading, automated trading systems and trading strategy testing

Questions from Beginners

tol64, 2014.07.02 18:40

Create an array and then in the OnTick() function check each tick if the price has changed, comparing the current price with the price in the first [0] element of the array. If it is different, then shift all values starting from the last one to the neighboring ones and place the current price in the first element of the array. Repeat this every tick.

Start writing the code yourself. When you fail and have questions - ask.
 
barabashkakvn:

Start writing your own code. When you fail and have questions, ask.
I got it, but I can't figure out what function is used to move values within the array. I understand that each tick should be compared with the existing one, but how to move them - that's the main question.
 
soroko:
I got it, but I can't understand what function is used to move values within the array. I understand that each tick should be compared with the existing one, but how to move them - this is the main question?

If it is different, shift all the values from the last to the neighbouring ones, and put the current price in the first element of the array.

This is not clear!

 
soroko:

If it is different, shift all the values from the last to the neighbouring ones, and put the current price in the first element of the array.

This one is not clear!

For example, ArrayCopy- you copy from array A[] to the intermediate array B[], then you return it back to array A[], but shift it by one and only write the new price value to array A[], to the first cell (A[0]).
 
soroko:

If it is different, shift all the values from the last to the neighbouring ones, and put the current price in the first element of the array.

This one is not clear!

Pr[4]=Pr[3];
Pr[3]=Pr[2];
Pr[2]=Pr[1];
Pr[1]=Pr[0];
Pr[0]=SymbolInfoDouble(_Symbol,SYMBOL_BID);
 
vicmos:
so only the first value is filled in with the index [0].
Reason: