Please guide me

 

I have following codes when i execute it on the chart it stars to placing one pending order continuesly what should i add to it for place only one single order

/--------------------------------------------------------------------
// simpleopen.mq4
// The code should be used for educational purpose only.
//--------------------------------------------------------------------
int start() // Special function start()
{ // Opening BUY

OrderSend(Symbol(),OP_BUYSTOP,0.1,Ask+100*Point,3,Bid-150*Point,Bid+250*Point);
return; // Exit start()
}

//--------------------------------------------------------------------

 

start() is system function that is executed at every tick automatically when in EA mode.

You can try to use this code as a script (place it in "Scripts"). Or you can move OrderSend into initi(). Or add something like...

bool sended=false;
start()
{
	if (sended==false) {
 	  OrderSend(Symbol(),OP_BUYSTOP,0.1,Ask+100*Point,3,Bid-150*Point,Bid+250*Point);
 	  sended=true;
	}
}