以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  策略编写求助区  (http://weistock.com/bbs/list.asp?boardid=11)
----  [求助]老师:您好!能否把TB的这个通道改成金字塔的图表交易?成功率高,谢谢!  (http://weistock.com/bbs/dispbbs.asp?boardid=11&id=8837)

--  作者:理想131289
--  发布时间:2011/11/6 14:53:15
--  [求助]老师:您好!能否把TB的这个通道改成金字塔的图表交易?成功率高,谢谢!
 Numeric ceilingAmt(60);
    Numeric floorAmt(20);
    Numeric bolBandTrig(2.00);
Vars
    Numeric lookBackDays(20);         
    Numeric todayVolatility(0);
    Numeric yesterDayVolatility(0);
    Numeric deltaVolatility(0);
    NumericSeries buyPoint(0);
    NumericSeries sellPoint(0);
    NumericSeries longLiqPoint(0);
    NumericSeries shortLiqPoint(0);
    Numeric upBand(0);
    Numeric dnBand(0);
    Numeric MidLine(0);
    Numeric Band(0);
Begin
    todayVolatility = StandardDev(Close,30,1);
    yesterDayVolatility = StandardDev(Close[1],30,1);
    deltaVolatility = (todayVolatility - yesterDayVolatility)/todayVolatility;
    lookBackDays = lookBackDays * (1 + deltaVolatility);
    lookBackDays = Round(lookBackDays,0);
    lookBackDays = Min(lookBackDays,ceilingAmt);
    lookBackDays = Max(lookBackDays,floorAmt);
    MidLine = AverageFC(Close,lookBackDays);
    Band = StandardDev(Close,lookBackDays,bolBandTrig);
    upBand = MidLine + bolBandTrig * Band;
    dnBand = MidLine - bolBandTrig * Band;
    buyPoint = Highest(High[1],lookBackDays);
    sellPoint = Lowest(Low[1],lookBackDays);
    longLiqPoint = Average(Close[1],lookBackDays);
    shortLiqPoint = Average(Close[1],lookBackDays);

if(Close > upBand)  
{
   If(CrossOver(high,buyPoint))   
  {
     Buy(1,max( buyPoint, Low ));

  }
Commentary("多头触发价:"+Text(buyPoint));

}

if(Close < dnBand)
{

   If(CrossUnder(Low,sellPoint ))
   {
      SellShort(1,min( sellPoint , High ));
   }
Commentary("空头触发价:"+Text(sellPoint));

}
if(MarketPosition == 1)
{  
   If(CrossUnder(Low,longLiqPoint ))
   {
      Sell(1,min( longLiqPoint , High ));
   }
Commentary("多头退出:"+Text(longLiqPoint));
}




if(MarketPosition == -1)

{
   If(CrossOver(high,shortLiqPoint))   
  {
     BuyToCover(1,max( shortLiqPoint, Low ));
  }
Commentary("多头退出:"+Text(shortLiqPoint));

}


End
--  作者:fly
--  发布时间:2011/11/7 10:13:47
--  

http://www.weistock.com/bbs/dispbbs.asp?boardid=11&Id=8551

看看这个帖子对您是否有帮助.

如果没有帮助到您.

 

希望,您把发的帖子的思路和原理具体说一下,好帮助您实现.


--  作者:理想131289
--  发布时间:2011/11/13 19:23:24
--  
那个是在TB论坛抄的,原理不清楚,看那个发贴有点专业水平就转过来,望改成金字塔试试,谢谢!
--  作者:蔡宛宏
--  发布时间:2011/12/19 15:04:29
--  
这个模型效果不咋的