Todays Open Price

Questions about MultiCharts and user contributed studies.
raven
Posts: 31
Joined: 17 Oct 2009
Been thanked: 1 time

Todays Open Price

Postby raven » 14 Jul 2010

I want to refer to the today’s open price. How to manage it to get and hold the open of the first bar of a trading session as a usable constant for further usage even if new intraday (=“intrasession“) bars occur? All other than daily bars will replace the open price every new bar.

Example: Trading session starts 09:00 (opening of the first minute – e.g. – bar), open of first bar is 1.5000. At 14:53 conditions are met and Long-Entry should be at open of first bar (= 1.5000) - 10 pips limit = 1.4990.

BTW: opend(0) is not what I need – it delivers yesterdays open, I need today’s open.

Many thanks for any help !

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Postby Dave Masalov » 15 Jul 2010

Dear raven,

openD(0) delivers today's open and openD(1) - yesterday's open.

raven
Posts: 31
Joined: 17 Oct 2009
Been thanked: 1 time

Postby raven » 16 Jul 2010

Dear Dave,

thank you - you are right, but my experience was:

Todays open is delivered by opend(0) not until the second intraday bar of today occurs. So you can’t trade the open of the first bar (e.g. minute) of a new session referencing this open with a limit order e.g. You have to wait until the second bar occurs and from then on you can use the new days open (which is indeed that one of the first not the second bar) all day long.

In my case problem is done anyhow. Many thanks again!

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Postby Dave Masalov » 16 Jul 2010

Dear raven,

There is a test data<>data[1].
That is why, even on the first bar of the new day, openD(0) returns right value.

raven
Posts: 31
Joined: 17 Oct 2009
Been thanked: 1 time

Postby raven » 16 Jul 2010

Dear Dave,

If you use this code (I checked it again and it stays true):

buy 1 contract next bar at opend(0) – 20 points limit ;

on a minute chart before session starts you will have to wait until the second bar occurs until your trade is submitted (at the open price of the first bar, not the second).
How to modify the code to trade the first bar as you suggest – if I understood you right?

Many thanks.

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Postby Dave Masalov » 19 Jul 2010

Dear raven,

The order is generated on close of the first bar, but gets filled on the next bar.

Please enable the IntrabarOrderGeneration and order may get filled on the first bar.


Return to “MultiCharts”