is ther any can help me

 

hi

for example if i want to keep the value that my position is closed and use it later what i shoud do?

thanks

 

hi

for example if i want to know the value that my position is closed and use it later what i should do?

thanks

 

Something like this:

...

if (OrderClose(OrderTicket(),OrderLots(),Bid,Slippage*iDigitsFactor,Violet))

{

dMySavedOrderClosePrice = OrderClosePrice();

...


CB

 
cloudbreaker wrote >>

Something like this:

...

if (OrderClose(OrderTicket(),OrderLots(),Bid,Slippage*iDigitsFactor,Violet))

{

dMySavedOrderClosePrice = OrderClosePrice();

...

CB

hi

i think by first ticking the value of dMySavedOrderClosePrice becom zero!!!!!!

for example my order is closed 10 min ago and at this momemnt need the time and close price,etc.

thanks

 
aminkam:

hi

i think by first ticking the value of dMySavedOrderClosePrice becom zero!!!!!!

for example my order is closed 10 min ago and at this momemnt need the time and close price,etc.

thanks

You're wrong.


The above snippet will only write the close price to your variable once when the order is closed. The first line of the snippet represents the line which already exists in your EA to close the order. My code executes the following line which stores the valiue in the variable, only if the order closes successfully.

Now if you have a number of orders and wish to store the close prices for all of them, then you will use an array.


If you do not wish to capture the values when you close the orders (the easy way), then you will have to construct a loop to read the Order History pool (the less efficient way). And if you search the forum, you'll find I wrote a similar function for another newbie some time ago.


CB

 
aminkam:

hi

i think by first ticking the value of dMySavedOrderClosePrice becom zero!!!!!!

for example my order is closed 10 min ago and at this momemnt need the time and close price,etc.

thanks

Hi,

If I understand what you want to do, you better search the history with something like this :

if (OrderSelect(OrdersHistoryTotal() - 1, SELECT_BY_POS, MODE_HISTORY) == 1) to get the last closed order current and the exact price of the close, the time, and all data about this order.

Caution: Read carefully the use of the history file, the file (that's what you see under history on your platform) must be sorted the way you programmed it when your program is running!

 
Jacques366 wrote >>

Hi,

If I understand what you want to do, you better search the history with something like this :

if (OrderSelect(OrdersHistoryTotal() - 1, SELECT_BY_POS, MODE_HISTORY) == 1) to get the last closed order current and the exact price of the close, the time, and all data about this order.

Caution: Read carefully the use of the history file, the file (that's what you see under history on your platform) must be sorted the way you programmed it when your program is running!

thanks

Reason: