need help, one order per zigzag signal

 

hello

can someone help me to limit my order per signal 

im using zigzag as signal.

      //input from indi
      double zh=iCustom(Symbol(),0,"ZigZag.ex4",depth,deviation,backstep,1,0);
      double zl=iCustom(Symbol(),0,"ZigZag.ex4",depth,deviation,backstep,2,0);
      double zz=iCustom(Symbol(),0,"ZigZag.ex4",depth,deviation,backstep,0,0);

      //check for zigzag point
      if(zh==zz && zh>0)
      {hh[1]=zh;
      low=ll[1];
      tths=TimeCurrent();
      ttl=ttls;
   
      }
      if(zl==zz && zl>0)
      {ll[1]=zl;
      high=hh[1];
      ttls=TimeCurrent();
      tth=tths;
      }
      
      //check for up or down
      if(tth<ttl)
      {
      up=TRUE;
      down=FALSE;
      }
      if(ttl<tth)
      {down=TRUE;
      up=FALSE;}

here code for open order:

  if(up==TRUE)
      {
      ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,silb,tpb,EAComment,MagicNumber,0,Blue);
      
      }
      if(down==TRUE)
      {
      ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,sils,tps,EAComment,MagicNumber,0,Red);
      
      }
      }


by this code now. it will alway repeat order after hit TP or SL. so i need it to stop order until next signal.

can someone help.

thank in advance

 
ewanjeli:

hello

can someone help me to limit my order per signal 

im using zigzag as signal.

here code for open order:


by this code now. it will alway repeat order after hit TP or SL. so i need it to stop order until next signal.

can someone help.

thank in advance

      //check for up or down
      // You have to limit the number of bar like this
      if((tth<ttl)&&(tth<=1))
        {
          up=TRUE;
          down=FALSE;
        }
      if((ttl<tth)&&(ttl<=1))
        {
          down=TRUE;
          up=FALSE;
        }
Reason: