Rss & SiteMap

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

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

标题:请帮忙改成金字塔公式

1楼
淡定688 发表于:2011/7/16 16:55:36

{海龟法则1交易系统}

{定义变量,即ATR Ratchet 跟踪停损价格}
variable: xstop=0;

{计算ATR}
tr:=max(high-low,max(abs(high-ref(close,1)),abs(low-ref(close,1))));
atr:=sma(tr,20,1);

{计算Turtle rule-1 跟踪停损价格}

if high>=hhv(high,20) then
        xstop:=llv(low,10); {20日新高,建立多头停损价格起点——最近10日低点}
else if low>xstop then
        xstop:=xstop+0.05*atr; {多头延续,每天跟踪停损价格上移ATR的5%}
else if low<=llv(low,20) then
        xstop:=hhv(high,10);{20日新低,建立空头停损价格起点——最近10日高点}
else if high<xstop then
        xstop:=xstop - 0.05*atr;{空头延续,每天跟踪停损价格下移ATR的5%}

StopPrice: xstop;{显示停损价格}

 

2楼
王锋 发表于:2011/7/16 17:11:57

{海龟法则1交易系统}

{定义变量,即ATR Ratchet 跟踪停损价格}
variable: xstop=0;

{计算ATR}
tr1:=max(high-low,max(abs(high-ref(close,1)),abs(low-ref(close,1))));
atr:=sma(tr1,20,1);

{计算Turtle rule-1 跟踪停损价格}
tmp1:=llv(low,10);
tmp2:=llv(low,20);
tmp3:=hhv(high,10);

if high>=hhv(high,20) then
        xstop:=tmp1; {20日新高,建立多头停损价格起点——最近10日低点}
else if low>xstop then
        xstop:=xstop+0.05*atr; {多头延续,每天跟踪停损价格上移ATR的5%}
else if low<=tmp2 then
        xstop:=tmp3;{20日新低,建立空头停损价格起点——最近10日高点}
else if high<xstop then
        xstop:=xstop - 0.05*atr;{空头延续,每天跟踪停损价格下移ATR的5%}

StopPrice: xstop;{显示停损价格}

 

3楼
淡定688 发表于:2011/7/16 18:52:55
非常感谢!
共3 条记录, 每页显示 10 条, 页签: [1]


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