Candle Price Check

 

how do i check if the first tick of a candle has higher price than the close tick (last tick) of previous candle

everything i try either gives me only buy trades or only sell trades

 

  if ((((Ask+Bid)/2)-Spread) > (iClose(Symbol(),0,1)))    //This line here
{
      //open buy;
      if(TakeProfit>0){
      tp=Ask+TakeProfit*pips;}else{tp=0;}
      if(StopLoss>0){
      sl=Ask-StopLoss*pips;}else{sl=0;}
      OrderSend(Symbol(),OP_BUY,lotsize,Ask,sl,tp,NULL,Magic,0,clrBlue);
   }
   if ((((Ask+Bid)/2)-Spread)<iClose(Symbol(),0,1))  //This Line Here
{
      //open sell;
      if(TakeProfit>0){
      tp=Bid-TakeProfit*pips;}else{tp=0;}
      if(StopLoss>0){
      sl=Bid+StopLoss*pips;}else{sl=0;}
   OrderSend(Symbol(),OP_SELL,lotsize,Bid,slip,sl,tp,NULL,Magic,0,clrRed);
   }
 
Nurudeen Amedu:

how do i check if the first tick of a candle has higher price than the close tick (last tick) of previous candle

everything i try either gives me only buy trades or only sell trades

 

You have to use 
static double
Then if the price is higher than the static make update for it
Same to the lower price
Add another static double variable then compare the current price if lower than it then update it


I am now writing from mobile, so if you want a deep coding then let me know