The developer wishes Bid (which is a double variable containing the bid price of the current symbol) to be converted (with precision set to Digits which is an int variable representing the number of decimal places appropriate for the current symbol) to a string variable in order that it can be used in the ObjectSetText() function (which requires the 2nd parameter to be a string variable).
CB
The developer wishes Bid (which is a double variable containing the bid price of the current symbol) to be converted (with precision set to Digits which is an int variable representing the number of decimal places appropriate for the current symbol) to a string variable in order that it can be used in the ObjectSetText() function (which requires the 2nd parameter to be a string variable).
CB
thank you CB but I'm still a little confused about "string Market_Price"..If Market_Price is a string (which to me means it represents characters), how can it represent the market price as it is so labeled (bid ask price is a number) ?
string Market_Price
thank you CB but I'm still a little confused about "string Market_Price"..If Market_Price is a string (which to me means it represents characters), how can it represent the market price as it is so labeled (bid ask price is a number) ?
The name of the Market_Price variable is a bit misleading. It would have been better to name it something like Text_Market_Price, that conveys that it is a string and not the actual value. But note that it is not used for any calculations, it's only used in ObjectSetText() function to set the text of the label object "Market_Price_Label".
Think of it like this x11115
1. You type someone's phone number into your phone
2. You write down someone's phone number on a piece of paper
Now:
1. Is useful for actually calling the phone number
2. Can't be used for calling the number, but is useful for sticking in a shop window to advertise the number
In both cases, you call it "Joe Bloggs' phone number".
CB
What does this line of code do:
string Market_Price = DoubleToStr(Bid, Digits);
Bid |
Print(Bid) |
Print(DoubleToStr(Bid, Digits)) |
---|---|---|
1.56789 | 1.5679 * | 1.56789 |
1.56700 | 1.567 | 1.56700 |
1.50000 | 1.5 | 1.50000 |
* Print defaults to 4 digits of accuracy (rounded).
In your case you want the object text to read like the right column.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
What does this line of code do:
string Market_Price = DoubleToStr(Bid, Digits);
here is the full program: