Dynamic Array - page 2

 
RaptorUK:

A Global Variable != globally declared variable

Global Variables are stored in files and are doubles, they can't hold arrays . . .

You are going to need to store your info in a file . . .


Ahh ... I understand. OK, I'll swot up on writing a log to the HDD in case of problems.

Thanks very much for your help, I hope you don't mind if I ask a fewother questions at a later date.


Regards ... G-fer.

 
G-fer: Umm ... I thought Global Variables remained on the client terminal for 4 weeks ... does this exclude arrays?
  1. There are no arrays in Global Variables. Don't confuse globally declared variables (or arrays) which die when the EA is closed, with Global Variables set using GlobalVariableSet()
  2. Global Variables are keep for 4 weeks if the terminal is properly shut down. They will not be written to disk on a power failure, OS crash, etc.
  3. G-fer: could you explain how I would include both the ticket number and the orderopenprice() in the array.
    Why would you need the OrderOpenPrice. Once you have the ticket number, OrderSelect it and use the Trading functions
  4. You still haven't stated why you need to save the ticket numbers. There are only two choices. Either you must write all open order ticket numbers and what ever addition data you can not recalculate to disk, each modification so you can retrieve it on a restart. Or, just loop through the open orders and recalculate everything. For me, the only thing I can't recalculate is wither I've done a partial close, so I move the SL to BE before the close and then close. That fails only on a restart after the OrderModify() and before the OrderClose().


 
WHRoeder:
  1. There are no arrays in Global Variables. Don't confuse globally declared variables (or arrays) which die when the EA is closed, with Global Variables set using GlobalVariableSet()
  2. Global Variables are keep for 4 weeks if the terminal is properly shut down. They will not be written to disk on a power failure, OS crash, etc.
  3. G-fer: could you explain how I would include both the ticket number and the orderopenprice() in the array.
    Why would you need the OrderOpenPrice. Once you have the ticket number, OrderSelect it and use the Trading functions
  4. You still haven't stated why you need to save the ticket numbers. There are only two choices. Either you must write all open order ticket numbers and what ever addition data you can not recalculate to disk, each modification so you can retrieve it on a restart. Or, just loop through the open orders and recalculate everything. For me, the only thing I can't recalculate is wither I've done a partial close, so I move the SL to BE before the close and then close. That fails only on a restart after the OrderModify() and before the OrderClose().


Ok ... it's a bit hard to explain though.

I need to loop through the array generated by the open orders and determine a proportional stop loss for each ticket once it has reached a specific target. By Including the OOP in the array when it is initialised, and then looping through the array, rather than the orders, I can firstly determine whether the target has been reached and then, once that has occurred, I can replace the OOP in the array with the proportional stop loss figure, rather than physically modify the order. This PSL can then be modified within the array at each pass, as if it was retrieved by OrderStopLoss(), and then acted upon when it is breached. I think this is more efficient than continually modifying the orders to set a new stop loss ... what do you think?

Not a very clear explanation, I'm afraid.

G-fer


Reason: