[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 404
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
I can't organise a loop, X and Y always equal 0.
First, clear away the rubbish in your mind.
Make your code nice and structured.
And don't be greedy for comments.
Yes. Of course.
I first select orders with the required magic number and on that currency pair. if( OrderMagicNumber( )==2000 &&OrderSymbol()==Symbol()) {
Then the loop for( i=OrdersTotal();i==0;i--) in which I select the orders like this OrderSelect(i,SELECT_BY_POS ); and then count how many orders as OP_SELLSTOP
If there are no orders, then we open an order of the order type that does not exist. The X variable in the upper loop and the Y variable in the lower loop are used to count orders of the necessary type. Both loops are the same in structure and purpose.
I have already written with explanations, but here dad came, called, brought milk, tea and halva, and I did not send a message, I went to pee, and my father erased the unsent message, said, but what, you could write in another search engine window? I was wondering what nettle paste is. I got a little freaked out and sent it with almost no explanation.
Well, X and Y are always 0. The for loop must not be working. I don't understand at all what may not work, because of this the orders open 2 on every tick.
Yes. Of course.
I first select orders with the required magic number and on that currency pair. if( OrderMagicNumber( )==2000 &&OrderSymbol()==Symbol()) {
Then the loop for( i=OrdersTotal();i==0;i--) in which I select the orders like this OrderSelect(i,SELECT_BY_POS ); and then count how many orders as OP_SELLSTOP
If there are no orders, then we open an order of the order type that does not exist. The X variable in the upper loop and the Y variable in the lower loop are used to count orders of the necessary type. Both loops are the same in structure and purpose.
I have already written with explanations, but here dad came, called, brought milk, tea and halva, and I did not send a message, I went to pee, and my father erased the unsent message, said, but what, you could write in another search engine window? I was wondering what nettle paste is. I got a little freaked out and sent it with almost no explanation.
Well, X and Y are always 0. The for loop must not be working. In short, I don't understand at all what could be not working there, it's causing orders to open 2 on each tick.
That's exactly right, the for loops do not do what you need.
You have the following: for( i=OrdersTotal();i==0;i--)
1) If there are 0 orders, the loop will be executed 1 time. In this case, it will select the unknown and do the unknown with it =)
2) If there are more than 0 orders, the loop will not start at all, because the condition "i==0" is not met
Expression2 is a check for the loop end condition. If it is true, then the for loop body operator is executed.
The help text says
Expression2 is a check for the loop end condition. If it is true, the for loop body operator is executed.
Right, the loop doesn't get to the loop.
You have written: "If the order symbol (which order? there are many of them... or none at all) equals the current order and its magic (what order?) equals 1000, then execute the loop".
and you have to : "start a loop. In it: 1) select an order. 2) and if symbol =... and magic =1000, then X++;"
Some DCs in real accounts assign all sorts of prefixes like "." or "FXF" to symbol names.
How can I use these prefixes?
I did it this way:
#define DEF_SPEC "FXF"
string SymbolsTrade[] = {"AUDCAD "DEF_SPEC ... -does not work
string SymbolsTrade[] = {"AUDCAD "+DEF_SPEC ... -it doesn't work like that either
as the result I get just FXF instead of AUDCADFXF.
Can you tell me how to implement this?Some DCs in real accounts assign all sorts of prefixes like "." or "FXF" to symbol names.
How can I use these prefixes?
I did this:
#define DEF_SPEC "FXF"
string SymbolsTrade[] = {"AUDCAD "DEF_SPEC ... -does not work
string SymbolsTrade[] = {"AUDCAD "+DEF_SPEC ... -it doesn't work like that either
as the result I get just FXF instead of AUDCADFXF.
Can you tell me how to implement this?Well, that's how it works on the fly:
Got it, I'll do it...
Also, the condition doesn't work.