Automagic Number with manual static number

 

Would this work well for a random magic number??

 

// logic: AutoMagic is generated when placing an order. It is not reclaimed if terminal is closed and reopened though.

//          StaticMagic can be used to continue an open order or used manually.

extern   bool automagic?         = True;

extern string staticmagic         = "";

extern   bool staticmagiconce? = True;   //T=if staticmagic != "" and not in use then use on next order. if automagic = true then use, else no later trades.

extern string EA                      = "EA";   //useful if you want to see your EA trades from manual trades or other EA trades.

extern      int TF                      = "60";

extern      int TP                      = 45;

extern      int SL                      = 90;

Comment( EA+"."+TF+"."+Symbol()+"."+TP+"."+SL+"."+Hour()+":"+Minute()+Seconds() ); //Example: "EA.60.EURUSD.45.90.900"

// You wouldn't want to close terminal because you would have to manually enter the magic to control open orders

//but why would you close it in the first place?

 
Subgenius:

Would this work well for a random magic number??

Why do you want a random Magic Number ?
 
RaptorUK: Why do you want a random Magic Number ?
Exactly. When you change time frames or pairs you go through a deinit-init cycle. If you mistakenly to do that, (and you will,) and go back - the EA as now forgotten all of its open orders.

See also https://www.mql5.com/en/forum/143514

Reason: