Modifying OrderMagicNumber

 

Hi@all,


I want to modify the OrderMagicNumber of an opend order after a I sold a part from it.

Is this possible? I found an old thread but there was no solution found.

How can an EA notice that I sold e.g. 0.01 lots with 50$ profit from an 0.1 lots order yet? So that the next sell will be with 100$ profit?


Thanks a lot.

Wolfgang

 

W

> I want to modify the OrderMagicNumber

The good thing about MagicNumber is that it doesnt alter & cannot be altered

> How can an EA notice that I sold e.g. 0.01 lots

Look at OrderHistory, get some ideas from this 'Trade Orders History Charts'

Good Luck

-BB-

 
BarrowBoy:

The good thing about MagicNumber is that it doesnt alter & cannot be altered

I've got two related questions. I've been working round these things for ages, but it seems sensible to take the opportunity to check that there really isn't a way of doing them:

  • Is there any way of altering an order comment? (And, if not, can anyone suggest a good reason why not?)
  • Multiple-close-bys. In the user interface you can create e.g. 10 buys orders for 1 lot, 1 sell order for 10 lots, and then use "Multiple close by" to pair the things off against each other. Can't see any way of doing it programmatically, however, and there's nothing obviously related in any of the documentation. OrderCloseBy() only seems to take a single ticket number on each side. The absence of this facility exposes you to far more possibility of slippage than is necessary (or desirable) - far more separate, serial communications with the broker.

 
jjc:

Can't see any way of doing it programmatically, however [...]

...Apart, that is, from the ruinously complex and questionably reliable method of doing an OrderCloseBy() of one of the "small" orders against the "big" one, scanning the comments in the revised order list to find the modified "big" order which is created, and then repeating the process until the position is finally closed.


Are there any less ludicrous alternatives to this?

Reason: