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; } }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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()
}
//--------------------------------------------------------------------