Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共4 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:请高手改一个策略

1楼
闪灵 发表于:2011/9/1 16:57:15
改成金字塔的... Inputs: bollingerLengths(50),trendLiqLength(50),numStdDevs(2), swingPrcnt1(0.50),swingPrcnt2(0.75),atrLength(10), swingTrendSwitch(20); Vars:cmiVal(0),buyEasierDay(0),sellEasierDay(0),trendLokBuy(0), trendLokSell(0),keyOfDay(0),swingBuyPt(0),swingSellPt(0), trendBuyPt(0),trendSellPt(0),swingProtStop(0); cmiVal = ChoppyMarketIndex(30); buyEasierDay = 0; sellEasierDay = 0; trendLokBuy = Average(Low,3); trendLokSell= Average(High,3); keyOfDay = (High + Low + Close)/3; if(Close > keyOfDay) then sellEasierDay = 1; if(Close <= keyOfDay) then buyEasierDay = 1; if(buyEasierDay = 1) then begin swingBuyPt = Open of tomorrow + swingPrcnt1*AvgTrueRange(atrLength); swingSellPt = Open of tomorrow - swingPrcnt2*AvgTrueRange(atrLength); end; if(sellEasierDay = 1) then begin swingBuyPt = Open of tomorrow + swingPrcnt2*AvgTrueRange(atrLength); swingSellPt = Open of tomorrow - swingPrcnt1*AvgTrueRange(atrLength); end; swingBuyPt = MaxList(swingBuyPt,trendLokBuy); swingSellPt = MinList(swingSellPt,trendLokSell); trendBuyPt = BollingerBand(Close,bollingerLengths,numStdDevs); trendSellPt = BollingerBand(Close,bollingerLengths,- numStdDevs); if(cmiVal < swingTrendSwitch)then begin if (MarketPosition <> 1) then Buy("SwingBuy") next bar at swingBuyPt stop; if(MarketPosition <> -1) then SellShort("SwingSell") next bar at swingSellPt stop; end else begin swingProtStop = 3*AvgTrueRange(atrLength); Buy("TrendBuy") next bar at trendBuyPt stop; SellShort("TrendSell") next bar at trendSellPt stop; Sell from Entry("TrendBuy") next bar at Average(Close,trendLiqLength) stop; BuyToCover from Entry("TrendSell") next bar at Average(Close,trendLiqLength) stop; Sell from Entry("SwingBuy") next bar at EntryPrice - swingProtStop stop; BuyToCover from Entry("SwingSell") next bar at EntryPrice + swingProtStop stop; end;
[此贴子已经被作者于2011-9-1 17:00:03编辑过]
2楼
闪灵 发表于:2011/9/1 17:00:20
晕啊怎么不能换行啊..
3楼
26327756l 发表于:2011/9/1 17:17:40

我来帮你换行,请使用IE浏览器。

 

 

Inputs: bollingerLengths(50),trendLiqLength(50),numStdDevs(2), swingPrcnt1(0.50),swingPrcnt2(0.75),atrLength(10), swingTrendSwitch(20);
Vars:cmiVal(0),buyEasierDay(0),sellEasierDay(0),trendLokBuy(0), trendLokSell(0),keyOfDay(0),swingBuyPt(0),swingSellPt(0), trendBuyPt(0),trendSellPt(0),swingProtStop(0);
 cmiVal = ChoppyMarketIndex(30);
 buyEasierDay = 0;
 sellEasierDay = 0;
 trendLokBuy = Average(Low,3);
  trendLokSell= Average(High,3);
  keyOfDay = (High + Low + Close)/3;
   if(Close > keyOfDay) then sellEasierDay = 1;
  if(Close <= keyOfDay) then buyEasierDay = 1;
  if(buyEasierDay = 1) then
   begin
   swingBuyPt = Open of tomorrow + swingPrcnt1*AvgTrueRange(atrLength);
  swingSellPt = Open of tomorrow - swingPrcnt2*AvgTrueRange(atrLength);
  end;
   if(sellEasierDay = 1) then begin swingBuyPt = Open of tomorrow + swingPrcnt2*AvgTrueRange(atrLength);
    swingSellPt = Open of tomorrow - swingPrcnt1*AvgTrueRange(atrLength);
  end;
  swingBuyPt = MaxList(swingBuyPt,trendLokBuy); swingSellPt = MinList(swingSellPt,trendLokSell);
   trendBuyPt = BollingerBand(Close,bollingerLengths,numStdDevs);
   trendSellPt = BollingerBand(Close,bollingerLengths,- numStdDevs);
if(cmiVal < swingTrendSwitch)then begin if (MarketPosition <> 1) then Buy("SwingBuy") next bar at swingBuyPt stop;
 if(MarketPosition <> -1) then SellShort("SwingSell") next bar at swingSellPt stop;
 end else
 begin swingProtStop = 3*AvgTrueRange(atrLength);
  Buy("TrendBuy") next bar at trendBuyPt stop;
SellShort("TrendSell") next bar at trendSellPt stop;
Sell from Entry("TrendBuy") next bar at Average(Close,trendLiqLength) stop;
 BuyToCover from Entry("TrendSell") next bar at Average(Close,trendLiqLength) stop;
Sell from Entry("SwingBuy") next bar at EntryPrice - swingProtStop stop;
 BuyToCover from Entry("SwingSell") next bar at EntryPrice + swingProtStop stop;
 end;

[此贴子已经被作者于2011-9-1 17:18:16编辑过]
4楼
fly 发表于:2011/9/2 9:08:55

看不懂.

还不如说出这段代码的思路,看能否实现呢

共4 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.04883 s, 3 queries.