Download MetaTrader 5

how to sell at two lines ema 7 as ema 21 overlap at that time

To add comments, please log in or register
Do you know that MQL5 is an object-oriented language?
Jhonson
35
Jhonson 2013.12.06 18:30 

how to sell at two lines ema 7 as ema 21 overlap at that time

Who can help me

Thanks

Tonny Obare
1024
Tonny Obare 2013.12.06 18:39  
Right click -> Trading -> New order
Jhonson
35
Jhonson 2013.12.06 18:41  
tonny:
Right click -> Trading -> New order
oh .... no. i want code a ea auto sell
whroeder1
14544
whroeder1 2013.12.06 19:00  
You have only three choices: Search for it, learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
Jhonson
35
Jhonson 2013.12.06 19:09  
WHRoeder:
You have only three choices: Search for it, learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.


thank you

i write code but it does not work

double pBid = MarketInfo(OrderSymbol(), MODE_BID);
double ma7 = pBid - iMA("EURJPYpro",PERIOD_M30,7,0,MODE_EMA,PRICE_CLOSE,1);
double ma21 = pBid - iMA("EURJPYpro",PERIOD_M30,21,0,MODE_EMA,PRICE_CLOSE,1);

if ( ma7  ==  ma21 ) 
{  BUY("EURJPYpro",LS,TP,SL,TS,"if ( ma7  ==  ma21)") ;}


code

if   ( iMA("EURJPYpro",PERIOD_M30,7,0,MODE_EMA,PRICE_CLOSE,0)  >  iMA("EURJPYpro",PERIOD_M30,21,0,MODE_EMA,PRICE_CLOSE,0) )
   {  BUY("EURJPYpro",LS,TP,SL,TS," ") ;}

it do work

can you help me Search error

thanks

whroeder1
14544
whroeder1 2013.12.06 19:50  
axbc: i write code but it does not work

if ( ma7  ==  ma21 ) 
  1. Of course not because they cross, they are (almost) never equal. The == operand. - MQL4 forum
  2. So check for a cross not levels
    double ma07cur = iMA(NULL,0, 7,0,MODE_EMA,PRICE_CLOSE,1),
           ma21cur = iMA(NULL,0,21,0,MODE_EMA,PRICE_CLOSE,1),
           ma07pre = iMA(NULL,0, 7,0,MODE_EMA,PRICE_CLOSE,2),
           ma21pre = iMA(NULL,0,21,0,MODE_EMA,PRICE_CLOSE,2);
    bool wasAbove = ma07pre > ma21pre,
          isAbove = ma07cur > ma21cur;
    if(isAbove != wasAbove) // Crossed.

  3. "EURJPYpro",PERIOD_M30
    Don't hard code symbols and periods when unnecessary. You want you EA to be able to work on other pairs and timeframes, don't you?
  4. double pBid = MarketInfo(OrderSymbol(), MODE_BID);
    Don't use function calls when you can use predefined variable Bid
Jhonson
35
Jhonson 2013.12.06 20:01  
WHRoeder:
  1. Of course not because they cross, they are (almost) never equal. The == operand. - MQL4 forum
  2. So check for a cross not levels


oh ... yes. i will try with it.

thank you :)

Jhonson
35
Jhonson 2013.12.06 20:14  
WHRoeder:
  1. Of course not because they cross, they are (almost) never equal. The == operand. - MQL4 forum
  2. So check for a cross not levels
  3. Don't hard code symbols and periods when unnecessary. You want you EA to be able to work on other pairs and timeframes, don't you?
  4. Don't use function calls when you can use predefined variable Bid


3. yes

4. I know now.

thank you

To add comments, please log in or register