- 2010.05.17
- Sergey Pavlov
- www.mql5.com
Im trying to make the simple moving average cross as a practise ea on mt5. Im confused as to how to select previous bars on the indicator.
heres the mt4 code of what im trying to do on mt5
double currentfast = iMA(NULL,0,fastma,fastmashift,fastmamethod,fastmaappliedto,1);
double previousslow = iMA(NULL,0,slowma,slowmashift,slowmamethod,slowmaappliedto,2);
double currentslow = iMA(NULL,0,slowma,slowmashift,slowmamethod,slowmaappliedto,1);
if(previousfast<previousslow && currentfast>currentslow)
{
if(OrderSend(Symbol(),OP_BUY,lotsize,Ask,3,Ask-(stoploss),Ask+(takeprofit),"Two Moving Average Crossover EA Trade",magicnumber,0,Green)==-1)
Print(GetLastError());
}
if (previousfast>previousslow && currentfast<currentslow)
{
if (OrderSend(Symbol(),OP_SELL,lotsize,Bid,3,Bid+(stoploss),Bid-(takeprofit),"Two Moving Average Crossover EA Trade",magicnumber,0,Red)==-1)
Print(GetLastError());
}
so how do i get the iMA on MT5 to look at previous bars like this one does?
Is it that hard to read the documentation ?
After months seeing you trying to get something with mql5, I would suggest you, kindly, to stop wasting your time and hire someone to get what you want.
Is it that hard to read the documentation ?
After months seeing you trying to get something with mql5, I would suggest you, kindly, to stop wasting your time and hire someone to get what you want.
I have read the documentation and it does not answer the question. Or maybe it does and I have missed it/ dont understand it.
This is the part where you either clarify/ go into detail about answering my question, or piss off.
Im trying to learn the code and I WILL learn the code so either make your comments usefull or take your stuck up attitude somewhere else.
Is it that hard to read the documentation ?
After months seeing you trying to get something with mql5, I would suggest you, kindly, to stop wasting your time and hire someone to get what you want.
and that second link you added was a question about when i was learning mt4. which ive learnt the basics of that but i thought mt5 would be better because its newer.
you really are a pessimist.
I have read the documentation and it does not answer the question. Or maybe it does and I have missed it/ dont understand it.
This is the part where you either clarify/ go into detail about answering my question, or piss off.
Im trying to learn the code and I WILL learn the code so either make your comments usefull or take your stuck up attitude somewhere else. s
The question was :
so how do i get the iMA on MT5 to look at previous bars like this one does?
I correctly and usefully said you to read the documentation, I provided you a link, and I gave you an opinion. You are free to dislike it, but you will have to stay correct and respectful and avoid any strong language.
The documentation about iMA for MT5 is very complete, even providing a full example source code. So if it doesn't help, show us your mql5 attempt and ask your question about what is not clear.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Im trying to make the simple moving average cross as a practise ea on mt5. Im confused as to how to select previous bars on the indicator.
heres the mt4 code of what im trying to do on mt5
double currentfast = iMA(NULL,0,fastma,fastmashift,fastmamethod,fastmaappliedto,1);
double previousslow = iMA(NULL,0,slowma,slowmashift,slowmamethod,slowmaappliedto,2);
double currentslow = iMA(NULL,0,slowma,slowmashift,slowmamethod,slowmaappliedto,1);
if(previousfast<previousslow && currentfast>currentslow)
{
if(OrderSend(Symbol(),OP_BUY,lotsize,Ask,3,Ask-(stoploss),Ask+(takeprofit),"Two Moving Average Crossover EA Trade",magicnumber,0,Green)==-1)
Print(GetLastError());
}
if (previousfast>previousslow && currentfast<currentslow)
{
if (OrderSend(Symbol(),OP_SELL,lotsize,Bid,3,Bid+(stoploss),Bid-(takeprofit),"Two Moving Average Crossover EA Trade",magicnumber,0,Red)==-1)
Print(GetLastError());
}
so how do i get the iMA on MT5 to look at previous bars like this one does?