期货futures
ret = 0; // 0:不确定状态; (0,100): 抄底;(100,x):修正,非抄底; (-100,0): 逃顶;(x,-100):修正,非抄底;
/***********different ******/
n=0;
c0 = szzs_c0();
c1 = szzs_c1();
c2 = szzs_c2();
c3 = szzs_c3();
c4 = szzs_c4();
/**************common below (2016/6/23 - v1) *******************/
{
open_n = ref(open,n); //当天开盘价
close_n = ref(close,n); //当天收盘价
high_n = ref(high,n); //当天最高价
low_n = ref(low,n); //当天最低价
close_n1 = ref(close,n+1); //往前n+1个交易日收盘价
close_n2 = ref(close,n+2); //往前n+2个交易日收盘价
close_n3 = ref(close,n+3); //往前n+3个交易日收盘价
close_n4 = ref(close,n+4); //往前n+3个交易日收盘价
close_n5 = ref(close,n+5);
open_n1 = ref(open,n+1); //往前n+1天开盘价
open_n2 = ref(open,n+2); //往前n+2天开盘价
open_n3 = ref(open,n+3); //往前n+3天开盘价
open_n4 = ref(open,n+4); //往前n+4天开盘价
low_n1 = ref(low,n+1); //往前n+1天最低价
low_n2 = ref(low,n+2); //往前n+2天最低价
low_n3 = ref(low,n+3); //往前n+3天最低价
low_n4 = ref(low,n+4); //往前n+4天最低价
//买入信号
norisedown = not((high_n-close_n)/close_n1>0.02 and close_n/close_n1<1.04);
if(close_n>open_n and close_n>ma(close_n,5) and norisedown and close_n/close_n1>1.017)
ret=51;
else if (close_n>open_n and norisedown and close_n/close_n1>1.017 and ma(close_n,5)>ma(close_n,10))
ret=52;
if (close_n>open_n and close_n>ma(close_n,5) )
{
//大涨1.2%或者以上,75%涨
if (close_n/close_n1>1.005 and code != 'usdcnh' )
ret = 1;
else if (close_n/close_n1>1.002 and code == 'usdcnh' )
ret=1;
//连续2次涨1%或者以上
else if (close_n/close_n1>1.002 and close_n1/close_n2>1.002 )
ret = 2;
//连红5日,最近4日不能大跌2%, 最近2天不能连续跌1%
else if(c0 and c1 and c2 and c3 and c4 and count(close_n1/close_n2>=0.995,4)==4 and ( close_n1/close_n2>0.995 or close_n2/close_n3>0.995))
ret = 3;
//红柱+ 1%或以上涨幅,前1日不能跌幅超过2%
else if (c0 and close_n/close_n1>1.002 and close_n1/close_n2>=0.995)
ret = 4;
}
//卖出信号
else if ( close_n<ma(close_n,5) and close_n<open_n) //破5日线,收阴
// and ( close_n<ma(close_n,20) or ( close_n==low_n) or (close_n>ma(close_n,20) and close_n>ma(close_n,20)*1.04)) ) // 破20日线 或者高于20日线的4% ,或当天最低
{
//count不起作用
i=0;
if(close_n1<open_n1)
i=i+1;
if(close_n2<open_n2)
i=i+1;
if(close_n3<open_n3)
i=i+1;
if(close_n4<open_n4)
i=i+1;
//
if (close_n/close_n1<0.995 and code != 'usdcnh')
ret = -1;
else if (close_n/close_n1<0.998 and code == 'usdcnh')
ret = -1;
//连续2次跌幅超过1%
else if (close_n/close_n1<0.998 and close_n1/close_n2<0.998 )
ret = -2;
//连绿5日,最近4日不能大涨1.7%或者以上,最近2天存在跌幅超过1%
else if (c0==0 and c1==0 and c2==0 and c3==0 and c4==0 and count(close_n1/close_n2 <= 1.005,4)==4 and ( close_n1/close_n2 < 0.998 or close_n2/close_n3 <0.998) )
ret = -3;
//绿柱,前1日不能大涨1.7%或者以上
else if (c0==0 and close_n1/close_n2 <= 1.005 and code != 'usdcnh' )
ret = -4;
else if (c0==0 and close_n1/close_n2 <= 1.002 and code == 'usdcnh' )
ret = -4;
//最近5日至少3阴线
// else if (count(close_n1<open_n1,4)>=2)
else if (i>=2 and ma(close_n,5)>ma(close_n,20))
ret = -6;
//大跌2%或者以上,最低破10日线
else if (close_n/close_n1<0.98 and low_n<ma(close_n,10))
ret = -7;
}
//special sell
if (close_n<ma(close_n,5) and close_n<open_n and close_n1<open_n1 and close_n2<open_n2 and close_n2>ma(close_n2,5))
ret=-51;
// else if (ma(close_n,5)>ma(close_n,20) and close_n<open_n and close_n1>open_n1 and close_n1>ma(close_n1,5) and close_n2>open_n2 and close_n3<open_n3 and close_n/close_n1>0.975
// and (close_n1/close_n2<1.017 or close_n2/close_n3<1.017) and (close_n1/close_n2<1.03 and close_n2/close_n3<1.03))
// ret=-52;
//4连阳后1阴破5日线
else if((open_n-close_n)/close_n1>0.02 and low_n<ma(close_n,5) and close_n1/close_n5>1.04 and close_n4>ma(close_n4,5) and close_n1>open_n1 and close_n2>open_n2 and close_n3>open_n3 and close_n4>open_n4
and close_n1>close_n2 and close_n2>close_n3 and close_n3>close_n4 and close_n4>close_n5)
ret=-53;
}
//------------------------------ only for p0-p13 begin --------------------------
//信号过滤,避免过多信号
if( ret<0 and ret>=-50 and close_n/close_n1>0.96)
{
//如果最近2日出买入信号且当天收盘价不低于买入日的最低价的0.99,过滤卖出信号
if(close_n1/close_n2>1.017)
{
if (close_n>low_n and close_n> low_n1 and low_n>low_n1*0.99)
ret = ret-200;
}
else if( (close_n2/close_n3>1.017 or (close_n1/close_n2>1.01 and close_n2/close_n3>1.01 and close_n2>ma(close_n2,5)))
and close_n>low_n and close_n> low_n2 and low_n>low_n2*0.99)
ret = ret-300;
}
else if( ret>0)
{
//如果最近2日出卖出信号且当天收盘价不低于卖出日的开盘价,过滤买入信号
if( close_n1/close_n2<0.98)
{
if (close_n<high_n and close_n< open_n1*1.0)
ret = 101;
}
else if( close_n2/close_n3<0.98 and close_n<high_n and close_n< open_n2*1.0)
ret = 102;
}
//------------------------------ only for p0-p13 end--------------------------
return ret;
上一指标公式:云主力筹码集中指标公式详解 同花顺筹码
下一指标公式:筹码分析指标公式详解 同花顺筹码
☉ 好公式网发布的指标公式主要用于软件技术面分析,仅供参考,勿用于实际操作,据此操作风险自负!
☉ 解压密码:www.goodgongshi.com 就是好公式网域名,希望大家看清楚,切勿输错。
☉ tnc和tni格式指标公式,仅可以用通达信软件引入使用,例如可以用通达信软件引入使用指标公式;
☉ tne格式指标公式,仅可以用通达信软件公式编辑器5.0版导入,高版本兼容低版本;
☉ fnc格式指标公式,可以用大智慧软件新一代高速行情分析系统股票软件使用,少部分可以用分析家软件引入使用;
☉ alg格式指标公式,仅仅可以用飞狐交易师软件引入使用;exp格式指标公式,仅可以用大智慧经典版软件引入使用;
☉ hxf格式指标公式,仅可以用同花顺软件引入使用。
☉ 如果您发现下载软件链接错误,请联系管理员报告错误。
☉ 好公式网欢迎各位网友帮忙宣传转发本站网址,有您的支持,我们会做得更好!
☉ 本文期货FUTURES指标公式详解 同花顺期货仅供学习研究。