if(OrdersTotal()<1){ if(iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,1)<(iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_MAIN,1))){ if(iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,0)>(iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_MAIN,0))){ { /*buy*/ }}}} if(OrdersTotal()<1){ if(iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,1)>(iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_MAIN,1))){ if(iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,0)<(iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_MAIN,0))){ { /*sell*/ }}}} int BuyMagicNumber; OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES); if(OrdersTotal()>0){ if(OrderMagicNumber()== BuyMagicNumber){ if(iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,1)>(iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_MAIN,1))){ if(iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,0)<(iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_MAIN,0))){ // create a separate block of code for the || function. Write it directly below. { OrderClose(ticket,0.10,Ask,30,CLR_NONE); }}}}} int SellMagicNumber; OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES); if(OrdersTotal()>0){ if(OrderMagicNumber()== SellMagicNumber){ if(iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,1)<(iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_MAIN,1))){ if(iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,0)>(iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_MAIN,0))){ // create a separate block of code for the || function. Write it directly below. { OrderClose(ticket,0.10,Bid,30,CLR_NONE); }}}}} // before you send your ticket be sure to declare your ticket as "ticket" // example: ticket = OrderSend(Symbol(),OP_BUY,0.10,Ask,30,Ask-300*Point,Ask+450*Point,"",12345,0,Blue);
Use the "SRC" button to insert your code when you need assistance (when you create a new message, the "SRC" button is located at the top left corner of the new message box).
Thank you.
//whoodoo22
thx buddy, that was excetly what i did wrong! thx again.
I campared current band instead of (1)shift band.
lots help thx!
Yeah, I'm the best. ;)
Thank you.
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
hi...
I made one simple Ea. but this looks like doesn't work right.. but not tooooooo wrong...
sometimes works right but few times... this looks like losing focus what this guy had to do;;;;...
to have any position or changing position... sometimes lose signal that i can't find y...
can someone plz help me what's wrong with this guy?
or is this just normal? because this is just backtest? and might comes different? with forward test? idk now;;; plz...
entry logic.
if (ema5_prev < band20 && ema5_curt > band20)
{
Order = SIGNAL_BUY;
}
if (ema5_prev > band20 && ema5_curt < band20)
{
Order = SIGNAL_SELL;
}
buy exit logic
if(ema5_prev > band20 && ema5_curt < band20 || ema5_curt < band20)
{
Order = SIGNAL_CLOSEBUY;
}
sell exit logic
if(ema5_prev < band20 && ema5_curt > band20 || ema5_curt > band20)
{
Order = SIGNAL_CLOSESELL;
}