My setup is the following:
Chart 1: hang seng index futures
Chart 2: hang seng index
Chart 3: s&p500
I have chosen 24/5 as time session.
I would like to call spx close t-1 and t-2, hang seng close t-1 and open t.
However checking in output it seem it is not grabbing the values correctly.
Example, on 28/10 HKTime 930am I would like
Spx close 27/10, 26/10
Hang seng index close 27/10, open 28/10.
Any ideas where things have gone wrong?
CloseD, openD functions
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: CloseD, openD functions
I think that you're getting the wrong values because `OpenD` and `CloseD` return the data based on the bar that they're called on. So `OpenD(1)` returns the day open for the previous bar, but a periods ago of 10 (`OpenD(10)`) can still return the same day open if that bar happens on the same day. So in other words, you might need to determine how many bars there are in a day, and then use a multiple of that for the number of periods ago.I would like to call spx close t-1 and t-2, hang seng close t-1 and open t.
However checking in output it seem it is not grabbing the values correctly.
Example, on 28/10 HKTime 930am I would like
Spx close 27/10, 26/10
Hang seng index close 27/10, open 28/10.
But without a code and output example it's hard to say what 'grabbing the values not correctly' causes.
Re: CloseD, openD functions
My understanding is the OpenD(1) means the open price of the instrument on the previous trading day.I think that you're getting the wrong values because `OpenD` and `CloseD` return the data based on the bar that they're called on. So `OpenD(1)` returns the day open for the previous bar, but a periods ago of 10 (`OpenD(10)`) can still return the same day open if that bar happens on the same day. So in other words, you might need to determine how many bars there are in a day, and then use a multiple of that for the number of periods ago.I would like to call spx close t-1 and t-2, hang seng close t-1 and open t.
However checking in output it seem it is not grabbing the values correctly.
Example, on 28/10 HKTime 930am I would like
Spx close 27/10, 26/10
Hang seng index close 27/10, open 28/10.
But without a code and output example it's hard to say what 'grabbing the values not correctly' causes.
I computed a function to work out the day moving averages on minute charts before. It works well and I have no problem with it. I dont think " but a periods ago of 10 (`OpenD(10)`) can still return the same day open if that bar happens on the same day" is a correct interpretation.
It leads me to think if having Hang Seng Index and SPX in the same chart would be the problem.
Thanks.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2223 times
Re: CloseD, openD functions
Just to clarify in case anybody misunderstood.My understanding is the OpenD(1) means the open price of the instrument on the previous trading day.
::
Thanks.
OpenD, CloseD, etc., operate on Date, not Symbol Session.
ie. the open price will be the first trade of a new bar on a new day.
If your chart is 24/7, the open price will be the first trade of the day.
ie the first trade after midnight, not the first trade of RTH or first trade of ETH.
If your chart is NOT 24/7, eg. from 930 to 1600, the open price will be the first trade of the bar that represents
Date > Date[1].
Re: CloseD, openD functions
TJ, got you.
In my case I need to trade Hang Seng Futures via calling closing prices of SPX on t-1 and t-2, what would be your suggestion? I guess CloseD wouldnt work here?
In my case I need to trade Hang Seng Futures via calling closing prices of SPX on t-1 and t-2, what would be your suggestion? I guess CloseD wouldnt work here?
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2223 times
Re: CloseD, openD functions
What is t-1 and t-2?TJ, got you.
In my case I need to trade Hang Seng Futures via calling closing prices of SPX on t-1 and t-2, what would be your suggestion? I guess CloseD wouldnt work here?
I read your first post and I have no idea what you are talking about.
Re: CloseD, openD functions
example,
On the 28/10, I am trading Hang Seng Futures, and my strategy wants to be able to reference to SPX Day Close on 27/10 and 26/10.
Previously when all instruments have the same time session I was able to use CloseD(1) and CloseD(2).
On the 28/10, I am trading Hang Seng Futures, and my strategy wants to be able to reference to SPX Day Close on 27/10 and 26/10.
Previously when all instruments have the same time session I was able to use CloseD(1) and CloseD(2).
Re: CloseD, openD functions
I am using 10 seconds chart for the trading instrument (Hang Seng Futures).
Day close for SPX means the official closing price for S&P500, 4pm EST I believe.
So at 930am HK Time 28th Oct, I would like to reference
S&P500 Official Closing Price on the 27th Oct ~EST 4pm
S&P500 Official Closing Price on the 26th Oct ~EST 4pm
Day close for SPX means the official closing price for S&P500, 4pm EST I believe.
So at 930am HK Time 28th Oct, I would like to reference
S&P500 Official Closing Price on the 27th Oct ~EST 4pm
S&P500 Official Closing Price on the 26th Oct ~EST 4pm