You should be checking the return value of the OrderSelect function to make sure it worked.
There is no need to use the third parameter on the OrderSelect function when using SELECT_BY_TICKET, and it may mislead you to use it.
I'm curious to know what it is you are trying to do. You seem to have hard coded ticket numbers into the switch statement. Are you intending to manually type these in then recompile the program to achieve some effect? This is the sort of thing where you might use an extern int variable so that you can enter the ticket numbers at the start of the run rather than having to recompile the code.
JJF:
Greetings,
Wow ! I'm sure your code makes sense to you . . . I hope it does . . . but I am at a loss.
dabbler:
I'm curious to know what it is you are trying to do. You seem to have hard coded ticket numbers into the switch statement. Are you intending to manually type these in then recompile the program to achieve some effect? This is the sort of thing where you might use an extern int variable so that you can enter the ticket numbers at the start of the run rather than having to recompile the code.
I'm curious to know what it is you are trying to do. You seem to have hard coded ticket numbers into the switch statement. Are you intending to manually type these in then recompile the program to achieve some effect? This is the sort of thing where you might use an extern int variable so that you can enter the ticket numbers at the start of the run rather than having to recompile the code.
Well, I wrote this routine to monitor a bunch of open trades when the market is wiggling without a focused direction (or when I want to go to sleep). In such case, I set some conditions to act upon them.
I am not familiar with the extern int command. But in any case, it is not such a hassle to recompile the script with the current trades numbers.
Now, let me explain 'the bug':
When I remove the OrderSelect_BY_TICKET from within the switch entries, the OrderOpenPrice() that the function returns is wrong and not match to the particular OrderTicket().
Can anyone tell me why OrderSelect(i, SELECT_BY_POS, MODE_TRADES); on the main 'For' loop is not enough for the switch choice?
JJF:
Well, I wrote this routine to monitor a bunch of open trades when the market is wiggling without a focused direction (or when I want to go to sleep). In such case, I set some conditions to act upon them.
I am not familiar with the extern int command. But in any case, it is not such a hassle to recompile the script with the current trades numbers.
Well, I wrote this routine to monitor a bunch of open trades when the market is wiggling without a focused direction (or when I want to go to sleep). In such case, I set some conditions to act upon them.
I am not familiar with the extern int command. But in any case, it is not such a hassle to recompile the script with the current trades numbers.
Ok, that makes sense. Thank you.
extern int isn't a command. You just define an int outside of any functions (globally) and by using the extern keyword, when you run the EA you get to change the value if you want.
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
Greetings,
Attached is a part of my script that is suppose to scan throw the open trades and 'snap' when condition is true.
For some odd reason, the condition sets to true even when the terms are not true.
Basically, I know how to go around it by putting a second OrderSelect_BY_TICKET for every switched entry, but I can't figure out why it won't work without.
Does anyone here knows why?
Thank you,
James