Topics
26 Mar 2023, 18:17
 658
 6
Replies

w1848494
28 Mar 2023, 07:16

RE:

w1848494 said:

How do I close a position when a bar closes, (Not on the opening of the next one).

For example a if a trade is opened at the opening of a bar, how do I close it on the closing price of the same bar???

Hey,

 

Thanks for answering.

How do I use the timer to do it. Can u suggest with sample code?

 

Regards,

Sid

 


@w1848494

w1848494
28 Mar 2023, 07:14

RE: RE:

firemyst said:

PanagiotisChar said:

Hi there,

At the moment there is no event raised at the moment a bar closes. A workaround would be to implement a Timer that is triggered on fixed intervals which coincide with a bar closing time.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

Or if you're using a chart that doesn't involve time like Renko and Range bars where a timer isn't practical, you can see how well the Bar Open event works for you because obviously when a new bar opens, the previous bar is closed.

Hey,

Thanks for answering. I tried doing the same, but there's almost always a considerable difference between the two prices. 


@w1848494