Like chinplant suggest, you could use this trick :
CheckTime;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
//----------------------- CHECK FOR NEW BAR
if(CheckTime!=iTime(NULL,TimeFrame,0))
{
CheckTime = iTime(NULL,TimeFrame,0);
//----------------------- YOUR ENTRY AND EXIT CONDITION
}
//----------------------- YOUR TRAILING STOP FUNCTION
}Hope this help
Many thanks guys. much appreciated
Or as simply as:
...
if(CheckTime!=Time[0])
CheckTime = Time[0];
...Yes, that's also could do the trick
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, I have an EA that is working quite well. The problem is that in a fast moving market (based on 30min EUR/USD chart) it will open and close two or more trades in the 30min period. What happens is that quite often it will lose on the second or third trade. What I want it to do is to only trade ONCE on a 30min bar. Once a trade has been entered it MUST NOT trade again for at least the next 30mins to an hour. Any help appreciated