[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 301
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
Thank you.
If it hangs the tester, then it should. (Be sure to describe the exit from the loop).
Like this
It's hard to say what your problem is. Take it as a rule in MQL4 that negative numbers in code should always be put in brackets. Sometimes errors may occur without brackets.
Although, in code lines starting with extern, taking negative values in brackets is not necessary. I don't know why it is so.
Thanks, but it doesn't work, can you suggest a construct to get rid of the loop if(IsTesting()==true || IsOptimization()==true)
^^
It doesn't need an alert - my understanding is that somewhere in the code the file is probably already open but not closed. That's probably why the file cannot be reopened and the alert window keeps popping up. Although, maybe I'm wrong - I'm not a member of telepath club :(
I didn't know about while construct...
int init()
{
while(handle<1)
{
handle=FileOpen("firstfile.csv",FILE_CSV|FILE_READ|FILE_WRITE,'\t')
}
}
}
Thanks, but it doesn't work, can you suggest a construct to get rid of the loop if(IsTesting()==true || IsOptimization()==true)
Try without a loop at all, say like this:
It would at least help to understand why the pose doesn't open.
^^
Many Thanks :)
Thank you all, fixed it, it's working.
Many thanks for your help.
Yes, why do we need to ask, we can check it by "fighting" )).
In general this is correct, but to make it work we need to initialize the variable before the loop
handle=0;
while(handle<1)
{
handle=FileOpen("firstfile.csv",FILE_CSV|FILE_READ|FILE_WRITE,'\t');
}
Well, it's just to be absolutely sure that code execution will enter the loop's body and not ignore it.
Actually it is true but for it to work, the variable should be initialized before the loop
handle=0;
while(handle<1)
{
handle=FileOpen("firstfile.csv",FILE_CSV|FILE_READ|FILE_WRITE,'\t');
}
This is to make sure that code execution enters the loop body and does not ignore it.
Folks, help me out a little!!!
I am trying to write an EA using the morning channel strategy. The essence is this: at 6:01 on EURGBP pair we determine the channel of price movement from 0 o'clock till 6 am. We set two pending orders and if the triggered pending order is closed by a stopper, we open an order in the opposite direction. It is the second part of the strategy that does not work. I.e., if a stop has triggered, we cannot open an order in the opposite direction.