[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 844

 
alsu:
))))))))))) It's not a conjunction.

In my case, the rule is: "Separate NOT in nouns, adjectives and adverbs if there is or is meant to be a contradiction" http://www.rusyaz.ru/pr/od07.html - "to do" - is NOT spelled correctly - the correct word is " to do" (the highlighted word is a contradiction, preceded by a hyphen)
 
abolk:
ps. "do" is NOT spelled correctly - it's "do".

but it doesn't work when I retrieve the data, so I need it to reset and not block reopening!!!
 
FoxUA:

but it doesn't work when re-acquiring data, so I need it to reset and not block re-opening!!!

How do you "reset" the reopening? Explain what you want to do?
 
abolk:

How can you "reset" the reopening? It is not clear what you want to do?

I need to close an order with some lot and open another 1pc, and my orders open on every tick, but when I close an order with this lot again it has to open 1 order
 
FoxUA:

I need to close an order with some lot to open another 1pc, and I have orders open on every tick, but when you close an order with this lot again it has to open 1 order.

The whole thing. I need a more detailed algorithm for opening/closing orders
 
abolk:

A whole case. I need a more detailed algorithm for opening/closing orders

I need to close an order with lot X to open a new order and that's it, but in my case after order closing with lot X they do not stop opening, i.e. on every tick they open, but when an order with lot X closes it should open again
 

if you need help, when order with lot X is closed a new order opens and when you close a new order with lot X it opens again, but I have it on every tick, I will post the code in one piece

Files:
 

It's not quite clear - what you want.

Try to replace your function Start with this one.

In external parameters insert: extern double X_ = 0.1; //The size of a lot of the tool


void start() {
  

  if (ExistPositions(NULL,OP_BUY, -1)==0) { 
  OpenPosition(NULL, OP_BUY, X_, pa-40*po,pa+40*po);
                                      }
  if (ExistPositions(NULL,OP_SELL, -1)==0) {
  OpenPosition(NULL, OP_SELL, X_, pb+40*po,pb-40*po);
                                       }
  
return; }

The size of the position will always be = X_, - as you wanted....

 
FoxUA:

if you need help, when order with lot X is closed a new order opens and when you close a new order with lot X it opens again, but I have it on every tick, I will post the code in one piece

You use Kim's functions. Look at his function ExistPositions().
And make a check before opening a new position right after the previous one has been closed:
if (!ExistPositions(NULL, OP_BUY, Magic)) {Open code of a new position Buy}
if (!ExistPositions(NULL, OP_SELL, Magic)) {Open code for a new Sell position}

That's it... :)
 
Maybe someone has a written loca code, please send it to me. I'd be grateful to you!
Reason: