For US Bond futures price, how can I change the price into fraction of 32 ticks. For example, the price from the chart is 11421, how do I change it to 114 21/32 or 114.656 in order to use it in the EFS study.
Announcement
Collapse
No announcement yet.
Bond price conversion
Collapse
X
-
markcchn
getValue("Close",0,-1); should return the value in decimals.
See the enclosed script as an example
Alex
PHP Code:function preMain() {
setPriceStudy(true);
setStudyTitle("decimal");
setShowCursorLabel(false);
}
function main() {
var vValue = getValue("Close",0,-1);
drawTextRelative(5,close(),vValue,Color.white,Color.blue,Text.VCENTER|Text.BOLD,"Arial",11,"Rate");
return ;
}
-
markcchn
Not sure I understand the question.
If you want to see the values in decimals in the Cursor Window then here is a way to do it.
Alex
PHP Code:function preMain() {
setPriceStudy(true);
setStudyTitle("decimal");
setCursorLabelName("Open",0);
setCursorLabelName("High",1);
setCursorLabelName("Low",2);
setCursorLabelName("Close",3);
}
function main(Rate) {
var Op = open();
var Hi = high();
var Lo = low();
var Cl = close();
return new Array(Op+"",Hi+"",Lo+"",Cl+"")
}
Comment
-
Hi Alex
Thanks ... I found your old post and the solution is:
sDisplayPrice = formatPriceNumber( close() );
Original link: http://forum.esignal.com/showthread....highlight=bond
Comment
Comment