[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 211

 
artmedia70:

You have already been invited to address the administration on this issue.

Who is the administration here?
 
eddy:
Who's the administration here?

You'll be in charge until 10:00 today...))

Get started.

 
eddy:
Who is the administration here?
Ask Rosh.
 
Fam:
Funny :) Thank you.
In my own words: :))
break - exit from the loop and go further in the script code (final exit from the loop)
continue - do not execute the code which goes further inside the loop and return to the beginning of the loop (continuation of work in the same loop)
 
artmedia70:
Ask Rosh.


Well, what are you digging all sorts of attacks "trolls" - man, openly mocking, and you are so responsive ..., yes, and even giving advice. He knows everything himself, including who to turn to, etc... And here he just "burns" and "bursts into tears"...:-)))

P.S. Go ahead and upgrade the site. :-)))

 
eddy:
who is the administration here?
So as not to continue the discussion in such a creative way, I would like to inform you that the technical preparations for a public FAQ have been completed.
In the near future, a thread will be created where frequently asked questions will be grouped together and answers will be generated. That's all for now.
 
granit77:
I would like to inform you that the technical preparations for the FAQ have been completed by the public.

why not make these questions thematically grouped and add the possibility to ask questions right there? that would be a normal questionnaire.

and if you add the possibility to add not only questions but also tasks, with codes/articles as answers, you get what I propose - a different site structure, which includes all of its existing content

 

Great, it's all here. Posted last night, but the thread has already gone pretty far with explanations of what a magician is and how it is prepared )))

Please give me an answer to my question.

My EA sets BUYLIMIT and SELLLIMIT at certain times. I would like to make it delete the pending orders (OP_BUY or OP_SELL) in one direction when the order is opened.

This is my suggestion:

void start(){

.....

for(int i=OrdersTotal() -1;i>=0;i--)

if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))

{

if(CalculateCurrentOrders(Symbol())>0) {Alert(CalculateCurrentOrders(Symbol()));ClosePendingOrder(OP_SELLLIMIT);} // (1)

if(CalculateCurrentOrders(Symbol())<0) {Alert(CalculateCurrentOrders(Symbol()));ClosePendingOrder(OP_BUYLIMIT);} //(2)

if(TimeCurrent() - OrderOpenTime()>=HowManyHours*60*60) {ClosePendingOrder(OP_BUYLIMIT);ClosePendingOrder(OP_SELLLIMIT);} //(3)

}

....

}

Rules 1 and 2 do not work. If we change the rules to delete the pending orders in the direction of the open order, everything starts working.

The third rule works fine.

 
dzhini:

Great, it's all here. Posted last night, but the thread has already gone pretty far with explanations of what a magik is and how it is prepared )))

Please give me an answer to my question.

My EA sets BUYLIMIT and SELLLIMIT at certain times. I would like to make it delete the pending orders (OP_BUY or OP_SELL) in one direction when the order is opened.

My variant would be the following:

void start(){

.....

for(int i=OrdersTotal() -1;i>=0;i--)

if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))

{

if(CalculateCurrentOrders(Symbol())>0) {Alert(CalculateCurrentOrders(Symbol()));ClosePendingOrder(OP_SELLLIMIT);} // (1)

if(CalculateCurrentOrders(Symbol())<0) {Alert(CalculateCurrentOrders(Symbol()));ClosePendingOrder(OP_BUYLIMIT);} //(2)

if(TimeCurrent() - OrderOpenTime()>=HowManyHours*60*60) {ClosePendingOrder(OP_BUYLIMIT);ClosePendingOrder(OP_SELLLIMIT);} //(3)

}

....

}

Rules 1 and 2 don't work. If we change the rules to delete pending orders in the direction of the open order, everything starts working.

The third rule works fine.


You should first learn to properly place the code - via SRC (Ctrl+Alt+M) in the editor. Otherwise your abracadabra is not readable at all...
 
granit77:
In my own words: :))
break - we have escaped from the loop and continued following the script code (the final exit from this loop)
continue - we did not execute the code further inside the loop and returned to the beginning of the loop (continuation of work in the same loop)

That's what I'm talking about :)

In principle I've already figured out how it works, even wrote several loops, one came out double :)

Reason: