static datetime ordertime=0; // or define globally outside the start() function somelimit= 15; // 15 minutes (e.g. on a 15M chart) ... if((Time[0]-ordertime)>somelimit*60) { //execute my OrderSend function ordertime = Time[0]; } ...
//declare this variable or something like it double barcheck; //have one of your conditions for opening an order be if(Bars > barcheck) //then, when you open an order, place this script barcheck = Bars;
static datetime ordertime=0; // or define globally outside the start() function
hello Shimodax and mcboogs,
thank you for your ideas. i think my main problem was that i did not define my prevtime variable as 'static' (thx for this, Shimodax). it seems to work now. the manual says that bar distinction on time is more reliable than on count of bars, because the bar count may not work for the strategy tester.
:)

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
...
datetime prevtime=0;
...
if(Time[0] > prevtime)
{
//execute my OrderSend function
}
...
prevtime = Time[0];
...
shouldn't this recognize the beginning of a bar? When I use the strategy tester, absolutely nothing happens and this does not seem to work.
Any help most appreciated.