菜鳥求助如何實現回調30%減倉?謝謝大家。 [開拓者 TB]
- 咨詢內容:
先奉上公式;
Params
Numeric length1(55);
Numeric length2(15);
Numeric length3(15);
Vars
Bool pdH;
Bool pdL;
Bool pdjianduo(False);
Bool pdjiankong(False);
Numeric closeh;
Numeric closel;
Numeric shuju;
Numeric shujuH;
Numeric shujuL;
Numeric price;
Numeric buypos;
Numeric buymax;
Numeric sellmax;
Numeric jianduoline;
Numeric jiankongline;
Numeric jiancangwei;
Numeric n(1);
Begin
PlotString("CurrentBar",Text(CurrentBar));
price=AvgEntryPrice;
buypos=Abs(MarketPosition);
PlotNumeric("ma1",Average(close,length1));
PlotNumeric("ma1+Close*0.005",Average(close,length1)+Close*0.005);
PlotNumeric("ma1-Close*0.005",Average(close,length1)-Close*0.005);
shuju=Average(close,length1);
shujuH=Average(close,length1)+Close*0.005;
shujuL=Average(close,length1)-Close*0.005;
pdH=Close>Highest(Close[1],length3);
pdL=Close<Lowest(Close[1],length3);
If(pdH==True)
{
closeh=close;
PlotString("Text","高點",High,Yellow);
}
If(pdL==True)
{
closel=close;
PlotString("Text","低點",Low,Yellow);
}
buymax=closeh-price;
sellmax=price-closel;
jianduoline=price+(buymax*0.7);
jiankongline=price-(sellmax*0.7);
pdjianduo=Close<jianduoline;
pdjiankong=Close>jiankongline;
jiancangwei=IntPart(length3*buypos);
If(Close[1]>shujuH And open>shuju And MarketPosition<=0)
{
if(MarketPosition<>0)
BuyToCover(0,Open);
Buy(0,Open);
}
If(Close[1]<shujuL And open<shuju And MarketPosition>=0)
{
if(MarketPosition<>0)
Sell(0,Open);
SellShort(0,Open);
}
If(MarketPosition>0 And pdjianduo==True)
{
if(CurrentBar>n*length2 And CurrentBar<(n+1)*length2)
{
Sell(jiancangwei,Open);
n=n+1;
}
n=n+1;
}
If(MarketPosition<0 And pdjiankong==true)
{
if(CurrentBar>=n*length2 And CurrentBar<=(n+1)*length2)
{
BuyToCover(jiancangwei,Open);
n=n+1;
}
n=n+1;
}
End
- TB技術人員:
公式的后半部份是有問題的,不知道如何能實現周期2中,出現高點后回調30%減倉。
求高手賜教。 - TB客服:
testone 發表于 2013-8-26 16:45
公式的后半部份是有問題的,不知道如何能實現周期2中,出現高點后回調30%減倉。
求高手賜教。 ...
你是想利潤回切30%減倉吧!
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 1145508240 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容