Download MetaTrader 5

Confirming trade with another Symbol

To add comments, please log in or register
timothysmith78
32
timothysmith78  

Hi guys,

If someone could shed some light on my problem, it would be greatly appreciated. The EA is checking the EURUSD Bollinger bands (Chart it is attached to), but not the USDJPY Bollinger Bands.

Can anyone see why it isn't checking the USDJPY BB's also? 

Thanks.

void CheckForBollingerBandTrade()
{

double sls =0,slb =0;
int buyticket=0,sellticket=0; 
sls=Ask-StopLoss*pips;
slb=Bid+StopLoss*pips;
static datetime TimeSent;


   double LowerBB=iBands(NULL,0,19,2,0,0,MODE_LOWER,1);
   double LowerUSDJPYBB=iBands("USDJPY",0,19,2,0,0,MODE_LOWER,1);
   double UpperBB=iBands(NULL,0,19,2,0,0,MODE_UPPER,1);
   double UpperUSDJPYBB=iBands("USDJPY",0,19,2,0,0,MODE_UPPER,1);
 
   double USDJPYBid = MarketInfo("USDJPY",MODE_BID);
   double USDJPYAsk = MarketInfo("USDJPY",MODE_ASK);
   
     // if(Ask<LowerBB&&Ask<HourLLowerBB&&MFI<35)
     if(Ask<LowerBB&&USDJPYBid>UpperUSDJPYBB)
      if(OpenOrdersThisPair(Symbol())<=MaximumOpenTrades-1)
      if (TimeCurrent() >= TimeSent + (WaitTime *60))
      if (OrderSend(Symbol(),OP_BUY,LotSize,Ask,3,sls,0,NULL,MagicNumber,0,Green))
      TimeSent = TimeCurrent();
      if(buyticket>0)
      if (OrderModify(buyticket,OrderOpenPrice(),sls,NULL,0,CLR_NONE))
          Print("Order ",buyticket," was successfully modified.");
           else Print("Order ",buyticket," was NOT successfully modified.",GetLastError());
      
     // if(Bid>UpperBB&&Bid>HourUUpperBB&&MFI>65)
      if(Bid>UpperBB&&USDJPYAsk<LowerUSDJPYBB)
      if(OpenOrdersThisPair(Symbol())<=MaximumOpenTrades-1)
      if (TimeCurrent() >= TimeSent + (WaitTime *60))
      if (OrderSend(Symbol(),OP_SELL,LotSize,Bid,3,slb,0,NULL,MagicNumber,0,Red))
      TimeSent = TimeCurrent();
      if(sellticket>0)
      if (OrderModify(sellticket,OrderOpenPrice(),slb,NULL,0,CLR_NONE))
            Print("Order ",sellticket," was successfully modified.");
            else Print("Order ",sellticket," was NOT successfully modified.",GetLastError());       
      
}
Carl Schreiber
Moderator
7813
Carl Schreiber  

Why do you think that: "...it isn't checking the USDJPY BB's also?"

  1. Go through your EA with the debugger!
  2. Show the values and the results of tests using Comment() (or Print).

This way you'll get your answers a lot earlier!!

Calli

To add comments, please log in or register