How to Store the initial Bid Price when launching EAs

 

Hi All,

I am currently try to se

Brief desciption of the issue: 

- I have a grid of orders. Each orders has its own Take Profit and Stop Loss level.

- I want all orders (active or pending) of the grid to be closed or deleted when the price reaches a certain % difference from the price at which is placed the first of order of the grid.


The way I have tried is for the EA the look among the current orders, find the first one and store its opening price. Unfortunately this is not working as if the first order has already been closed in the meanwhile (SL or TP reached) then the EA will not find it.


Is there a way I can store the initial bid price of the first order without having me to type it in everytime I launch the EA on a different cross. Or any other way I can solve the above issue?;)

Thanks a lot for your help,

MG

 

Hi All,


It looks like I have been able to solve the issue.


If anyone is interested the tip is - use static variables which are initialized just once;)


Tx,

MG

Reason: