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
//+------------------------------------------------------------------+
//| send_pending.mq4 |//| Copyright © 2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
#property show_confirm
#include <stdlib.mqh>
#include <WinUser32.mqh>
//+------------------------------------------------------------------+
//| script "send pending order with expiration data" |
//+------------------------------------------------------------------+
int start()
{
int ticket,expiration,cnt;
double point,p1,p2,p3,p4,p5,p;
//----
if(MessageBox("Do you really want to BUY 1.00 "+Symbol()+" at ASK price? ",
"Script",MB_YESNO|MB_ICONQUESTION)!=IDYES) return(1);
//----
ticket=OrderSend(Symbol(),OP_BUY,0.1,Ask,3,0,0,"expert comment",255,0,CLR_NONE);
//----
point=MarketInfo(Symbol(),MODE_POINT);
expiration=CurTime()+PERIOD_D1*60;
p1=Ask;
p2=Bid;
//----
p3=p1+4*point;
p4=p2-4*point;
ticket=OrderSend(Symbol(),OP_SELLSTOP,0.2,p4,2,0,0,"1",16384,expiration,Green);
//----
ticket=OrderSend(Symbol(),OP_BUYSTOP,0.4,p3,2,0,0,"2",16384,expiration,Green);
ticket=OrderSend(Symbol(),OP_SELLSTOP,0.8,p4,2,0,0,"3",16384,expiration,Green);
ticket=OrderSend(Symbol(),OP_BUYSTOP,1.6,p3,2,0,0,"4",16384,expiration,Green);
ticket=OrderSend(Symbol(),OP_SELLSTOP,3.2,p3,2,0,0,"5",16384,expiration,Green);
return(0);
}
//+------------------------------------------------------------------+
In the above program we should stop the running of program for a while if any pending order is pending for execution. For example until comment 2 is cleared in pending orders list the program should not move for comment 3.