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
After a bit of adjustment, I did get the code to work, per original requirements. Thanks for the Forum input. The final working code included a sleep function to get the delay to work properly - I am sure that it is not the "cleanest" code, but it delivers what I am looking for, so I am at least happy with that :
bool trade_closed_less_than_1_hour_ago=false;
for(int x=OrdersHistoryTotal()-1;x>=0;x--)
{
OrderSelect(x,SELECT_BY_POS,MODE_HISTORY);
if(OrderSymbol()==Symbol() && (TimeCurrent()-OrderCloseTime())<3600 && OrderMagicNumber()==39379)
{
//if the OrderSelect() function above is TRUE, define the trade entry filter here - include the Sleep(3600000) function;
trade_closed_less_than_1_hour_ago=true;
break;
//Probably no need to continue with loop once a trade is found that was closed less than 1 hour ago
//sleep is in milliseconds to ensure the required minimum of 1 hour delay since last closed trade
}
}
if(trade_closed_less_than_1_hour_ago==false)
{
//Code to open new order or whatever
}
Play video
For large amounts of code, attach it.