You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
hello, help the aid can do a couple of crosses 4 EMA
I not see speak very well, help crosses theses 4 EMA for my EA
5
13
21
80
Enter trade BUY when:
EMA 5 crosses above the EMA 13 and EMA 21
Both EMA 13 and EMA 21 are above EMA 80
Enter trade SELL when:
EMA 5 crosses below the EMA 13 and EMA 21
Both EMA 13 and EMA 21 are below EMA 80
Thanks
I not see speak very well Inglesh
Sorry ..............
Oh dear
I think.It's ok, But we must have Big margin.
I not see speak very well, help crosses theses 4 EMA for my EA
5
13
21
80
Enter trade BUY when:
EMA 5 crosses above the EMA 13 and EMA 21
Both EMA 13 and EMA 21 are above EMA 80
Enter trade SELL when:
EMA 5 crosses below the EMA 13 and EMA 21
Both EMA 13 and EMA 21 are below EMA 80
ThanksHave a look here http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/ and I'm sure you'll be able to construct your own EA.
Good luck!
Have a look here http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/ and I'm sure you'll be able to construct your own EA. Good luck!
That's great thanks a lot How does the buy and sell syntax work/
Say I choose custom indicator and I want to use a bar indicator to buy and sell when bar changes colour?
I tried putting in name of indicator and parameter left > right but it does not open a buy or sell
hi,
please, someone can add MM to this version of ema cross ?
thanks
//+------------------------------------------------------------------+
//| EMA_CROSS.mq4 |
//| Coders Guru |
//| Forex TSD| Metatrader Indicators and Experts Advisors |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| TODO: Add Money Management routine |
//+------------------------------------------------------------------+
#property copyright "Coders Guru"
#property link "https://www.forex-tsd.com"
//---- input parameters
extern double TakeProfit=110;
extern double StopLoss=100;
extern double TrailingStop=30;
extern int ShortEma = 1;
extern int LongEma = 13;
extern bool UseStopLoss = false;
extern double Lots=1;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
bool isNewSumbol(string current_symbol)
{
//loop through all the opened order and compare the symbols
int total = OrdersTotal();
for(int cnt = 0 ; cnt < total ; cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
//Print( "OrderSymbol = " + OrderSymbol() + ": Symbol = " + current_symbol);
string selected_symbol = OrderSymbol();
if (current_symbol == selected_symbol)
return (False);
}
return (True);
}
int Crossed (double line1 , double line2)
{
static int last_direction = 0;
static int current_direction = 0;
//Don't work in the first load, wait for the first cross!
static bool first_time = true;
if(first_time == true)
{
first_time = false;
return (0);
}
if(line1>line2)current_direction = 1; //up
if(line1<line2)current_direction = 2; //down
if(last_direction == 0) //first use
{
last_direction = current_direction;
return(0);
}
if(current_direction != last_direction) //changed
{
last_direction = current_direction;
return (last_direction);
}
else
{
return (0); //not changed
}
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
int cnt, ticket, total;
double SEma, LEma;
if(Bars<100)
{
Print("bars less than 100");
return(0);
}
if(TakeProfit<10)
{
Print("TakeProfit less than 10");
return(0); // check TakeProfit
}
SEma = iMA(NULL,0,ShortEma,0,MODE_EMA,PRICE_CLOSE,0);
LEma = iMA(NULL,0,LongEma,0,MODE_EMA,PRICE_CLOSE,0);
static int isCrossed = 0;
isCrossed = Crossed (LEma,SEma);
total = OrdersTotal();
if(total < 1 || isNewSumbol(Symbol()))
{
if(isCrossed == 1 )
{
if(UseStopLoss)
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,"EMA_CROSS",12345,0,Green);
else
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Ask+TakeProfit*Point,"EMA_CROSS",12345,0,Green);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
return(0);
}
if(isCrossed == 2)
{
if(UseStopLoss)
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+StopLoss*Point,Bid-TakeProfit*Point,"EMA_CROSS",12345,0,Red);
else
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,Bid-TakeProfit*Point,"EMA_CROSS",12345,0,Red);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
}
else Print("Error opening SELL order : ",GetLastError());
return(0);
}
return(0);
}
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
//OrderPrint();
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY) // long position is opened
{
/*
// should it be closed?
if(isCrossed == 2)
{
OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // close position
return(0); // exit
}*/
// check for trailing stop
if(TrailingStop>0){
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
return(0);
}
}
}
}
else // go to short position
{
/*
// should it be closed?
if(isCrossed == 1)
{
OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); // close position
return(0); // exit
}*/
// check for trailing stop
if(TrailingStop>0){
if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
{
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
return(0);
}
}
}
}
}
}
return(0);
}
//+------------------------------------------------------------------+
Hi folks,
Could somebody tell me what does he think about this simple EA?
It works good in metatrader back tester .
Note: The back testing optimized for the maximum accuracy results.Hi Codersguru,
This forum is great! May I know is EMA_CROSS.mq4 the latest updated version
that we can test??
thanks
Auto robot
HEllo friends, i want you all to help me, can some one send me the best AUTO ROBOT available with any of you all bez i need it bez i have lost lot of money and need to recover it and i am not able to find a good AUTO ROBOT for the forex trading.. if some one can help me do so.. mail me you EA to bhavsar.y@gmail.com