need help with adding a buy order and sell order when condition meets

 

I've been trying to check my open trade if there is an open trade then dont trade , i only want one trade to be open, I also wanna create a buy order 


but it doesnt work it gives me i "2020.07.09 18:11:45.128 2020.01.03 17:36:15   CTrade::OrderSend: market buy 0.01 @EP sl: 3017.35 tp: 3023.35 [invalid volume]"



if (price > above) {

   

   

   if (runningmacdsignal > 0){

      

      if (price > runningfivesma) {

      

         Print ("goin to place a trade at" + Ask);

         trade.Buy(0.01,NULL,price,sl,pt,"WE BOUIGHT");

         

      }

      else {

      

      Print ("The price is not above the running fivesma");

      }

   }

   else {

   

      Print ("the macd is not bullish");

   }

}

else {



   Print ("the price is not above the 200day sma 15point");

}

}
tldr, i want to create an if statement to see if i have an open trade if its true then dont trade, and i want to place a buy order or sell order ty!!!
The checks a trading robot must pass before publication in the Market
The checks a trading robot must pass before publication in the Market
  • www.mql5.com
Before any product is published in the Market, it must undergo compulsory preliminary checks, as a small error in the expert or indicator logic can cause losses on the trading account. That is why we have developed a series of basic checks to ensure the required quality level of the Market products. If any errors are identified by the Market...
 
Please edit your post and
use the code button (Alt+S) when pasting code
 
What instrument (stock, futures, etc.) are you trying to buy? And are you able to buy a quantity of 0.01 of it?
 
John Brown: I've been trying to check my open trade if there is an open trade then dont trade , i only want one trade to be open,

That has nothing to do with your stated problem.
How To Ask Questions The Smart Way. 2004
          Be precise and informative about your problem

Reason: