菲波纳契螺旋周期指标公式源码(斐波那契螺旋线公式)
本文目录一览:
如何在通达信显示裴波那挈数列指标公式
{方法有2个:其一:网上找到的公式}
HDAY:=80;LDAY:=80;调点:=3;角度:=100;之字幅度:=25;横向调节:=1;
TCH:=CONST(FINDHIGH(H,0,HDAY*10,1));
GTT:=CONST(BARSLAST(TCH=H))+1;
SX跌H:=CONST(IF(GTT=1,H,REF(H,GTT-1)));
BCL:=CONST(FINDLOW(L,0,LDAY*10,1));
DTT:=CONST(BARSLAST(BCL=L))+1;
SX涨L:=CONST(IF(DTT=1,L,REF(L,DTT-1)));
涨点:=BARSSINCE(BACKSET(ISLASTBAR,BARSLAST(L=SX涨L)+1));
跌点:=BARSSINCE(BACKSET(ISLASTBAR,BARSLAST(H=SX跌H)+1));
最低:=IF(调点=1,跌点,IF(调点=2,涨点,IF(调点=3,涨点,跌点)));
L斜率:=角度/IF(C最高:=IF(调点=1,跌点,IF(调点=2,涨点,IF(调点=3,跌点,涨点)));
H斜率:=角度/IF(CIM68:=((SX跌H-SX涨L)/6-(SX跌H-SX涨L)/8);
GH跌X:=SX跌H+(SX跌H-SX涨L)/8;
DL涨X:=SX涨L-(SX跌H-SX涨L)/8;
GTHT:=IF(DTTGTT,DTT,GTT);
R:=ABS(GTT-DTT);
{斐波那契周期}
DRAWTEXT(CURRBARSCOUNT=GTT,SX跌H*0.98,'斐波那契下跌周期'),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=GTT,SX跌H*0.99,'1'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-2,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-2,SX跌H*0.99,'3'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-4,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-4,SX跌H*0.99,'5'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-7,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-7,SX跌H*0.99,'8'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-12,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-12,SX跌H*0.99,'13'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-20,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-20,SX跌H*0.99,'21'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-33,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-33,SX跌H*0.99,'34 '),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-54,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-54,SX跌H*0.99,'55'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-88,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-88,SX跌H*0.99,'89'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-143,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-143,SX跌H*0.99,'144'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-232,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-232,SX跌H*0.99,'233'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-376,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-376,SX跌H*0.99,'377'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-609,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-609,SX跌H*0.99,'610'),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=GTT-986,SX跌H,SX涨L,0,0),COLOR556600;
DRAWTEXT(CURRBARSCOUNT=GTT-986,SX跌H*0.99,'987'),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=DTT,SX涨L*1.03,'斐波那契上升周期'),COLOR0000FF;
DRAWTEXT(CURRBARSCOUNT=DTT,SX涨L*1.01,'1'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-2,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-2,SX涨L*1.01,'3'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-4,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-4,SX涨L*1.01,'5'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-7,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-7,SX涨L*1.01,'8'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-12,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-12,SX涨L*1.01,'13'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-20,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-20,SX涨L*1.01.01,'21'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-33,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-33,SX涨L*1.01,'34'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-54,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-54,SX涨L*1.01,'55'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-88,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-88,SX涨L*1.01,'89'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-143,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-143,SX涨L*1.01,'144'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-232,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-232,SX涨L*1.01,'233'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-376,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-376,SX涨L*1.01,'377'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-609,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-609,SX涨L*1.01,'610'),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=DTT-986,SX跌H,SX涨L,0,0),COLORAA00AA;
DRAWTEXT(CURRBARSCOUNT=DTT-986,SX涨L*1.01,'987'),COLOR0000FF;
{其二:系统画线工具里有}
通达信斐波那契时间指标公式
DRAWGBK(CO,RGB(20,10,90),RGB(0,0,0),0,'1',0);
DIFF1:=EMA(CLOSE,12)-EMA(CLOSE,26),COLORFFFFFF;
DEA1:=EMA(DIFF1,9),COLORYELLOW;
macd1:=2*(DIFF1-DEA1);
MacD2:=EMA(MACD1,5);
stICKLINE(MACD1MACD2 AND MACD10,0,MACD1,3,0),COLOR000055;
STICKLINE(MACD1MACD2 AND MACD10,0,MACD1,2.5,0),COLOR000077;
STICKLINE(MACD1MACD2 AND MACD10,0,MACD1,1.5,0),COLOR000099;
STICKLINE(MACD1MACD2 AND MACD10,0,MACD1,1,0),COLOR0000FF;
STICKLINE(MACD1MACD2 AND MACD10,0,MACD1,3,0),COLOR222222;
STICKLINE(MACD1MACD2 AND MACD10,0,MACD1,2.5,0),COLOR444444;
STICKLINE(MACD1MACD2 AND MACD10,0,MACD1,1.5,0),COLOR666666;
STICKLINE(MACD1MACD2 AND MACD10,0,MACD1,0,0),COLOR999999;
STICKLINE(MACD1MACD2,0,MACD1,3,0),COLORA80000;
STICKLINE(MACD1MACD2,0,MACD1,2.5,0),COLORB80000;
STICKLINE(MACD1MACD2,0,MACD1,1.5,0),COLOREC1000;
STICKLINE(MACD1MACD2,0,MACD1,1,0),COLORFF4600;
STICKLINE(MACD1MACD2,0,MACD1,0,0),COLORFFAA00;
低位金叉:=crOSS(DIFF1,DEA1) AND DIFF1-0.1;
STICKLINE(低位金叉,0,DIFF1,3,0),COLOR002222;
STICKLINE(低位金叉,0,DIFF1,2.5,0),COLOR006666;
STICKLINE(低位金叉,0,DIFF1,1.5,0),COLOR009999;
STICKLINE(低位金叉,0,DIFF1,1,0),COLOR00FFFF;
DRAWTEXT(低位金叉,0.2,' 低位金叉'),COLOR00FF88;
JCCOUNT:=COUNT(CROSS(DIFF1,DEA1),BArslAST(DEA1=0));
二次金叉:=CROSS(DIFF1,DEA1) AND DEA10 AND COUNT(JCCOUNT=2,21)=1;
STICKLINE(二次金叉,MACD1,-0.01,3,0),COLOR440044;
STICKLINE(二次金叉,MACD1,-0.01,2.5,0),COLOR660066;
STICKLINE(二次金叉,MACD1,-0.01,1.5,0),COLOR990099;
STICKLINE(二次金叉,MACD1,-0.01,1,0),COLORFF00FF;
DRAWTEXT(二次金叉,DEA1*1.3,' 二次金叉'),COLORYELLOW;
A1:=BARSLAST(REF(CROSS(DIFF1,DEA1),1));
底背离:=REF(CLOSE,A1+1)CLOSE AND DIFF1REF(DIFF1,A1+1) AND CROSS(DIFF1,DEA1);
STICKLINE(底背离,0,0.03,6,0),COLOR00FF00;
DRAWLINE(A1=0,DEA1,底背离,DEA1,0),COLORRED,LINETHICK1;
DRAWTEXT(底背离,0.03,' 底背离'),COLORFF00FF;
A2:=BARSLAST(REF(CROSS(DEA1,DIFF1),1));
顶背离:=REF(CLOSE,A2+1)CLOSE AND REF(DIFF1,A2+1)DIFF1 AND CROSS(DEA1,DIFF1);
DRAWLINE(A2=0,DEA1,顶背离,DEA1,0),COLORFF8800,LINETHICK1;
DRAWTEXT(顶背离,-0.02,' 顶背离'),COLORFFFF00;
DIFF:DIFF1,COLOR009922;
DEA:DEA1,COLORYELLOW;
ZT:=CROSS(DEA,DIFF);
LS0:=BARSLAST(ZT);
S1:=IF(1,LS0=1,ZT) AND IF(1,DIFFDEA,0);
DRAWTEXT(S1 AND DIFF0,DIFF*0.8,'1'),COLOR00FF00;
DRAWTEXT(S1 AND DIFF0,DIFF*1.8,'1'),COLOR00FF00;
S3:=IF(3,LS0=3,ZT) AND IF(3,DIFFDEA,0);
DRAWTEXT(S3 AND DIFF0,DIFF*0.8,'3'),COLOR00FF00;
DRAWTEXT(S3 AND DIFF0,DIFF*1.4,'3'),COLOR00FF00;
S5:=IF(5,LS0=5,ZT) AND IF(5,DIFFDEA,0);
DRAWTEXT(S5 AND DIFF0,DIFF*0.8,'5'),COLOR00FF00;
DRAWTEXT(S5 AND DIFF0,DIFF*1.4,'5'),COLOR00FF00;
S8:=IF(8,LS0=8,ZT) AND IF(8,DIFFDEA,0);
DRAWTEXT(S8 AND DIFF0,DIFF*0.8,'8'),COLOR00FF00;
DRAWTEXT(S8 AND DIFF0,DIFF*1.8,'8'),COLOR00FF00;
S13:=IF(13,LS0=13,ZT) AND IF(8,DIFFDEA,0);
DRAWTEXT(S13 AND DIFF0,DIFF*0.8,'13'),COLOR00FF00;
DRAWTEXT(S13 AND DIFF0,DIFF*1.2,'13'),COLOR00FF00;
S21:=IF(21,LS0=21,ZT) AND IF(21,DIFFDEA,0);
DRAWTEXT(S21 AND DIFF0,DIFF*0.8,'21'),COLOR00FF00;
DRAWTEXT(S21 AND DIFF0,DIFF*1.2,'21'),COLOR00FF00;
S26:=IF(26,LS0=26,ZT) AND IF(26,DIFFDEA,0);
DRAWTEXT(S26 AND DIFF0,DIFF*0.8,'26'),COLOR00FF00;
DRAWTEXT(S26 AND DIFF0,DIFF*1.2,'26'),COLOR00FF00;
S29:=IF(29,LS0=29,ZT) AND IF(29,DIFFDEA,0);
DRAWTEXT(S29 AND DIFF0,DIFF*0.8,'29'),COLOR00FF00;
DRAWTEXT(S29 AND DIFF0,DIFF*1.2,'29'),COLOR00FF00;
S34:=IF(34,LS0=34,ZT) AND IF(34,DIFFDEA,0);
DRAWTEXT(S34 AND DIFF0,DIFF*0.8,'34'),COLOR00FF00;
DRAWTEXT(S34 AND DIFF0,DIFF*1.8,'34'),COLOR00FF00;
S55:=IF(55,LS0=55,ZT) AND IF(55,DIFFDEA,0);
DRAWTEXT(S55 AND DIFF0,DIFF*0.8,'55'),COLOR00FF00;
DRAWTEXT(S55 AND DIFF0,DIFF*1.8,'55'),COLOR00FF00;
S68:=IF(68,LS0=68,ZT) AND IF(68,DIFFDEA,0);
DRAWTEXT(S68 AND DIFF0,DIFF*0.8,'68'),COLOR00FF00;
DRAWTEXT(S68 AND DIFF0,DIFF*1.8,'68'),COLOR00FF00;
ZTJ:=CROSS(DIFF,DEA);
LSJ:=BARSLAST(ZTJ);
SJ1:=IF(1,LSJ=1,ZTJ) AND IF(1,DIFFDEA,0);
DRAWTEXT(SJ1 AND DIFF0,DIFF*1.2,'1'),COLORFFFFFF;
DRAWTEXT(SJ1 AND DIFF0,DIFF*0.8,'1'),COLORFFFFFF;
SJ3:=IF(3,LSJ=3,LSJ) AND IF(3,DIFFDEA,0);
DRAWTEXT(SJ3 AND DIFF0,DIFF*1.2,'3'),COLORFFFFFF;
DRAWTEXT(SJ3 AND DIFF0,DIFF*0.8,'3'),COLORFFFFFF;
SJ5:=IF(5,LSJ=5,ZTJ) AND IF(5,DIFFDEA,0);
DRAWTEXT(SJ5 AND DIFF0,DIFF*1.2,'5'),COLORFFFFFF;
DRAWTEXT(SJ5 AND DIFF0,DIFF*0.8,'5'),COLORFFFFFF;
SJ8:=IF(8,LSJ=8,ZTJ) AND IF(8,DIFFDEA,0);
DRAWTEXT(SJ8 AND DIFF0,DIFF*1.2,'8'),COLORFFFFFF;
DRAWTEXT(SJ8 AND DIFF0,DIFF*0.8,'8'),COLORFFFFFF;
SJ13:=IF(13,LSJ=13,ZTJ) AND IF(8,DIFFDEA,0);
DRAWTEXT(SJ13 AND DIFF0,DIFF*1.2,'13'),COLORFFFFFF;
DRAWTEXT(SJ13 AND DIFF0,DIFF*0.8,'13'),COLORFFFFFF;
SJ18:=IF(18,LSJ=18,ZTJ) AND IF(8,DIFFDEA,0);
DRAWTEXT(SJ18 AND DIFF0,DIFF*1.2,'18'),COLORFFFFFF;
DRAWTEXT(SJ18 AND DIFF0,DIFF*0.8,'18'),COLORFFFFFF;
SJ21:=IF(21,LSJ=21,ZTJ) AND IF(21,DIFFDEA,0);
DRAWTEXT(SJ21 AND DIFF0,DIFF*1.2,'21'),COLORFFFFFF;
DRAWTEXT(SJ21 AND DIFF0,DIFF*0.8,'21'),COLORFFFFFF;
SJ26:=IF(26,LSJ=26,ZTJ) AND IF(26,DIFFDEA,0);
DRAWTEXT(SJ26 AND DIFF0,DIFF*1.2,'26'),COLORFFFFFF;
DRAWTEXT(SJ26 AND DIFF0,DIFF*0.8,'26'),COLORFFFFFF;
SJ29:=IF(29,LSJ=29,ZTJ) AND IF(29,DIFFDEA,0);
DRAWTEXT(SJ29 AND DIFF0,DIFF*1.2,'29'),COLORFFFFFF;
DRAWTEXT(SJ29 AND DIFF0,DIFF*0.8,'29'),COLORFFFFFF;
SJ34:=IF(34,LSJ=34,ZTJ) AND IF(34,DIFFDEA,0);
DRAWTEXT(SJ34 AND DIFF0,DIFF*1.2,'34'),COLORFFFFFF;
DRAWTEXT(SJ34 AND DIFF0,DIFF*0.8,'34'),COLORFFFFFF;
SJ47:=IF(47,LSJ=47,ZTJ) AND IF(47,DIFFDEA,0);
DRAWTEXT(SJ47 AND DIFF0,DIFF*1.2,'47'),COLORFFFFFF;
DRAWTEXT(SJ47 AND DIFF0,DIFF*0.8,'47'),COLORFFFFFF;
SJ55:=IF(55,LSJ=55,ZTJ) AND IF(55,DIFFDEA,0);
DRAWTEXT(SJ55 AND DIFF0,DIFF*1.2,'55'),COLORFFFFFF;
DRAWTEXT(SJ55 AND DIFF0,DIFF*0.8,'55'),COLORFFFFFF;
SJ60:=IF(60,LSJ=60,ZTJ) AND IF(60,DIFFDEA,0);
DRAWTEXT(SJ60 AND DIFF0,DIFF*1.2,'63'),COLORFFFFFF;
DRAWTEXT(SJ60 AND DIFF0,DIFF*0.8,'63'),COLORFFFFFF;
SJ68:=IF(68,LSJ=68,ZTJ) AND IF(68,DIFFDEA,0);
DRAWTEXT(SJ68 AND DIFF0,DIFF*1.2,'68'),COLORFFFFFF;
DRAWTEXT(SJ68 AND DIFF0,DIFF*0.8,'68'),COLORFFFFFF;
股票螺旋周期的计算
这位同学,你的问题提得很高深啊~
呃。我就用斐波纳契数列来回答了,先说说他的理论:
800年前,意大利的数学家斐波纳契提出了著名的“兔子问题”:假定一对兔子每个月可以生一对兔子,而这对新兔子在出生后第二个月就开始生另外一对兔子,这些兔子不会死去,那么一对兔子一年内能繁殖多少对兔子?
答案是一组非常特殊的数字:1,1,2,3,5,8,13,21,34,55,89……不难发现,从第三个数起,每个数都是前两数之和,这个数列则称为“斐波纳契数列”,其中每个数字都是“斐波纳契数”。
斐波纳契数列还暗含着许多有趣的数字规律,如从第3个数开始每隔两个必是2的倍数,从第4个数开始每隔3个必是3的倍数,从第5个数开始每隔4个必是5的倍数……另外,这个数列最具有和谐之美的地方是,越往后,相邻两项的比值会无限趋向于黄金比0.61803……即[5^(1/2)-1]/2。
菲波那契数列指的是这样一个数列:1,1,2,3,5,8,13,21……
这个数列从第三项开始,每一项都等于前两项之和。它的通项公式为:(1/√5)*{[(1+√5)/2]^n - [(1-√5)/2]^n}【√5表示根号5】
很有趣的是:这样一个完全是自然数的数列,通项公式居然是用无理数来表达的。
看起来可能有点高深,理解一下就行了。
我先说一下,这个螺旋周期预测也不是100% 期望任何一种预测方法有100%准确率都是不实际的。只能通过不断的实践,检验,再实践的循环提高预测水平。这里拿两个例子探讨一下。大部分人都套在不会卖出,下面的两个例子都是测头部。大部分头部都是双头形态,日线倒V形的在60分钟线也会露出双头形态。标准是M头,其它有三重头,或演变为头肩顶。头部形态在日K线表现出来的特征除了大家知道长阳、长阴、大成交量、跳空缺口、众人一致看好外,还要留意阶段性头部的锤头K线(实体较少,上下影线较长)。凡事预则立,有了上述认识,配合螺旋周期或其它时间序列,什么时候该走,至少心中有数吧。从这一两年来看,预测大市和个股重要的顶部能控制在正负一天以内。如何控制法,就是如何选起始点的问题。个股内在运行时间规律不同,造成阶段性高低点日期不同。还是说说600799和550511两只股票头部的预测吧。600799阿城钢铁有两个起始点指向2月6日,由于该股1月29日见大阴线和大量。转折日在2月6日,周六,不交易,即周五。尾市看日K线锤头形,60分钟双头形态------卖出。再看550511沈阳农信2月1日是转折日,该股1月27日有大阴线、大量。2月1日中阳线,看不出双头影子,但2月2日跟着一根中阴线,再看60分钟双头形态------卖出。
螺旋历法在运用上有一个巧妙之处,多个起始点指向某一天的话,那天特别重要。象600651小飞12月31日低点就有三个起始点指向当天。后来涨了30%,同样巧的是,1月29日的中阴线也有两个转折日指向当天。这个用法会做在下一个程序里头,3.00版已实现。
武术的最高境界是无招胜有招。预测0011深物业的头部就没有找历史性低点,而把它涨停前一天做起始点。结果,12月25日,1月6日两个头部一天不差。
熟能生巧,螺旋历法也一样,研究越多,心中越有数。
PS:股市没有专家,要时刻想着自己的弱点,不断战胜自我。功夫在盘外,我觉得讨论是很好的方法,三人行必有我师焉。