Only Opening 1 Trade even when conditions are met (pic+code included)

 

Here is the code

int start()
{
   double BuyTP=Ask+(TakeProfit*Point);
   double SellTP=Bid-(TakeProfit*Point);
   double lots=(AccountBalance()/10000)*Lot;
   ArrowUp=ObjectFind("SignalUp");
   ArrowDown=ObjectFind("SignalDown");
   Strength=MathAbs(ObjectDescription("WPRValue"));
   
   if(!OpenTrade&&ArrowUp==0&&Strength<=BuySignalStrength)  //Buy Logic
   {
      Ticket=OrderSend(NULL,OP_BUY,lots,Ask,10,NULL,BuyTP,NULL,Magic,NULL,clrBlue);
      OpenTrade=true;
      Position="Buy";    //Sets Position to Buy
   }
   
   if(!OpenTrade&&ArrowDown==0&&Strength>=SellSignalStrength)   //Sell Logic
   {
      Ticket=OrderSend(NULL,OP_SELL,lots,Bid,10,NULL,SellTP,NULL,Magic,NULL,clrRed);
      OpenTrade=true;
      Position="Sell";    //Sets Position to Sell
      
   }   
   
   if(OpenTrade&&Position=="Buy"&&(Strength>=ExitBuySignalStrength||(BuyArrowExit&&ArrowUp!=0))) //Buy close Logic
   {
      OrderClose(Ticket,Lot,Bid,10000,clrGreen);
      OpenTrade=false;
      Position="";
   }
   
   if(OpenTrade&&Position=="Sell"&&(Strength<=ExitSellSignalStrength||(SellArrowExit&&ArrowDown!=0)))//Sell close Logic
   {
      OrderClose(Ticket,Lot,Ask,10000,clrGreen);
      OpenTrade=false;
      Position="";
   }
   if(!OrderSelect(0,SELECT_BY_POS))//Set OpenTrade to false after TP
   {
      OpenTrade=false;  
      Position="";
   }   
   
   
      ObjectCreate("ObjName", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("ObjName","Open Trade: "+OpenTrade+" Position: "+Position+" Arrow: "+ArrowUp+ArrowDown+" Strength: "+Strength+" Error:"+GetLastError(),25, "Verdana", Red);
      ObjectSet("ObjName", OBJPROP_CORNER, 0);
      ObjectSet("ObjName", OBJPROP_XDISTANCE, 20);
      ObjectSet("ObjName", OBJPROP_YDISTANCE, 20);
   
  
   
   
return(0);
}

 and here is a back test. All of the conditions are met but it won't open a trade. SellSignalStrength is set to 95.

 

 
      Ticket=OrderSend(NULL,OP_BUY,lots,Ask,10,NULL,BuyTP,NULL,Magic,NULL,clrBlue);
  1. Check your return codes (OrderSend) and find out why. What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
  2. NULL is not a valid SL, NULL is not a valid expiration. Use zero.
 
So, I found out that if i take out the "Ticket=" then it will make multiple trades, but won't close them unless it hits the TP, obviously. I copied the code you posted from another EA I have and had no problems with it in that EA, so there must be something where Ticket is keeping it from opening more trades but I can't find anything.
 

Another update. I used 

  if(OrderSelect(0,SELECT_BY_POS))
   {
      Ticket=OrderTicket();
   }  

 to set the ticket value instead of assigning it at the order placement. It appears that if the order is closed by 

   if(OpenTrade&&Position=="Buy"&&(Strength>=ExitBuySignalStrength||(BuyArrowExit&&ArrowUp!=0))) //Buy close Logic
   {
      OrderClose(Ticket,Lot,Bid,10000,clrGreen);
      OpenTrade=false;
      Position="";
   }
   
   if(OpenTrade&&Position=="Sell"&&(Strength<=ExitSellSignalStrength||(SellArrowExit&&ArrowDown!=0)))//Sell close Logic
   {
      OrderClose(Ticket,Lot,Ask,10000,clrGreen);
      OpenTrade=false;
      Position="";
   }

 then it won't open any other orders for some reason.

 
More experiments done, even if it hits the TP line it won't open any other trades. So once the first trade is closed, the program is incapable of opening any other trades.
 
Okay I figured it out. So I didn't NormalizeDouble my lots variable so it was trying to pass an impossible parameter ex.999999925172 lots.
 
Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is always wrong
Reason: