this is weird

 

hi guys i have coded this ea and it work fine to some dgree m i been trying for the couble of days to figure out what is wrong bur i cant find it m i tried using some print statment in attempt to find the error but no luch , i dont even get ordersenf error or somthing from this sort to even start with m can you guys please help , i know probaliy it to much to ask for but i will be thankfull , the problem is i got a notfication from cheack_buy_condition but no order i order sent my only limitation is the order number and even if ther is no order opened in that symbol sime of them does not open please see attachment for more details thanks again

if(cheack_buy_condition()==True && total(OP_BUYLIMIT)==0 && total(OP_BUY)==0)
    {
     double buy_triger=Close[1];
     double buy_stop_price=lowest_bar(20);
     double buy_open_price=buy_triger-((buy_triger-buy_stop_price)/2);
     double buy_profit_price=buy_open_price+((buy_open_price-buy_stop_price)*ratio);
     double i_stop_in_pip=(buy_open_price-buy_stop_price)/mypoint;
     double market_buy_profit=Bid+((Bid-buy_stop_price)*ratio);
     double market_buy_stop_in_pip=(Bid-buy_stop_price)/mypoint;
OrderSend(Symbol(),OP_BUYLIMIT,CalculateLotSize(i_stop_in_pip,1),NormalizeDouble(buy_open_price,Digits),3,NormalizeDouble(buy_stop_price,Digits),NormalizeDouble(buy_profit_price,Digits),"",0,TimeCurrent()+(Period()*60*30),Red);  
     if(use_limit==True){OrderSend(Symbol(),OP_BUYLIMIT,CalculateLotSize(i_stop_in_pip,risk),NormalizeDouble(buy_open_price,Digits),3,NormalizeDouble(buy_stop_price,Digits),NormalizeDouble(buy_profit_price,Digits),"",0,TimeCurrent()+(Period()*60*30),Red);}  
     if(use_limit==False){OrderSend(Symbol(),OP_BUY,CalculateLotSize(market_buy_stop_in_pip,risk),Ask,3,NormalizeDouble(buy_stop_price,Digits),NormalizeDouble(market_buy_profit,Digits),"",0,0,Red);}  
    }



bool cheack_buy_condition(){
double ma_1=iMA(Symbol(),0,ma,0,MODE_EMA,PRICE_CLOSE,1);
double ma_2=iMA(Symbol(),0,ma,0,MODE_EMA,PRICE_CLOSE,2);
double macd_1=iCustom(Symbol(),0,"MACD True",FastMAPeriod,SlowMAPeriod,SignalMAPeriod,0,1);
double macd_2=iCustom(Symbol(),0,"MACD True",FastMAPeriod,SlowMAPeriod,SignalMAPeriod,0,2);
double signal_1=iCustom(Symbol(),0,"MACD True",FastMAPeriod,SlowMAPeriod,SignalMAPeriod,1,1);
double signal_2=iCustom(Symbol(),0,"MACD True",FastMAPeriod,SlowMAPeriod,SignalMAPeriod,1,1);
double chalkin_money=iCustom(Symbol(),0,"chaikin-money-flow-indicator",Periods,0,1); 
Comment("MACD[1]-->",macd_1,"\n","MACD[2]-->",macd_2,"SIGNAL[1]-->",signal_1,"\n","SIGNAL[2]-->",signal_2,"\n","MA[1]",ma_1);

if((macd_2<signal_2)&&(macd_1>signal_1)&&(macd_1<0)&&(signal_1<0)&&(Low[1]>ma_1))
  {
    SendNotification(StringConcatenate("buy signal-->",Symbol(),Period()));
    Alert(StringConcatenate("buy signal-->",Symbol(),Period()));
   //OrderSend(Symbol(),OP_SELL,CalculateLotSize(30,2),Bid,3,Bid+30*mypoint,Bid+45*mypoint,"",0,0,White);
   if(use_chalkin_money_flow==True && chalkin_money>0)
    {
     return true;
    }
   if(use_chalkin_money_flow==True && chalkin_money<0)
    {
     return false;
    }
    return true;  
  }
return false;
}
Files:
MACD_EMA.mq4  14 kb
 
OrderSend(Symbol(),OP_BUYLIMIT,CalculateLotSize(i_stop_in_pip,1),NormalizeDouble(buy_open_price,Digits),3,NormalizeDouble(buy_stop_price,Digits),NormalizeDouble(buy_profit_price,Digits),"",0,TimeCurrent()+(Period()*60*30),Red);  
  1. Are your books one column but two feet wide? No because that is unreadable. They are 6 inches, sometimes two columns, so you can read it easily. So should be your code. I'm not going to go scrolling (or moving my eyes) back and forth trying to read that.

  2. You might know why, if you had checked your return codes for errors, and reported them including GLE/LE, your variable values and the market, we would know that at least you are calling your code.
              What are Function return values ? How do I use them ? - MQL4 programming forum
              Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
Reason: