Book Appointment Now

在圖表視窗顯示未平倉部位
這一篇說明 如何把即時的部位顯示在Multicharts圖表上
打開 powerlanguage 新增指標 ,程式碼如下
var:EP(“”),color(0);
if i_MarketPosition<>0 then EP= numtostr(i_AvgEntryPrice,0)+”x”+NumToStr(i_currentcontracts,0) else EP= “Empty”;
i_AvgEntryPrice是目前進場價位;i_currentcontracts目前的口數
定義字體顏色
if i_MarketPosition>0 then color=RGB(255,0,0);
if i_MarketPosition<0 then color=RGB(0,255,0);
if i_MarketPosition=0 then color=RGB(100,100,100);
定義字型大小 顏色…等
text_delete(Value1);
Value1=TEXT_New(D, T, H,””);
TEXT_SetString(Value1, EP); 設定圖表上顯示的文字
TEXT_SetColor(Value1, color); 設定文字的顏色
TEXT_SetStyle(Value1, 1, 1); 設定文字和K棒對齊的方式
TEXT_Setattribute(Value1,1,true); 設定文字的屬性(粗體、斜體還是加底線)
TEXT_SetSize(Value1,15); 設定字體大小
TEXT_Setlocation(Value1,D,T,GetAppInfo(aiLowestDispValue)+20); 設定顯示文字的位置
如下圖

把目前的訊號在圖表上用中文顯示
範例說明
input:text1(“”) ,text2(“”);
buy(text1) next bar at highest(H,20) stop;
sellshort(text2) next bar at Lowest(L,20) stop;
在參數設定的欄位上 直接輸入中文

如下圖 在圖表訊號上便可以顯示中文字
