Rss & SiteMap

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

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

标题:atr指标止损

1楼
tt782722334 发表于:2016/3/10 21:10:28
老师,我想用这个指标作为高低价突破入场,以atr指标作为离场,要怎么编写,下面的公式做参考,


variable: xstop=0;   

 tr:=max(high-low,max(abs(high-ref(close,1)),abs(low-ref(close,1)))); 
 atr:=sma(tr,20,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楼
wenarm 发表于:2016/3/11 8:54:16

正在处理,请耐心等待

3楼
wenarm 发表于:2016/3/11 10:11:20

你上面提供的代码。逻辑是不是有问题?你描述下你的需求。

if high>=hhv(high,20) //  不成立时xstop=0。

else if low>xstop //这个位置肯定成立了。
4楼
tt782722334 发表于:2016/3/11 12:07:54
是要在开仓后成立条件

5楼
wenarm 发表于:2016/3/11 12:36:05
不明白你的意图。你自己整理下你的需求,要求怎么进行量化处理。需要你提供量化的思路
共5 条记录, 每页显示 10 条, 页签: [1]


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