basic question : Exit on close

 
Hi guys, i just want to exit on close (of the current bar) for my open position. the position have been opened at the open of this bar and i just want to close at the close.
how can i code that?
 
You could calculate the candle time (something like CurTime() - opening_time) or exit on the first tick of the next candle (should just be one tick difference) based on Volume[0]==1.



Markus
 
ok thanks markus. I was guessing, it was easier ^^
 
Use iBars() to count the number of bars on the chart. If the number has increased by 1 since the last count then thats a new bar close.
 
best to compare with: iBars()!=iPreviousBars