close

*multicharts-資金控管指標篇*

※ 資金控管應用,僅供參考不為交易依據

 

 

 

 

資金控管-淨值曲線

淨值的曲線變化研究,需要用到3個multicharts內建函數

Netprofit             //淨利

Nprofit=I_OpenEquity//未平倉損益

profit=I_ClosedEquity//平倉即時損益

========我是分隔線=============我是分隔線==============我是分隔線==========

 

 

//指標code1

// i_OpenEquity 指標程式碼

//新增一個指標,然後新增指標,畫出未平倉損益圖

Inputs: MALen(60);

Variables: Nprofit(0), aOfNprofit(0),highOfNprofit(0),lowOfNprofit(0);

 

Nprofit = i_OpenEquity;  //未平倉損益

maOfNprofit = XAverage(Nprofit ,MALen);  //未平倉損益均線  參數:MALen

highOfNprofit = highest(Nprofit ,MALen); //取未平倉損益 MALen高點

lowOfNprofit= lowest(Nprofit ,MALen);    //取未平倉損益 MALen低點

 

//plot line and color

if Nprofit < maOfNprofit then

SetPlotColor(1, green)

else

SetPlotColor(1, red);

 

Plot1(Nprofit, "Equity");

Plot2(maOfNprofit, "MA", RGB(0, 128,255));

Plot3(highOfNprofit, "HIGHEST", RGB(255, 128,0));

Plot4(lowOfNprofit, "LOWEST", RGB(255,255,255));

 

========我是分隔線=============我是分隔線==============我是分隔線==========

//指標code2

// i_closedEquity 指標程式碼

//新增一個指標,然後新增指標,畫出未平倉損益圖

Inputs: MAPeriods(20);

Variables: profit(0), maOfprofit(0),highOfprofit(0),lowOfprofit(0);

 

profit = i_ClosedEquity;

maOfprofit = XAverage(profit ,MAPeriods);

highOfprofit = highest(profit ,MAPeriods);

lowOfprofit= lowest(profit ,MAPeriods);

 

//plot line and color

if profit < maOfprofit then

SetPlotColor(1, green)

else

SetPlotColor(1, red);

 

Plot1(profit, "Equity");

Plot2(maOfprofit, "MA", RGB(0, 128,255));

Plot3(highOfprofit, "HIGHEST", RGB(255, 128,0));

Plot4(lowOfprofit, "LOWEST", RGB(255,255,255));

 

========我是分隔線=============我是分隔線==============我是分隔線==========

//指標code3

 

// 淨值創新高指標程式碼

vars:Nprofit(0),profit(0),HNprofit(0);
 

Nprofit= i_OpenEquity; //未平倉損益

profit= i_ClosedEquity; //平倉損益

HNprofit= iff(profit>hnprofit,profit,hnprofit); //歷史高or創新高損益

 

plot1(HNprofit,"high_profit",RGB(255,0,0));//劃出歷史高or創新高損益

Plot2(profit,"profit",RGB(255,255,0));      //劃出平倉損益

 

 

========我是分隔線=============我是分隔線==============我是分隔線==========

//指標code4

/ MDD最大淨值回測指標程式碼

 

vars:Nprofit(0),profit(0),HNprofit(0);

vars:MDD(0),MDDMoney(0);

 

Nprofit= i_OpenEquity; //未平倉損益

profit= i_ClosedEquity; //平倉損益

HNprofit= iff(profit>hnprofit,profit,hnprofit); //歷史高or創新高損益

 

 

MDD= HNprofit-profit//MaxDrawdown最大平倉淨值回測

MDDMoney= iff(MDD>MDDMoney,MDD,MDDMoney); //最大平倉淨值回測金額

 

plot1(MDD,"MaxDrawdown",RGB(0,255,0));// MaxDrawdown最大平倉淨值回測

Plot2(MDDMoney,"MDDMoney",RGB(255,255,255)); //最大平倉淨值回測金額

 

========我是分隔線=============我是分隔線==============我是分隔線==========

//example_01波段 (如下圖)

//主圖1=台指期+訊號

//副圖2= i_OpenEquity 指標

//副圖3= i_closedEquity 指標

//副圖4= 淨值創新高指標

//副圖5= MDD最大淨值回測指標程式碼

 

 

========我是分隔線=============我是分隔線==============我是分隔線==========

//example_02當沖 (如下圖)

 

========我是分隔線=============我是分隔線==============我是分隔線==========

 

 

結語:


利用MultiCharts的內建函數, 畫出指標,
可視化 以方便我們觀察做紀錄,調整自己的交易策略與投資組合

經過2018年2月後, 相信更多投資人注意到風險管理的重要性,
不管是主觀交易還是量化交易都必須注意風險管理這區塊
風險管理中...不僅僅是須注意....交易槓桿風險的商品....保證金要多放,
更是必須注意到更多更多.......的細節,

運用得層面在很廣, 多策略評價管理、單策略部位管理以及投資組合調整權重等..........
 

......

.......

.....

有一陣子沒發文了,最近重心移轉到python與R,
後續可能也會針對相關再做分享囉~~~

 

 

arrow
arrow

    AJun 發表在 痞客邦 留言(0) 人氣()