Bonds settings  [SOLVED]

Questions about MultiCharts and user contributed studies.
User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Bonds settings

Postby arnie » 27 Sep 2012

I'm having some difficulty in setting the bond settings.

When selecting Symbol Dictionary using IQFeed for TY I have the following:
Price Scale - 1/32 and 10th of 32nd
Daily Limit - 1000
Min Movement - 5
Big Point Value - 1000

For US I have:
Price Scale - 1/32 and 10th of 32nd
Daily Limit - 1000
Min Movement - 10
Big Point Value - 1000

But when using IB symbols I get different settings.
For ZN (TY) I have:
Price Scale - 1/32 and S of 32nd
Daily Limit - 1
Min Movement - 1
Big Point Value - 1000

For ZB (US) I have:
Price Scale - 1/32 and 10th of 32nd
Daily Limit - 1
Min Movement - 10
Big Point Value - 1000

Which one is the correct one?

Thanks,
Fernando

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: Bonds settings

Postby arnie » 27 Sep 2012

I'm also having problems with the quotes themselves.

MC is quoting TY(ZN) at 133.17/32 but on a study we are getting 133.53 which is 17/32. If we take a trade at 133.17/32 we trade at 133.17 and not at 133.53.

How can I resolve this? How can I have my studies show 133.17 instead of 133.53?

escamillo
Posts: 203
Joined: 25 Mar 2011
Has thanked: 23 times
Been thanked: 56 times

Re: Bonds settings

Postby escamillo » 27 Sep 2012

0
Last edited by escamillo on 17 Nov 2014, edited 2 times in total.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Bonds settings

Postby Henry MultiСharts » 27 Sep 2012

Hello Arnie,

Each data feed provides data in his own format.
If you are using IQfeed for data and IB as broker then I would recommend you to set the IB settings for IQfeed instrument.
MC is quoting TY(ZN) at 133.17/32 but on a study we are getting 133.53 which is 17/32. If we take a trade at 133.17/32 we trade at 133.17 and not at 133.53.
How can I resolve this? How can I have my studies show 133.17 instead of 133.53?
Are you referring to an indicator plot or signal output?
For indicator make sure that Scaling is set to "Same as instrument" in Format->Study->Format->Scaling.
For signal make sure you have enough precision for the output:

Code: Select all

print(close:1:4);
This code will output 4 digits after the decimal.

escamillo
Posts: 203
Joined: 25 Mar 2011
Has thanked: 23 times
Been thanked: 56 times

Re: Bonds settings

Postby escamillo » 27 Sep 2012

The convention is 133'17.
Last edited by escamillo on 01 Oct 2012, edited 1 time in total.

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: Bonds settings

Postby arnie » 27 Sep 2012

Something simple:

Code: Select all

If LastBarOnChart_s then begin
value2 = high;

value1 = text_new(date, time, high,"");
text_setlocation(value1, date, time, high);
text_setstring(value1, text(value2));
text_setstyle(value1, 0, 2);
end;
I'm getting the same message as escamillo when trying to add an image.

This is what this is plotting, 149.41 instead of 149.13.

http://screencast.com/t/4BjMysjLC1

escamillo
Posts: 203
Joined: 25 Mar 2011
Has thanked: 23 times
Been thanked: 56 times

Re: Bonds settings

Postby escamillo » 27 Sep 2012

truncate the decimal portion and convert it to a fraction (or just a numerator) as text.
Last edited by escamillo on 01 Oct 2012, edited 1 time in total.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Bonds settings

Postby Henry MultiСharts » 27 Sep 2012

Something simple
This is what this is plotting, 149.41 instead of 149.13.
You are plotting Bar's High, which is 149 13/32 as can be seen on the screenshot.
149 13/32=149.40625=rounded to 149.41
149.13 - where did you get this value from?

Try this code to get 4 digits after the decimal:

Code: Select all

If LastBarOnChart_s then begin
value2 = high;

value1 = text_new(date, time, high,"");
text_setlocation(value1, date, time, high);
text_setstring(value1, text(value2:1:4));
text_setstyle(value1, 0, 2);
end;

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: Bonds settings

Postby arnie » 27 Sep 2012

Something simple
This is what this is plotting, 149.41 instead of 149.13.
You are plotting Bar's High, which is 149 13/32 as can be seen on the screenshot.
149 13/32=149.40625=rounded to 149.41
149.13 - where did you get this value from?

Try this code to get 4 digits after the decimal:

Code: Select all

If LastBarOnChart_s then begin
value2 = high;

value1 = text_new(date, time, high,"");
text_setlocation(value1, date, time, high);
text_setstring(value1, text(value2:1:4));
text_setstyle(value1, 0, 2);
end;
First I apologize, I should have written 149'13 and not 149.13.

When you trade bonds at what price do you execute your trades?
149'13 or 149.41?

http://screencast.com/t/1LTf9jAG

I know that the bar's high is 149 13/32, it's right there on the chart. The question should be why is MC converting fractions into decimals?

Tell me, how helpful is calling for the OHLC and as a result we get not the actual fraction but the decimal conversion.
See this image:

http://screencast.com/t/ECg3FvuD

Are you able to trade the ZB from those prices?
DayHigh - 149.97

So you decide to go long tomorrow above 149.97. Really?
Wouldn't be preferable when calling a bar's high, in this case the high for the day, we get 149'31 instead of 149.97? From these you are able to set an order to be triggered, NOT 149.97.

You must fix this ASAP.

I'm amazed that nobody complaint about this before. Probably no one trades bonds around here or the ones that do trade bonds are also programmers and were able to find a solution.

Why don't you create a function or something that users can use so when calling the OHLC we get the real fraction price and not a worthless decimal number?

I cannot believe that I'm not able to plot my main studies on bond charts because MC is converting fractions into decimals.

Check how MD handles fraction prices. They quote them as 149'13. When you call the high of a bar it is 149'13, NOT 149.97.

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: Bonds settings

Postby arnie » 27 Sep 2012

Something similar to this

Code: Select all

If LastBarOnChart_s then begin
value2 = high;
value1 = text_new(date, time, high,"");
text_setlocation(value1, date, time, high);
text_setstring(value1, numtostr(IntPortion(value2), 0) + "'" + NumToStr(FracPortion(value2) * 32, 1));
text_setstyle(value1, 0, 2);
end;

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: Bonds settings

Postby arnie » 28 Sep 2012

So I resolved one issue, converting all my strings to a realistic traded price.

Image

Naturally that I was forced to create a second version of this indicator so it can translate the strings into fractions since I'm not capable of creating some function that would recognize if we are dealing with decimals or fractions so it could act accordingly.

Nevertheless, this must be fixed.
Key words, such as OHCL must be capable of retrieving the true prices in which instruments are trading. Converting a fraction quote into decimals when the actual traded price is in fractions is nonsense.
Attachments
bond_str.png
(47.66 KiB) Downloaded 2278 times

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: Bonds settings

Postby arnie » 28 Sep 2012

Here's another example.

5 year DOM

Image

Simplify that, just quote it as it's traded, 124'20.25, 124'20.50, 124'20.75, 124'21...
Attachments
bond_DOM.png
(15.18 KiB) Downloaded 2400 times

escamillo
Posts: 203
Joined: 25 Mar 2011
Has thanked: 23 times
Been thanked: 56 times

Re: Bonds settings

Postby escamillo » 28 Sep 2012

DOM settings are based on your QuoteManager settings.
Attachments
zf.png
(41.58 KiB) Downloaded 1984 times
Last edited by escamillo on 01 Oct 2012, edited 1 time in total.

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: Bonds settings

Postby arnie » 28 Sep 2012

DOM settings are based on your QuoteManager settings. ZF is usually traded 128ths and not fractions of 32nds or 64ths.
Yes, I'm using IB's settings

Image
Attachments
ib_set.png
(20.79 KiB) Downloaded 2403 times

SP
Posts: 465
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 286 times

Re: Bonds settings

Postby SP » 29 Sep 2012

Removed.
Last edited by SP on 11 Nov 2012, edited 1 time in total.

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: Bonds settings

Postby arnie » 29 Sep 2012

You could use the _NumToStr_Auto function for auto detection. Keep in mind that it works only if the root settings a correct. Sometimes the default settings in the QM for Min.Movement for the Bonds are wrong (5 instead of 1). Best is to double check the root settings in the Symbol Directory with the TS default settings.
Unfortunately, for that function to work properly on ZB I need to change the price scale of it on QM and doing that I mess up a couple of other studies I use.

Check the differences.

Image

Image

Using a price scale of 1/32 the _NumToStr_Auto function gives a correct reading but when using 1/32 and 10th of 32nd, which are the settings that IB and IQFeed uses, the result is the normal decimal conversion.

I cannot change that price scale because changing it, as I said, will mess up other studies. Maybe there's a way to change the function to work properly under that price scale. Unfortunately that task is beyond my knowledge.
Attachments
func02.png
(26.06 KiB) Downloaded 2250 times
func01.png
(25.03 KiB) Downloaded 2249 times

SP
Posts: 465
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 286 times

Re: Bonds settings

Postby SP » 30 Sep 2012

I didnt change anything at the QM the last 2 years, on my settings i have set it at "1/32 and 10th of 32nd".

Dont know exactly what the difference between these 3 are, mabye Henry could clarify:
- "1/32 and S of 32nd".
- "1/32 and j of 32nd".
- "1/32 and 10th of32nd".
Last edited by SP on 11 Nov 2012, edited 2 times in total.

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: Bonds settings

Postby arnie » 30 Sep 2012

Dont know exactly what the difference between these 3 are, mabye Henry could clarify:
- "1/32 and S of 32nd".
- "1/32 and j of 32nd".
- "1/32 and 10th of32nd".
IQFeed and IB have the following settings:

- "1/32 and S of 32nd"
Used for the 10Y
- "1/32 and j of 32nd"
Used for the 5Y
- "1/32 and 10th of32nd"
Used for the 30Y

Since that function was designed for TS it than need to be updated to MC due to the different settings.

Anyone?

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Bonds settings

Postby TJ » 30 Sep 2012

You have to match the Min. Movement with the Price Scale.

To find the correct settings, go to

Tools > Symbol Dictionary > Data Source: esignal

Double click on the Root you are searching for (eg. ZB) and copy that settings.

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: Bonds settings

Postby arnie » 30 Sep 2012

You have to match the Min. Movement with the Price Scale.

To find the correct settings, go to

Tools > Symbol Dictionary > Data Source: esignal

Double click on the Root you are searching for (eg. ZB) and copy that settings.
Yes TJ, the settings are the same.
The function simply don't do its job using that setting "1/32 and 10th of32nd". It needs to be changed.
As I showed above, only with "1/32" setting the function is able to retrieve a correct fraction reading.

SP
Posts: 465
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 286 times

Re: Bonds settings

Postby SP » 30 Sep 2012

arnie,

the Min.Movement on the US on your first picture in post 16 shows 10 instead 1. That should solve your problem.

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: Bonds settings

Postby arnie » 01 Oct 2012

arnie,

the Min.Movement on the US on your first picture in post 16 shows 10 instead 1. That should solve your problem.
Sorry to say, but it doesn't.

Using the code...

Code: Select all

If LastBarOnChart_s then begin
value2 = high;
value1 = text_new(date, time, high,"");
text_setlocation(value1, date, time, high);
text_setstring(value1, _numtostr_auto(value2));
text_setstyle(value1, 0, 2);
end;
..and the different settings, I get the following

Image

Image

Image

Also, like I said, changing the original settings will mess up other studies, namely the ones that are calculating based on the high and low. I cannot change those settings.

There's 2 options, or that function is worked out or I maintain always 2 versions of the studies that are to be used on bonds and equities so I get correct fraction quotes, like I have at the moment:

Image

Image

The fraction version is not yet fully functioning since there's a couple of things to figure out...
Attachments
func07.png
(36.75 KiB) Downloaded 2248 times
func06.png
(32.65 KiB) Downloaded 2238 times
func05.png
(31.47 KiB) Downloaded 2234 times
func04.png
(31.46 KiB) Downloaded 2236 times
func03.png
(30.72 KiB) Downloaded 2243 times

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Bonds settings  [SOLVED]

Postby Henry MultiСharts » 01 Oct 2012

Dont know exactly what the difference between these 3 are, mabye Henry could clarify:
- "1/32 and S of 32nd".
- "1/32 and j of 32nd".
- "1/32 and 10th of32nd".
Hello SP,

Check the Price Scale information in the Setting Instrument Properties article.

SP
Posts: 465
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 286 times

Re: Bonds settings

Postby SP » 10 Nov 2012

Removed.
Last edited by SP on 11 Nov 2012, edited 1 time in total.

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: Bonds settings

Postby arnie » 10 Nov 2012

arnie,
could you test if with this new function SP.AutoFormatPrice all prices are displayed properly for the Bonds?
Great work SP.

As far as I can see, this function is working 100%.
Many thanks for your work. Hope this help many others that might be suffering from the way MC quote the treasuries.

Image

Image

Image

