magicnumber Is a trade ticket magic number preserved through a restart

 

I am working on preserving my trades through catastrophic platform event.

Each trade event is documented in a csv file.

The intent is that if the EA is restarted for any reason, it can load the order details at initialization to be able to operate on existing trades


What I need to know is the magic nubmer preserved through platform restarts. I am assuming that the magic nubmer is part of the ticket stored on the server. However, that does not make much sense to me. So is there internal memory that hashes the account tickets to programmed magicnumbers? Is there an article that discusses a EA ticket recovery method.


I think I can use the OrderMagicNumber() to recreate the magicnumber but how do I know which ticket is which in the position.


That is if the magicnumber gets defaulted to something.


The reason I need this is that tickets are partially closed as trade progresses.


Any help finding the correct search words for finding EA ticket recovery articles would be greatly appreciated.


Thanks

John

 
johnmcglaughlin:

I am working on preserving my trades through catastrophic platform event.

Each trade event is documented in a csv file.

The intent is that if the EA is restarted for any reason, it can load the order details at initialization to be able to operate on existing trades


What I need to know is the magic nubmer preserved through platform restarts. I am assuming that the magic nubmer is part of the ticket stored on the server. However, that does not make much sense to me. So is there internal memory that hashes the account tickets to programmed magicnumbers? Is there an article that discusses a EA ticket recovery method.


I think I can use the OrderMagicNumber() to recreate the magicnumber but how do I know which ticket is which in the position.


That is if the magicnumber gets defaulted to something.


The reason I need this is that tickets are partially closed as trade progresses.


Any help finding the correct search words for finding EA ticket recovery articles would be greatly appreciated.


Thanks

John

Create a loop with an index of OrdersTotal()

Within that loop, select each existing order using OrderSelect().

Use OrderMagicNumber() to return the originally set magic number and OrderLots() to return the lotsize for the selected order.

 
cloudbreaker:

Create a loop with an index of OrdersTotal()

Within that loop, select each existing order using OrderSelect().

Use OrderMagicNumber() to return the originally set magic number and OrderLots() to return the lotsize for the selected order.


Thanks cloudbreaker


That is great to know, perhaps mute if


Does the OrderMagicNumber get preserved by MT4 when

  • EA is removed and restarted
  • MT4 profile change and EA restart
  • mt4 exited and restarted

If the magicnumber is preserved by MT4 for these cases then I am fine and I have all my trade details as well.

John

 
johnmcglaughlin:


Thanks cloudbreaker


That is great to know, perhaps mute if


Does the OrderMagicNumber get preserved by MT4 when

  • EA is removed and restarted
  • MT4 profile change and EA restart
  • mt4 exited and restarted

If the magicnumber is preserved by MT4 for these cases then I am fine and I have all my trade details as well.

John

The magic number exists server-side, associated with the order in the list of current or the list of historic orders.

If you wish to add persistence on the client-side, you will need to code this.

 
cloudbreaker:

The magic number exists server-side, associated with the order in the list of current or the list of historic orders.

If you wish to add persistence on the client-side, you will need to code this.

Perfect then I am all set.


Thanks for the quick answer.


John

Reason: