*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,
后续可能也会针对相关再做分享啰~~~

 

 

查看原文 >>
相关文章