about Text_new [MultiCharts MC]
- 咨詢內容:
其語法 Text_New
(BarDate, BarTime, PriceValue,"Text
")請問這里的 "text" 可以用 string1=("")取代嗎
比如說
var:string1("");
string1=doublequote + L + doublequote;(????可以這樣用嗎)
text_new=(date, time, L, string1);或是有其他方法可以在圖表上輸出變數而不只是特定文字呢
- MC技術部:數字要丟到字串變數去,要做格式轉換,常用的有以下兩個轉換指令
text()numtostr()
用法如下: (工具書有更清楚的說明)Text
傳回由輸入參數組合而成的字串。
Text
(Param1, Param2, ..., ParamN);其中:
Param(i)
可以是字串、數值或是布林值(True/False
)。
,Text_new
(D
,T
,C
,Text
("Bar Date/Time is "
,Date
:0
:0
,"/"Time
:0
:0
));NumToStr
將數值轉換成字串。
NumToStr
(Expression,Dec)其中:
Expression
- 要轉換成字串的數值
Dec
- 指定要顯示的小數位數下述范例傳回字串"1500.500":
NumToStr
(1500.5
,3
); - MC客服:var:string1("");
string1=doublequote + numtostr(L,2) + doublequote;text_new(date,time,L,string1); - MC客服:OK, 謝謝回覆, 這兩個方法都可以達到目的, 但看來是 text( ) 比較好用
但如果不要出現小數點以下的"00" 那就只好用NumToStr( )的方法
if currentbar=1 then begin
value1=text_new(date, time, H,text(H));
value2=text_new(date,time,L,NumToStr(L,0));
text_setcolor(value2,green);
end; - MC客服:有沒有發現,text的范例中有 :0:0那是指定格式轉換唷先賣個關子,你試了就知有何效果了
相關文章
-
沒有相關內容