/*交易规则:
以简单移动平均线判断趋势,收盘价在均线之上为多头趋势,在均线之下为空头趋势;
为过滤均线假突破,在均线基础上加减一定百分比形成围绕均线的上下两条通道;
价格盘中突破上轨,进场做多或平空反多;
价格盘中突破下轨,进场做空或平多反空;
增加跟踪止盈的功能(峰值价回落ATR倍数);
跟踪止盈后突破出场前高(低)点再进场;
*/
Params
Numeric length(10); //均线周期
Numeric profit(0.1); //加减百分比
怎么搜索图片Numeric ATRLength(20); //ATR周期
塞尔维亚足球队Numeric TrailStop(2); //ATR倍数h2漫画
Numeric lots(1);
Vars
Numeric MA;
Numeric hiband;
Numeric loband;
NumericSeries ATRValue;
NumericSeries HiAfterEntry;
NumericSeries LoAfterEntry;
济南趵突泉Numeric Stopline;
Begin
ATRValue = AvgTrueRange(ATRLength);
MA=AverageFC(Clo[1],length);
hiband=MA*(1+0.01*profit);
loband=MA*(1-0.01*profit);涉县核桃
PlotNumeric("hi",hiband);
PlotNumeric("lo",loband);
If(Clo>hiband)Buy(lots,Clo);
If(Clo<loband)SellShort(lots,Clo);
If (MarketPosition == 1 and BarsSinceEntry == 0) HiAfterEntry = High;
If (MarketPosition == 1 and BarsSinceEntry >= 1)
HiAfterEntry = Max(HiAfterEntry,High);
If (MarketPosition == -1 and BarsSinceEntry == 0) LoAfterEntry = Low;
If (MarketPosition == -1 and BarsSinceEntry >= 1)
梦见和父亲打架
LoAfterEntry = Min(LoAfterEntry,Low);
If(BarssinceEntry > 0 && MarketPosition == 1)
{
怎么织围脖军训个人总结StopLine = HiAfterEntry[1] - TrailStop * ATRValue[1];
//PlotNumeric("StopLine",StopLine);
If (Low <= StopLine)
{
Sell(0, Min(Open, Stopline));
}
}
El If(BarssinceEntry > 0 && MarketPosition == -1)
{
StopLine = LoAfterEntry[1] + TrailStop * ATRValue[1];
//PlotNumeric("StopLine1",StopLine);
If(High >= StopLine)
{
BuyToCover(0, Max(Open, Stopline));
}
}
End