均线模型编写求助,多谢!
本帖最后由 ludiqiu 于 2019-1-21 10:22 编辑开多条件:
EMA 5 10 15 20 25 30 35 40 45 50 55 60 多头排列 即 EMA5>EMA10......>EMA60
平多条件 EMA 5 10 15 20 25 30 35 40 45 50 55 60 空头排列 即 EMA5<EMA10......<EMA60
开空条件:
EMA 5 10 15 20 25 30 35 40 45 50 55 60 空头排列 即 EMA5<EMA10......<EMA60
平空条件 EMA 5 10 15 20 25 30 35 40 45 50 55 60 多头排列 即 EMA5>EMA10......>EMA60
做多、做空分开写。 唉,想文华转TB,可惜TB售后不帮忙写策略,求助无门,只有到论坛求助。 ludiqiu 发表于 2019-1-21 10:21 static/image/common/back.gif
唉,想文华转TB,可惜TB售后不帮忙写策略,求助无门,只有到论坛求助。
TB的售后?TB好象没有售前售后一说呢。
TB与其它软件不一样,没有年费制的, 也没有说象其它软件一样付费后才能进论坛提问的。。
所以确实人员精力有限,没法满足每一个人交易者提出的写策略的需求呢。。
给您以多头开仓为例,大概写了一下。。(仅以4条线为例,更多的EMA线可自行添加)Params
Numeric Length1(5);
Numeric Length2(10);
Numeric Length3(15);
Numeric Length4(20);
Vars
NumericSeries EMA5;
NumericSeries EMA10;
NumericSeries EMA15;
NumericSeries EMA20;
Begin
EMA5 = XAverage(Close, Length1);
EMA10 = XAverage(Close, Length1);
EMA15 = XAverage(Close, Length1);
EMA20 = XAverage(Close, Length1);
PlotNumeric("EMA1",EMA5);
PlotNumeric("EMA2",EMA10);
PlotNumeric("EMA3",EMA15);
PlotNumeric("EMA4",EMA20);
If(MarketPosition!=1)
{
If(EMA5 >EMA10 && EMA10>EMA15 && EMA15>EMA20)
{
Buy(1,OPEN);
}
}
If(MarketPosition==1)
{
If(EMA5<EMA10 && EMA10<EMA15 && EMA15<EMA20)
{
Sell(1,open);
}
}
End 多谢小米老师! 请问小米老师:这么写对吗?
Params
Numeric Length1(5);
Numeric Length2(10);
Numeric Length3(15);
Numeric Length4(20);
Numeric Length5(25);
Numeric Length6(30);
Numeric Length7(35);
Numeric Length8(40);
Numeric Length9(45);
Numeric Length10(50);
Numeric Length11(55);
Numeric Length12(60);
Vars
NumericSeries EMA5;
NumericSeries EMA10;
NumericSeries EMA15;
NumericSeries EMA20;
NumericSeries EMA25;
NumericSeries EMA30;
NumericSeries EMA35;
NumericSeries EMA40;
NumericSeries EMA45;
NumericSeries EMA50;
NumericSeries EMA55;
NumericSeries EMA60;
Begin
EMA5 = XAverage(Close, Length1);
EMA10 = XAverage(Close, Length1);
EMA15 = XAverage(Close, Length1);
EMA20 = XAverage(Close, Length1);
EMA25 = XAverage(Close, Length1);
EMA30 = XAverage(Close, Length1);
EMA35 = XAverage(Close, Length1);
EMA40 = XAverage(Close, Length1);
EMA45 = XAverage(Close, Length1);
EMA50 = XAverage(Close, Length1);
EMA55 = XAverage(Close, Length1);
EMA60 = XAverage(Close, Length1);
PlotNumeric("EMA1",EMA5);
PlotNumeric("EMA2",EMA10);
PlotNumeric("EMA3",EMA15);
PlotNumeric("EMA4",EMA20);
PlotNumeric("EMA5",EMA25);
PlotNumeric("EMA6",EMA30);
PlotNumeric("EMA7",EMA35);
PlotNumeric("EMA8",EMA40);
PlotNumeric("EMA9",EMA45);
PlotNumeric("EMA10",EMA50);
PlotNumeric("EMA11",EMA55);
PlotNumeric("EMA12",EMA60);
If(MarketPosition!=1)
{
If(EMA5 >EMA10 && EMA10>EMA15 && EMA15>EMA20&& EMA20>EMA25 && EMA25>EMA30 && EMA30>EMA35 && EMA35>EMA40 && EMA40>EMA45 && EMA45>EMA50 && EMA50>EMA55 && EMA55>EMA60)
{
Buy(1,OPEN);
}
}
If(MarketPosition==1)
{
If(EMA5<EMA10 && EMA10<EMA15 && EMA15<EMA20 &&EMA20<EMA25 && EMA25<EMA30 && EMA30<EMA35 && EMA35<EMA40 && EMA40<EMA45&& EMA45<EMA50 && EMA50<EMA55 && EMA55<EMA60)
{
Sell(1,open);
}
}
If(MarketPosition!=1)
{
If(EMA5<EMA10 && EMA10<EMA15 && EMA15<EMA20 &&EMA20<EMA25 && EMA25<EMA30 && EMA30<EMA35 && EMA35<EMA40 && EMA40<EMA45&& EMA45<EMA50 && EMA50<EMA55 && EMA55<EMA60)
{
Sell(1,OPEN);
}
}
If(MarketPosition==1)
{
If(EMA5 >EMA10 && EMA10>EMA15 && EMA15>EMA20&& EMA20>EMA25 && EMA25>EMA30 && EMA30>EMA35 && EMA35>EMA40 && EMA40>EMA45 && EMA45>EMA50 && EMA50>EMA55 && EMA55>EMA60)
{
Sell(1,open);
}
}
End
页:
[1]