Image
Attachments
_US.png
(31.62 KiB) Downloaded 2166 times
_TY.png
(33.85 KiB) Downloaded 2175 times
_FV.png
(43 KiB) Downloaded 2165 times
_ES.png
(33.01 KiB) Downloaded 2166 times

escamillo
Posts: 203
Joined: 25 Mar 2011
Has thanked: 23 times
Been thanked: 56 times

Re: Bonds settings

Postby escamillo » 11 Nov 2012

Since you piked this code from the TS forum, written and posted by Doug McCrary (DougM@TS) on November 8, you might at least have given credit to the code writer and origin. Better yet, don't pike code from the TS forum and post it here.
Naturally that I was forced to create a second version of this indicator so it can translate the strings into fractions since I'm not capable of creating some function that would recognize if we are dealing with decimals or fractions so it could act accordingly.
You could use the _NumToStr_Auto function for auto detection. Keep in mind that it works only if the root settings a correct. Sometimes the default settings in the QM for Min.Movement for the Bonds are wrong (5 instead of 1). Best is to double check the root settings in the Symbol Directory against the other vendor default settings.

Code: Select all

{

Function: _NumToStr_Auto

Similar to the built-in NumToStr function, but automatically
determines if the symbol prices must be converted
to show 32nd, 64ths, 128ths ( Bond prices ), or are decimal based
and the number of decimals to display, such as 2 decimals for
regular stocks, and 4+ decimals for some Forex.

**** Uses the custom Decimals function created by goose. If you have
not already created this custom function then you will get a verification
error when attempting to verify this function.
Set this function to a String value Return Type on the General Tab.

}

inputs:
NumToConvert( numericsimple ) ;

variables:
Str1( "" ),
Symbol_Decimals ( Decimals( MinMove / PriceScale, 10 ) ) ;

// If the price scale is evenly divisible by 10 or is NOT evenly divisible by 32
// then use a decimal representation, else use a bond style representation with
// 32nds or 64ths shown using a quote (').
if Mod( PriceScale, 10 ) = 0 or PriceScale = 1 then
Str1 = NumToStr( NumToConvert, Symbol_Decimals )

// Grains, ...

SP
Posts: 465
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 286 times

Re: Bonds settings

Postby SP » 11 Nov 2012

escamillo,
i decided to remove the 2 posts.
Last edited by SP on 11 Nov 2012, edited 3 times in total.

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: Bonds settings

Postby arnie » 11 Nov 2012

Since you piked this code from the TS forum, written and posted by Doug McCrary (DougM@TS) on November 8, you might at least have given credit to the code writer and origin. Better yet, don't pike code from the TS forum and post it here.
Really? Are we going to be picky over this?
I also have the function written apparently by Doug McCrary(?) that a friend send me through email since I also don't have access to TS forum.
I did find odd the author didn't sign his name in the function code as programmers usually do, specially when they publish it on a public forum so all users might use it free of charge.

I believe SP did mention that the function was built for TS. If the author didn't sign his name how on earth can someone knows who wrote it? Do you really think that everyone has access to TS forum?

SP was kind enough to enhance the function so it can properly work over MC and this is his pay, someone bashing him, unbelievable...

escamillo
Posts: 203
Joined: 25 Mar 2011
Has thanked: 23 times
Been thanked: 56 times

Re: Bonds settings

Postby escamillo » 11 Nov 2012

SP was kind enough to enhance the function so it can properly work over MC and this is his pay, someone bashing him, unbelievable...
By 'enhance' you mean that since the code was posted using methods it would not work in MC and he converted it to a function. Out of respect for TS and the TS Forums, a Public post of a TS reply for recently requested help on code is NOT OK. There is a healthy separation between the TS and the MC forums and it needs to stay that way. And, who posted the code will probably agree with me.

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: Bonds settings

Postby arnie » 11 Nov 2012

SP was kind enough to enhance the function so it can properly work over MC and this is his pay, someone bashing him, unbelievable...
By 'enhance' you mean that since the code was posted using methods it would not work in MC and he converted it to a function. Out of respect for TS and the TS Forums, a Public post of a TS reply for recently requested help on code is NOT OK. There is a healthy separation between the TS and the MC forums and it needs to stay that way. And, who posted the code will probably agree with me.
Well, you are one the the lucky ones that have access to both forums so more power to you who knows what is and is not posted there.

You are talking as if we knew what is happening there. If I knew I'd probably agree with you but since we have no idea of what is happening there you cannot come here and comment on the matter the way you did.

There's might be a healthy separation between the forums but what you just did was the opposite.


Return to “MultiCharts”