Execute on next bar open - right after a bar has closed with confirmation

Created at 05 May 2022, 16:16
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
CT

ctid1820873

Joined 01.04.2021

Execute on next bar open - right after a bar has closed with confirmation
05 May 2022, 16:16


Hi, I have searched all over and can´t find what I need.

If I use OnBar and Bars.ClosePrices.Last(1) or Bars.LastBar.Close it seems the execution is "On Bar Close" and not "On Bar Open" so as you see on my image the trigger here is the candle close under the line so next candle should execute but it is always the next after that which is too late.

If I use OnTick it triggers as soon as the low goes under the line but it might not close under anyway so that is too soon.

 

How would I go about triggering on the next open after closing under the line?

 

I

Thanks


@ctid1820873
Replies

... Deleted by UFO ...

amusleh
06 May 2022, 08:58

Hi,

Bars.ClosePrices.Last(1) gives you the close price of last closed bar, not the close price of last bar which is not closed yet.

Bars.ClosePrices.LastValue or Bars.ClosePrices.Last(0) will give you the close price of last bar, which is not closed yet.

Bars.LastBar.Close is equivalent to Bars.ClosePrices.Last(0) / Bars.ClosePrices.LastValue. 


@amusleh

deeganpope
24 Jan 2023, 17:39 ( Updated at: 21 Dec 2023, 09:23 )

RE: cTrader ClosePrices.last

I am using closeprices.last(0) and still have it trading 2 bars late.  Did you ever figure this out?

 

 

ctid1820873 said:

Hi, I have searched all over and can´t find what I need.

If I use OnBar and Bars.ClosePrices.Last(1) or Bars.LastBar.Close it seems the execution is "On Bar Close" and not "On Bar Open" so as you see on my image the trigger here is the candle close under the line so next candle should execute but it is always the next after that which is too late.

If I use OnTick it triggers as soon as the low goes under the line but it might not close under anyway so that is too soon.

 

How would I go about triggering on the next open after closing under the line?

 

I

Thanks

 


@deeganpope

firemyst
09 Mar 2023, 08:06 ( Updated at: 21 Dec 2023, 09:23 )

RE: RE: cTrader ClosePrices.last

deeganpope said:

I am using closeprices.last(0) and still have it trading 2 bars late.  Did you ever figure this out?

 

 

ctid1820873 said:

Hi, I have searched all over and can´t find what I need.

If I use OnBar and Bars.ClosePrices.Last(1) or Bars.LastBar.Close it seems the execution is "On Bar Close" and not "On Bar Open" so as you see on my image the trigger here is the candle close under the line so next candle should execute but it is always the next after that which is too late.

If I use OnTick it triggers as soon as the low goes under the line but it might not close under anyway so that is too soon.

 

How would I go about triggering on the next open after closing under the line?

 

I

Thanks

 

 

Why not try posting some code so people can see what you're doing and why it's possibly not working?


@firemyst