求Wh9参数优化公式

04-09 18:09发布

Vars

Numeric EMA120;
Numeric EMA360;
Numeric EMA600;
Begin

EMA120=EMA(Close,120);
EMA360=EMA(Close,360);
EMA600=EMA(Close,600);
DrawIcon(CROSS(EMA120,EMA360),Low,"ICO1");
DrawIcon(CROSSDOWN(EMA120,EMA360),Low,"ICO2");
PlaySound(CROSS(EMA120,EMA360),"A");
PlaySound(CROSSDOWN(EMA120,EMA360),"B");
VertLine(WEEKDAY==1&&TIME==0.0900,RGB(0,255,255),Linethick2);
VertLine(WEEKDAY==1&&TIME==0.090000,RGB(0,255,255),Linethick2);
//VERTLINE(TIME==0.0900,RED);
//VERTLINE(TIME==0.2100,YELLOW);
//VERTLINE(TIME==0.1330,BLUE);
//VERTLINE(TIME==0.090000,RED);
//VERTLINE(TIME==0.210000,YELLOW);
//VERTLINE(TIME==0.133000,BLUE);

End
请把ema120 ema360 止盈,止损四个值都定义成参数,我想优化一下,谢谢老师啦

Vars

Numeric EMA120;
Numeric EMA360;
Numeric EMA600;
Begin

EMA120=EMA(Close,120);
EMA360=EMA(Close,360);
EMA600=EMA(Close,600);
DrawIcon(CROSS(EMA120,EMA360),Low,"ICO1");
DrawIcon(CROSSDOWN(EMA120,EMA360),Low,"ICO2");
PlaySound(CROSS(EMA120,EMA360),"A");
PlaySound(CROSSDOWN(EMA120,EMA360),"B");
VertLine(WEEKDAY==1&&TIME==0.0900,RGB(0,255,255),Linethick2);
VertLine(WEEKDAY==1&&TIME==0.090000,RGB(0,255,255),Linethick2);
//VERTLINE(TIME==0.0900,RED);
//VERTLINE(TIME==0.2100,YELLOW);
//VERTLINE(TIME==0.1330,BLUE);
//VERTLINE(TIME==0.090000,RED);
//VERTLINE(TIME==0.210000,YELLOW);
//VERTLINE(TIME==0.133000,BLUE);

End
请把ema120 ema360 止盈,止损四个值都定义成参数,我想优化一下,谢谢老师啦

付费偷看设置
发送
9条回答
2楼-- · 04-09 19:03
发错了,是下面这个公式

Vars

Numeric EMA120;
Numeric EMA360;
Begin
EMA120=EMA(Close,120);
EMA360=EMA(Close,360);
DrawIcon(CROSS(EMA120,EMA360),Low,"ICO1");
DrawIcon(CROSSDOWN(EMA120,EMA360),Low,"ICO2");
VertLine(WEEKDAY==1&&TIME==0.0900,RGB(0,255,255),Linethick2);
VertLine(WEEKDAY==1&&TIME==0.090000,RGB(0,255,255),Linethick2);
if(Cross(ema120,ema360))
{
BPK;
}
If(CrossDown(ema120,ema360))
{
SPK;
}
If(Close>=BKPrice+100*MinPrice||Close<=BKHigh-50*MinPrice)
{
SP;
}
If(Close<=SKPrice-100*MinPrice||Close>=SKLow+50*MinPrice)
{
BP;
}
End

文华解答
3楼-- · 04-09 19:24
参考:

Params
Numeric N1(120);
Numeric N2(360);
Numeric ZY(100);
Numeric ZS(50);
Vars
Numeric EMA120;
Numeric EMA360;
Begin
EMA120=EMA(Close,N1);
EMA360=EMA(Close,N2);
DrawIcon(CROSS(EMA120,EMA360),Low,"ICO1");
DrawIcon(CROSSDOWN(EMA120,EMA360),Low,"ICO2");
VertLine(WEEKDAY==1&&TIME==0.0900,RGB(0,255,255),Linethick2);
VertLine(WEEKDAY==1&&TIME==0.090000,RGB(0,255,255),Linethick2);
if(Cross(ema120,ema360))
{
BPK;
}
If(CrossDown(ema120,ema360))
{
SPK;
}
If(Close>=BKPrice+ZY*MinPrice||Close<=BKHigh-ZS*MinPrice)
{
SP;
}
If(Close<=SKPrice-ZY*MinPrice||Close>=SKLow+ZS*MinPrice)
{
BP;
}
End
4楼-- · 04-09 19:44
老师好,您写的那个公式在标记图标一二的时候显示是非法字符呢?能麻烦您在那两行公式稍微改一下吗?
文华解答
5楼-- · 04-09 20:04
我们测试可以检测通过的,您看下复制的源码是否完整,

或者菜单-》量化-》编写公式-》文件-》导入,导入下面压缩包再看下。


下载信息[文件大小:下载次数:]
图片点击可在新窗口打开查看文件名:编写.zip


6楼-- · 04-09 20:24
请问老师,我在对螺纹主连进行数据回测的时候,有什么办法可以消除合约换月对回测效果的影响?因为换月的时候经常会跳空。
文华解答
7楼-- · 04-09 20:44
您是长期趋势分析的思路,可以加载到指数上,指数是各月份合约加权计算的,连续性更好。

另外,在setting下编写Trade_Other:Auto;可以实现换月自动移仓,具体用法参考Trade_Other的函数说明。