OPEN / LAST / CLOSE @ first tick of session

Questions about MultiCharts and user contributed studies.
lantama
Posts: 87
Joined: 20 Apr 2008
Has thanked: 5 times
Been thanked: 4 times

OPEN / LAST / CLOSE @ first tick of session

Postby lantama » 25 Jul 2010

Hi,

I am facing some trouble with different Prices when a Market opens or let's say when my MC Session starts for different futures. Data source is IB.

I need the first tick as session opening price for my calculations. Somehow I think the OPEN is information not very reliable as this comes from the feed and so it might be the market open and not my session opening price. So I used LAST, but i saw now that somtimes it uses data from the period before. That is really ugly. CLOSE from the fresh new bar seems to be better, what makes me wonder as I am looking for an proper session opening price?!

What is the difference between LAST and CLOSE. Is LAST only the second last price?!

Any expiriences with that behaviour?

Thanks
lantama

User avatar
TJ
Posts: 6601
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 971 times
Been thanked: 1910 times

Re: OPEN / LAST / CLOSE @ first tick of session

Postby TJ » 25 Jul 2010

Hi,

I am facing some trouble with different Prices when a Market opens or let's say when my MC Session starts for different futures. Data source is IB.

I need the first tick as session opening price for my calculations. Somehow I think the OPEN is information not very reliable as this comes from the feed and so it might be the market open and not my session opening price. So I used LAST, but i saw now that somtimes it uses data from the period before. That is really ugly. CLOSE from the fresh new bar seems to be better, what makes me wonder as I am looking for an proper session opening price?!

What is the difference between LAST and CLOSE. Is LAST only the second last price?!

Any expiriences with that behaviour?

Thanks
lantama


I would suggest you to press [F1] and get the definition of the keywords you use in your code.
There is specific instruction for LAST.



ps.
how the keywords behave depend on how you code.
can you post a snippet?

lantama
Posts: 87
Joined: 20 Apr 2008
Has thanked: 5 times
Been thanked: 4 times

Postby lantama » 25 Jul 2010

I don't get your answer. Yes, I CAN read. But the MC Power Language Editor Help isn't that helpful in this case.

Just think that you grap OPEN, LAST and CLOSE when the first tick of your session arrives. I think they all should be the same in case that it is really the very first tick. But very often they aren't the same.

@ TJ: If you have any helpful hints... fine, thank you. If not please leave the 'Newbie F1 hint' stuff.

Cheers
lantama

User avatar
TJ
Posts: 6601
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 971 times
Been thanked: 1910 times

Postby TJ » 25 Jul 2010

I don't get your answer. Yes, I CAN read. But the MC Power Language Editor Help isn't that helpful in this case.

Just think that you grap OPEN, LAST and CLOSE when the first tick of your session arrives. I think they all should be the same in case that it is really the very first tick. But very often they aren't the same.

@ TJ: If you have any helpful hints... fine, thank you. If not please leave the 'Newbie F1 hint' stuff.

Cheers
lantama


Pressing [F1] is not a newbie directive (I use [F1] all the time),
nor implying that you are ignorant or stupid.
You have given a lot of general information, but nothing specific (ie code snippet),
therefore [F1] is the logical first step.

The manual is very specific in what the keyword does,
if you do not follow the steps,
you do not get the result.
If you do not get the result,
you have not followed the instruction.

This is a discussion forum;
if you don't wish to post a snippet that caused your problem,
and get offended by first step debugging suggestions,
you should contact customer support directly.
http://www.tssupport.com/support/contacts/
http://www.tssupport.com/support/contacts/
Last edited by TJ on 25 Jul 2010, edited 4 times in total.

tekram
Posts: 96
Joined: 26 May 2009
Has thanked: 6 times
Been thanked: 18 times

Postby tekram » 25 Jul 2010

..
@ TJ: If you have any helpful hints... fine, thank you. If not please leave the 'Newbie F1 hint' stuff.

Cheers
lantama
Ouch.

Unfortunately, 'Last' is usually NOT the most recent quote when there are more than a few trades in one second. Last is a EL quote field value, and similar to other quote fields, it is generally updated two or three times per second; it is not updated on each trade tick. Therefore, the MC user guide is probably wrong when it says "Last will return the price of the last trade". It should say "Last will sometimes return the price of the last trade... if there aren't too many trades in one second .. and if your network is working properly ... and if your quote server is working... etc". But that is not really MC's fault, that is how TS defined it.

Sometimes, programmers will use the reserved word Last, rather than Close, because they believe that Last returns the last traded price and that Close returns the closing price of the bar. However, when used intrabar, Close returns the last traded price. In fact, because it is updated on every trade tick, rather than periodically like Last, Close is the more accurate representation of the price of the last trade.

lantama
Posts: 87
Joined: 20 Apr 2008
Has thanked: 5 times
Been thanked: 4 times

Postby lantama » 25 Jul 2010

Unfortunately, 'Last' is usually NOT the most recent quote when there are more than a few trades in one second. Last is a EL quote field value, and similar to other quote fields, it is generally updated two or three times per second; it is not updated on each trade tick. Therefore, the MC user guide is probably wrong when it says "Last will return the price of the last trade". It should say "Last will sometimes return the price of the last trade... if there aren't too many trades in one second .. and if your network is working properly ... and if your quote server is working... etc". But that is not really MC's fault, that is how TS defined it.

Sometimes, programmers will use the reserved word Last, rather than Close, because they believe that Last returns the last traded price and that Close returns the closing price of the bar. However, when used intrabar, Close returns the last traded price. In fact, because it is updated on every trade tick, rather than periodically like Last, Close is the more accurate representation of the price of the last trade.


That is interesting. IB is sampling the data anyway as they are not capable of sending every tick. However I observed often that Close and Last are actually different on an iday bar. Means Close was one tick 'younger' as Last (let's say that this my best guess right now). I could live with that. But I saw several times that LAST was from the bar before. And that is dangerous for my auto trading. And I think that this could be possible the other way round (close from wrong bar), too. I am wondering that nobody seems to face the same issues.

I don't think that this (wrong) behaviour is described somewhere in any manual. Any code snippet won't change it anyway as i am just using the values delivered by using the reserved words in EL. Maybe it is a special thing with IB data.

Best regards
lantama


Return to “MultiCharts”