find the price of the last closed position - page 2

 
josemiguel1812:
If there is open position gives the closing price of the previous one.

If there is no open position, gives the closing price of the latter.

In any case, and taking advantage to improve my code, if you use an counter, you can get the closing price of the position that interests you: from the end of history, the first closed, the second, the fourth ... 

There is a small error to run well in multi-currency ... Can you guess it?.

I leave that as an exercise 

Well... thanks a lot !

I tried to find the small error. I didn't find it. Perhaps is too small or more sure because I am at the beginning (as I said earlier) 

 
tenlau:

Well... thanks a lot !

I tried to find the small error. I didn't find it. Perhaps is too small or more sure because I am at the beginning (as I said earlier) 

Open and close in the terminal several positions of two different pairs: EURUSD and USDJPY for example.

Ask for the closing price of the third position of EURUSD from the end. You'll see that you get the price of the third position of the history but not of the symbol.

The counter only must add with the specified symbol..