basic question from a noob....

 

Im writing my first EA

1. I want only 1 trade running at a given moment

how can i make sure this happanes ??

if a trade is reaching either T.P or S.L it loses its ticket and its value becomes -1 ?

2. I want to set a some variable once a trade has reached S.L

orderselect(ticket,select_by_ticket)

if (orderstoploss()>0)

?

is that the way ?

thanks !!

 

orderselect(ticket,select_by_ticket,MODE_HISTORY)