Hi Cory,
You can build it using the CurTime() and add the necessary seconds. See the example:
You can build it using the CurTime() and add the necessary seconds. See the example:
/* ****************************************************************** */
/* DateTime test */
/* ------------------------------------------------------------------ */
/* Copyright and pricing */
/* */
/* This code was developed by coriFX 2005. */
/* */
/* You can use this code to make money as much as you wish without */
/* fee. If you have made your first million using my code, I would */
/* ask you to send me 10%. contact me at { corifx at o2go dot de }. */
/* I will send you the information for money transfer. */
/* */
/* ****************************************************************** */
extern int hoursToAdd = 8;
extern int minutesToAdd = 0;
int start() {
int timeToAdd = ( hoursToAdd * 3600 ) + ( minutesToAdd * 60 );
datetime now = CurTime();
datetime then = now + timeToAdd;
Print( "now: ", TimeToStr( now, TIME_DATE | TIME_MINUTES | TIME_SECONDS ),
", timeToAdd: ", timeToAdd,
", then: ", TimeToStr( then, TIME_DATE | TIME_MINUTES | TIME_SECONDS ) );
return( 0 );
}
regards, cori
Cory,
I have never used the expiry parameter in the OrderSend (so thanks cori) but the code below does the job (30 mins in this example). U will also need to test for 18:00.
regards..
I have never used the expiry parameter in the OrderSend (so thanks cori) but the code below does the job (30 mins in this example). U will also need to test for 18:00.
regards..
TotalTrades = OrdersTotal();
for(int cnt=0;cnt<TotalTrades;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if ( ((CurTime()-OrderOpenTime()) > 1800) ) // 1800 is in seconds...
{
OrderDelete(OrderTicket());
}
}
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
double theHigh; int total; total = OrdersTotal(); int startHour; int currentHour; currentHour = Hour(); startHour = 9; theHigh = High[Highest(NULL,0,MODE_HIGH,15,15)]; if (total < 1) { if (currentHour == startHour) { OrderSend(Symbol(),OP_BUYSTOP,1,theHigh+7*Point,3,theHigh,theHigh+14*Point,"Buying",16384,datetime expiration == Hour()+ 8;,Green); } }