- 精华
- 0
- 在线时间
- 21 小时
- UID
- 281621
- 积分
- 13
- 帖子
- 8
- 阅读权限
- 10
- 注册时间
- 2019-7-19
- 最后登录
- 2021-9-19
- 精华
- 0
- UID
- 281621
- 积分
- 13
- 帖子
- 8
- 主题
- 5
- 阅读权限
- 10
- 注册时间
- 2019-7-19
- 最后登录
- 2021-9-19
|
4#
发表于 2020-6-9 14:53:16
来自手机
|只看该作者
Params
Numeric lots(1);
Numeric Length(6);
Numeric StopLossSet(2); Numeric TrailingStop(5); // 跟踪止损百分比
Numeric AmplitudeSet(80);
Numeric XZ(16);
Numeric Offset(4);
Vars
Numeric stopPoint; NumericSeries highChannel; NumericSeries lowChannel; NumericSeries rateOfHighToLow;//收盘价到的最低价 在 最高价到最低价的比列(N个Bar)
NumericSeries avgRateOfHTL; NumericSeries doubleAvgRateOfHTL; NumericSeries fastMA; NumericSeries slowMA; Bool bBuyCon;
Bool bSellCon; NumericSeries tradeNum; Numeric MinPoint;//最小价格调动点 Numeric StopProfitPrice;//止盈价格 NumericSeries HigherAfterEntry;//进场后,K线走势的最高价 NumericSeries LowerAfterEntry;//进场后,K线走势的最低价
Numeric StopLine(0);//止损、止盈线 Begin
If( High == Low) return ; MinPoint = MinMove*PriceScale; stopPoint = OpenD(1)*StopLossSet*0.01; If(Date != DATE[1])
{ highChannel = High; lowChannel = Low; //tradeNum = 0; }Else
{ highChannel = Max(highChannel[1],High); lowChannel = Min(lowChannel[1],Low); } rateOfHighToLow = Abs(Close - Lowest(Low,3*Length))/(Highest(High,3*Length)-Lowest(Low,3*Length))*100;//收盘价与最低价占比整根K线的比例 avgRateOfHTL = SMA(rateOfHighToLow,Length,1); // 比例再平均 doubleAvgRateOfHTL = SMA(avgRateOfHTL,Length,1);// 比例再平均 //PlotNumeric("rateOfHighToLow",rateOfHighToLow); //PlotNumeric("avgRateOfHTL",avgRateOfHTL); //PlotNumeric("doubleAvgRateOfHTL",doubleAvgRateOfHTL); fastMA = Average(Close,Length/2); slowMA = Average(Close,Length); bBuyCon = avgRateOfHTL[1] > AmplitudeSet //占比大于80% 多是阳线或者上涨情况 And fastMA[1] > slowMA[1] And Close[1] > fastMA[1] //两重均线判断是否是多头排列情况 And highChannel[1]/lowChannel[1] < 1+0.001*XZ And MarketPosition != 1; //当日振幅不大于 千XZ的值 防止突破价位已经不好
bSellCon = avgRateOfHTL[1] < 100 - AmplitudeSet //占比小于20% And fastMA[1] < slowMA[1] And Close[1] < fastMA[1] //两重均线判断是否是空头排列情况 And highChannel[1]/lowChannel[1] < 1+0.001*XZ And MarketPosition != -1; //当日振幅不大于 千XZ的值 防止突破价位已经不好
If(bBuyCon == True) { //PlotString("bBuy","bBuy",Low,Red);
Buy(lots,Open -Offset*MinPoint); Return; } If(bSellCon == True) { //PlotString("bSell","bSell",High,Green); SellShort(lots,Open+Offset*MinPoint); Return; } //Commentary("bBuyCon = "+IIFString(bBuyCon,"True","false")); //Commentary("bSellCon = "+IIFString(bSellCon,"True","false")); //Commentary("(avgRateOfHTL) "+Text(avgRateOfHTL)); If(MarketPosition == 1 And Low <= AvgEntryPrice - stopPoint) { Sell(0,Min(Open,AvgEntryPrice - stopPoint)+Offset*MinPoint); Return; }
If(MarketPosition == -1 And High >= AvgEntryPrice + stopPoint) { BuyToCover(0,Max(Open,AvgEntryPrice + stopPoint)-Offset*MinPoint); Return; }
End |
|