Somebody help me on this code !!! - page 2

 
Trevhib:
Isn't the centre line that from which the outer lines' deviation is calculated? One thing is for sure, it's worth plotting that line as it is often a place of price reaction.
But it is NOT an EMA. Look at Bands.mql4:
 MovingBuffer[i]=iMA(NULL,0,BandsPeriod,BandsShift,MODE_SMA,PRICE_CLOSE,i);
 

Hello ! everybody, this is what i done but i think it's cut, not cut down. Somebody help me :

int Order = SIGNAL_NONE;


double iBB = iBands(NULL,0,18,2,0,PRICE_CLOSE,MODE_SIGNAL,0);

double EMA = iMA(NULL,0,3,1,MODE_EMA,PRICE_CLOSE,0);

double MACD = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,0);

double RSI = iRSI(NULL,0,14,PRICE_CLOSE,0);

if(iBB==EMA && RSI > 50 && MACD > 0 ) Order = SIGNAL_BUY;

if(iBB==EMA && RSI < 50 && MACD < 0 ) Order = SIGNAL_SELL;

//==================================================================

if (Order == SIGNAL_BUY){

Print("I am ready to BUY");

}

if (Order == SIGNAL_SELL){

Print("I am ready to SELL");

}

 
tieuthienma:

Hello ! everybody, this is what i done but i think it's cut, not cut down. Somebody help me :

int ......


Replace your code use SRC button


for giving code use SRC button see How to use the SRC button.

and replace your code..... then we can see how we translate your words into code

Now i want to check when EMA 3 cut down Middle Bollinger bands and

RSI 14 over 50%

and MACD Histogram over 0 the code return to me BUY.

IF EMA 3 cut down Middle Bollinger bands

and RSI 14 below 50%

and MACD Histogram below 0 the code return to me SELL.

 
//+------------------------------------------------------------------+
//|                                                      SwingEA.mq4 |
//|                                       Copyright 2013, Alvintran. |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, Alvintran."
#property link      ""

extern double Lots = 0.05;

#define SIGNAL_NONE 0
#define SIGNAL_BUY   1
#define SIGNAL_SELL  2

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   int Order = SIGNAL_NONE;
   int digit  = MarketInfo(Symbol(),MODE_DIGITS);
   int Ticket;
   
   double Upline = iBands(NULL,0,20,2,0,PRICE_OPEN,MODE_UPPER,0);
   double Downline = iBands(NULL,0,20,2,0,PRICE_OPEN,MODE_LOWER,0);
   
   double Middle = (Upline+Downline)/2;
   
   double EMA = iMA(NULL,0,3,0,MODE_EMA,PRICE_OPEN,0);
   double MACD = iMACD(NULL,0,12,26,9,PRICE_OPEN,MODE_SIGNAL,0);
   double RSI = iRSI(NULL,0,14,PRICE_CLOSE,0);
   
   if( (Middle==EMA) && (RSI > 50) && (MACD > 0) ) Order = SIGNAL_BUY;
   if( (Middle==EMA) && (RSI < 50) && (MACD < 0) ) Order = SIGNAL_SELL;
   //==================================================================
   
   if (Order == SIGNAL_BUY){
      
      Ticket = OrderSend(Symbol(),OP_BUY,Lots,NormalizeDouble(Ask,digit),3,0,0,"Buy",0,0,DodgerBlue);
      Print("BUY order opened : ", OrderOpenPrice());
   }
   
   if (Order == SIGNAL_SELL){
      
      Ticket = OrderSend(Symbol(),OP_SELL,Lots,NormalizeDouble(Bid,digit),3,0,0,"Sell",0,0,DeepPink);
      Print("BUY order opened : ", OrderOpenPrice());
   }
   
   //Print("Middle line : ",Middle," - IMA : ",EMA);
//----
   return(0);
  }
//+------------------------------------------------------------------+
The code not work :(
 

RSI 14 over 50% return to me BUY.

RSI 14 below 50% return to me SELL.

//Relative Strength Index
bool BuySignal1=false, SellSignal1=false;
if(UseSignal1)     //extern int UseSignal1 = true;
{
  double RSI_0 = iRSI(NULL,0,14,PRICE_CLOSE,0);

   if (RSI_0 > 50) {BuySignal1 = true;}
   if (RSI_0 < 50) {SellSignal1 = true;}  
}
else {SellSignal1=true;BuySignal1=true;}

Check this code..... line for line

next to do easy part same for....

MACD Histogram over 0 the code return to me BUY.

MACD Histogram below 0 the code return to me SELL.

you can make it show it...

 
WHRoeder:
But it is NOT an EMA. Look at Bands.mql4:


I didn't suggest anything other than that a centre line ought be included as it's part and parcel of the calculation of the bands themselves and as such can be an area of confluence. It's up to the EA's author to code it correctly, according to whatever their requirements are.

Just for info, taken from: http://www.investopedia.com/articles/technical/102201.asp

"Bollinger Bands® consist of a center line and two price channels (bands) above and below it. The center line is an exponential moving average; the price channels are the standard deviations of the stock being studied. The bands will expand and contract as the price action of an issue becomes volatile (expansion) or becomes bound into a tight trading pattern (contraction)."

 
That was my point. The investopedia and mql4 do not match
 
Oh I see. It may have avoided some confusion if the mismatch had been stated in response to one of the coding posts, or to tieuthienma directly, as it's not me that's looking to code and test this.