飞狐公式怎么用 飞狐江恩时间指标公式
DRAWGBK(1,COLORRGB(44,22,108),COLORRGB(33,0,0),0),color10000;
STICKLINE(OPEN>=CLOSE,CLOSE,OPEN,7,1),colorFFFF50;
STICKLINE(OPEN>=CLOSE,HIGH,OPEN,0,0),colorFFFF50;
STICKLINE(OPEN>=CLOSE,CLOSE,LOW,0,0),colorFFFF50;
STICKLINE(CLOSE>=OPEN,CLOSE,OPEN,7,1),color5050FF;
STICKLINE(CLOSE>=OPEN,CLOSE,HIGH,0,0),color5050FF;
STICKLINE(CLOSE>=OPEN,LOW,OPEN,0,0),color5050FF;
var4:=((hhv(high,9) - close)/(hhv(high,9) - llv(low,9)))*(100) - 70;
var5:=((close - llv(low,60))/(hhv(high,60) - llv(low,60)))*(100);
var7:=sma(((close - llv(low,9))/(hhv(high,9) - llv(low,9)))*(100),3,1);
var8:=llv(low,34);
varc:=ema(((((2)*(close) + high + low)/(4) - var8)/(hhv(high,34) - var8))*(100),8);
vard:=ema(varc,5);
vare:=((hhv(high,9) - close)/(hhv(high,9) - llv(low,9)))*(100) - 70;
var11:=sma(((close - llv(low,9))/(hhv(high,9) - llv(low,9)))*(100),3,1);
var12:=sma(var11,3,1) + 100;
var13:=var12 - sma(vare,9,1) + 100;
var14:=zig(3,13);
建仓:=if((varc > 17) and (varc < 59) and (varc - vard >= 0),10,(-10));
猎豹:=if((ref(var14,2) > ref(var14,1)) and (var14 > ref(var14,1)),10,45);
丰收:=if((varc > 70) and (varc - vard >= 0),77,82);
牛:=if((var13 > 100),var13 - 100,0);
顶:=if((ref(var14,2) < ref(var14,1)) and (var14 < ref(var14,1)),95,55);
风:=if((varc - vard > 0),varc,vard);
stickline((ref(var14,2) < ref(var14,1)) and (var14 < ref(var14,1)),close,open,5,0),color66ff00;
stickline((ref(var14,2) > ref(var14,1)) and (var14 > ref(var14,1)),close,open,5,0),coloryellow;
drawline((ref(var14,2) > ref(var14,1)) and (var14 > ref(var14,1)),low - (low)*(0.08),(ref(var14,2) < ref(var14,1)) and (var14 < ref(var14,1)),low - (low)*(0.05),0),linethick5,color070084;
drawline((ref(var14,2) > ref(var14,1)) and (var14 > ref(var14,1)),low - (low)*(0.08),(ref(var14,2) < ref(var14,1)) and (var14 < ref(var14,1)),low - (low)*(0.05),0),linethick4,color0000a3;
drawline((ref(var14,2) > ref(var14,1)) and (var14 > ref(var14,1)),low - (low)*(0.08),(ref(var14,2) < ref(var14,1)) and (var14 < ref(var14,1)),low - (low)*(0.05),0),linethick3,color0000b7;
drawline((ref(var14,2) > ref(var14,1)) and (var14 > ref(var14,1)),low - (low)*(0.08),(ref(var14,2) < ref(var14,1)) and (var14 < ref(var14,1)),low - (low)*(0.05),0),linethick2,color0000cd;
drawline((ref(var14,2) > ref(var14,1)) and (var14 > ref(var14,1)),low - (low)*(0.08),(ref(var14,2) < ref(var14,1)) and (var14 < ref(var14,1)),low - (low)*(0.05),0),linethick1,color077bf3;
stickline((open >= close),close,open,5,0),colorff5b00;
stickline((open >= close),close,open,4.5,0),colorff6c00;
stickline((open >= close),close,open,4,0),colorff7b00;
stickline((open >= close),close,open,3.5,0),colorff9c00;
stickline((open >= close),close,open,2,0),colorffbe00;
stickline((open >= close),close,open,1,0),colorffcc00;
stickline((open >= close),close,open,0.5,0),colorcccccc;
stickline((close >= open),close,open,5,0),color070084;
stickline((close >= open),close,open,4.5,0),color0000a3;
stickline((close >= open),close,open,4,0),color0000b7;
stickline((close >= open),close,open,3.5,0),color0000cd;
stickline((close >= open),close,open,2,0),color0000e9;
stickline((close >= open),close,open,1,0),color0754e9;
stickline((close >= open),close,open,1,0),color076ef3;
stickline((close >= open),close,open,0.5,0),color077bf3;
stickline((close > open),open,low,0.5,0),color0726ca;
stickline((close > open),close,high,0.5,0),color0726ca;
stickline((open > close),close,low,0.5,0),colorde9100;
stickline((open > close),open,high,0.5,0),colorde9100;
买:drawtext((ref(var14,2) > ref(var14,1)) and (var14 > ref(var14,1)),low - (low)*(0.05),'买'),colorred;
卖:drawtext((ref(var14,2) < ref(var14,1)) and (var14 < ref(var14,1)),low - (low)*(0.03),'卖'),color66ff00;
stickline((ref(var14,2) < ref(var14,1)) and (var14 < ref(var14,1)),close,open,5,0),color66ff00;
stickline((ref(var14,2) > ref(var14,1)) and (var14 > ref(var14,1)),close,open,5,0),coloryellow;
X:=BARSLAST(SYSPARAM(2)=BARPOS)+1;
NS:=IF(HHV(ABS(HHV(CLOSE,6)/LLV(CLOSE,6)-1),6)>10/100,3,6);
N1:=IF(DATATYPE=2,NS*48,IF(DATATYPE=3,NS*16,IF(DATATYPE=4,NS*8,IF(DATATYPE=5,NS*4,NS))));
MM:=IF(STKTYPE=0 OR VOL=0,MA(CLOSE,N1),SUM(AMOUNT,N1)/SUM(VOL,N1)/100);
M1:=REF(MM,1);
买入:=IF(CROSS(CLOSE,M1),M1,0);
卖出:=IF(CROSS(M1,CLOSE),M1,0);
YE:=BARPOS;
费用:=5/1000;
DW:=BARSLAST(卖出>0);
EX10:=HHV(买入>0,DW+1);
BJ:=IF(EX10>REF(EX10,1),买入,0);
SJ:=IF(EX10<REF(EX10,1),卖出,0);
BNN:=BARSLAST(BJ>0);
CC:=REF(BJ,BNN);
盈利:=SJ*(1-费用)-CC*(1+费用);
YL:=SUM(IF(SJ>0,盈利,0),0);
每股盈利:YL,LINETHICK0,PRECISION2,colorFFFFFF;
CN:=SUM(IF(SJ>0 AND REF(CC,1)>0,1,0),0);
CG:=SUM(IF(SJ>0 AND 盈利>0,1,0),0);
成功率:100*CG/CN,LINETHICK0,PRECISION1,color88FF;
H1:=HHV(YL,X);
L1:=LLV(YL,X);
AH:=H1[DATACOUNT];
AL:=L1[DATACOUNT];
AHL:=AH-AL;
买入均价:SUM(BJ,0)/CN,LINETHICK0,PRECISION1,colorFF;
年收益:100*240*YL/YE/买入,LINETHICK0,PRECISION1,colorFF;
持股时间:(SUM(IF(SJ>0 AND CC>0,REF(BNN,1)+1,0),0))/(YE),LINETHICK0,PRECISION2,colorFF00FF;
交易:CN,LINETHICK0,PRECISION0,colorAAAAAA;
(次)成功:CG,LINETHICK0,PRECISION0,colorAAAAAA;
年交均次:=240*CN/YE;
MON:=SUM(IF(MONTH<>REF(MONTH,1),1,0),0);
上市年:=MON/12;
DRAWNUMBER(BJ>0,LOW*0.97,BJ,2),ALIGN0,colorFF;
DRAWICON(BJ>0 ,LOW*0.99,4);
DRAWTEXT(BJ>0,LOW*0.95,'★\n 买入'),ALIGN0,colorFFFF;
STICKLINE(BJ>0 ,MM,MM+0.04,16,1),ALIGN0,colorFFFF;
STICKLINE(BJ>0 ,CLOSE,OPEN,4,0),ALIGN0,colorFFFF;
DRAWNUMBER(SJ>0 AND 盈利/(CC*(1+费用))*100>=0,HIGH*1.07,盈利/(CC*(1+费用))*100,1),ALIGN0,colorFF;
DRAWNUMBER(SJ>0 AND 盈利/(CC*(1+费用))*100<0,HIGH*1.07,盈利/(CC*(1+费用))*100,1),ALIGN0,colorFFFF;
DRAWICON(SJ>0 ,HIGH*1.025,5);
STICKLINE(SJ>0 ,SJ,SJ+0.04,16,1),ALIGN0,colorFF;
DRAWNUMBER(SJ>0 ,HIGH*1.05,SJ,2),ALIGN0,colorFF00;
N波动:(SUM(IF(SJ>0 AND CC>0 AND REF(BNN,1)+1<=10,REF(BNN,1)+1,0),0))/(YE),LINETHICK0,colorFF00FF;
买价:IF(BJ>0,BJ,0),LINETHICK0,PRECISION2,colorFF;
卖价:IF(SJ>0,SJ,0),LINETHICK0,PRECISION2,colorFF00;
DRAWTEXTEX(CLOSE,1,0,0,'年盈利:'+NUMTOSTR(YL,2)+'元 成功率:'+NUMTOSTR(成功率,1)+'% 年收益:'+NUMTOSTR(年收益,1)+'%'+' 持股时间比:'+NUMTOSTR(持股时间,1)+'\n'+'交易:'+NUMTOSTR(交易,0)+'次 成功:'+NUMTOSTR(CG,0)+'次 年均:'+NUMTOSTR(年交均次,1)+'次 总共:'+NUMTOSTR(YE,0)+'K线'),colorEE5555;
临界:=(CLOSE/M1-1)*100;
增减:=临界-100*(REF(CLOSE,1)/REF(M1,1)-1);
DRAWTEXTEX(CLOSE,1,480,0,'当前 信号持续:'+NUMTOSTR(BNN,0)+'(K线)'+' 最高盈利:'+NUMTOSTR(HHV((HIGH/CC-1)*100,BNN+1),1)+'% 买卖临界点:'+NUMTOSTR(临界,1)+'% 增减:'+NUMTOSTR(IF(BNN>0 AND DATATYPE=6,增减,IF(BNN=0,0,-100)),1)),colorEE5599;
DRAWTEXT(SYSPARAM(3)=BARPOS ,HIGH,'.'),color1;
DRAWTEXT(SYSPARAM(3)=BARPOS ,LOW,'.'),color1;
参考介入价:MM,LINETHICK0,PRECISION2,colorFFFFFF;
FUA:=HHV(HIGH,15);
FUB:=LLV(LOW,15);
DRAWTEXTEX(CLOSE,1,620,60,'15日最高价:'+NUMTOSTR(FUA,2)+' '),ALIGN2,colorFF;
DRAWTEXTEX(CLOSE,1,780,60,'15日最低价:'+NUMTOSTR(FUB,2)+' '),ALIGN2,colorFF;
DRAWTEXTEX(CLOSE,1,950,60,'参考介入价:'+NUMTOSTR(MM,2)+' '),ALIGN2,colorEE9999;
VAR2:=(CLOSE+HIGH+LOW)/3;
VAR33:=EMA(VAR2,10);
VAR44:=REF(VAR33,1);
FILLRGN(VAR33>VAR44,VAR33,VAR44),colorFF;
FILLRGN(VAR33<VAR44,VAR44,VAR33),colorFF0000;
{<江恩第九条的时间>公式) X1835}
{☆§提示:1首先十分感谢做多2008朋友的支持,在他的建议下,我修改老公式为学习了江恩第九条知识的同学所使用,
江恩买卖十二法则第九条 当出现高低或新高时买入
(1) 当市价开创新高,表示市势向上,可以追市买入。 (2) 当市价下破新底,表示市势向下,可以追沽。
时间的因素 (1) 由从前顶部到底部的时间; (2) 由从前底部到底部的时间;
(3) 由重要顶部到重要底部时间; (4) 由重要底部到重要顶部的时间。
2只是粗略画图,计算机画线不能代替手工作图。
3确定历史数据完整。}
{☆§说明: 1左上方显示波段所在时间段的周期数字。参数"顶对底开关”是需要在0和1之间经常调整的,实现从顶底时间到时底对底顶对顶时间的转换。多尝试调调参数,别怕弄出问题大不了就删掉公式重新导入。
2'江九条'中江恩特别要注意的是4点,但我希望能有更多选择,所以公式可以调节底对底 顶对顶 顶对底 底对顶 指定时间的顶底对光标的底或顶,谁知道哪个就管用了呢。
3使用指定时间的时候,公式必须由使用者打出十字光标后,找到需要的那根K线,左上方显示有K线对应的日期参数,填写参数到参数名称时'指定位置'后才能使用,
4预设了1倍和2倍的,不可更改。另留有有4个自定义的数字,可以填写时间段乘以的倍数(可以带小数点的,但是在图里显示时候,考虑地方小就显示保留了2位小数,
但在最初计算时间倍数时使用的是填写的完整参数,比如填写1.618时,显示时是1.62倍,但计算还是用1.618算后取整的。)
自定义1和自定义2,目前预设时为0,由使用者自己写入所需的比例数值。自定义3和4被我填上了数值3和4,也可由使用者自行更改。}
input:p(10,1,30),顶对底开关(0,0,1),参a(2,1,111),参b(1,1,111),参c(1,1,111),A偏移(0),B偏移(0),C偏移(0),指定时间(0,0,1381231),参自定义1(0),参自定义2(0),参自定义3(3),参自定义4(4);
x1:=TROUGH(4,p,1);//BARPOS
x8:=TROUGHBARS(4,p,1)=0;
x11:=TROUGHBARS(4,p,参a);
x18:=TROUGHBARS(4,p,参b);
x13:=TROUGHBARS(4,p,参c);
x3:=PEAK(4,p,1);
x31:=PEAKBARS(4,p,参a);
x38:=PEAKBARS(4,p,参b);
x33:=PEAKBARS(4,p,参c);
x5:=PEAKBARS(4,p,1)=0;
指定位置:hhv(if(指定时间>0 and date=指定时间,BARPOS,0),0),linethick0;
光标位置:=SYSPARAM(1),linethick0;
{ldis:=if(BARPOS=SYSPARAM(1),x18,0),linethick0;
hdis:=if(BARPOS=SYSPARAM(1),x38,0),linethick0;}
cldis:=x13[SYSPARAM(1)],linethick0;
chdis:=x33[SYSPARAM(1)],linethick0;
tcl:=光标位置-cldis,linethick0;
tch:=光标位置-chdis,linethick0;
bldis:=x18[SYSPARAM(1)],linethick0;
bhdis:=x38[SYSPARAM(1)],linethick0;
tbl:=光标位置-bldis,linethick0;
tbh:=光标位置-bhdis,linethick0;
aldis:=x11[SYSPARAM(1)],linethick0;
ahdis:=x31[SYSPARAM(1)],linethick0;
tal:=光标位置-aldis,linethick0;
tah:=光标位置-ahdis,linethick0;
Ka:=IF(tcl>tch,tal+A偏移,tah+A偏移),linethick0;
Kb:=IF(tcl>tch,tbh+B偏移,tbl+B偏移),linethick0;
Kc:=IF(tcl>tch,tcl+C偏移,tch+C偏移),linethick0;
PH:=H;
PL:=L;
{说:=Ka;
话:=Kb;
啊:=Kc;}
Pa:=IF(tcl>tch,PL[tal+A偏移],PH[tah+A偏移]),LINETHICK0;
Pb:=IF(tcl>tch,PH[tbh+B偏移],PL[tbl+B偏移]),LINETHICK0;
Pc:=IF(tcl>tch,PL[tcl+C偏移],PH[tch+C偏移]),LINETHICK0;
y:=year;m:=month;d:=day;
光标时间:=hhv(if(barpos=SYSPARAM(1),date,0),0),linethick0;
DRAWTEXTEX(指定时间=0,1,5,5,'光标时间是 '+numtostr(y[SYSPARAM(1)],0)+STRRIGHT(numtostr(光标时间,0),4)+' 换算 '+numtostr(光标时间,0)),color77FFFF;
DRAWTEXTEX(指定时间>0,1,5,5,'指定时间是 '+numtostr(指定时间,0)),color77FFFF;
{☆§-------------------------------------§☆}
if 顶对底开关=0 then begin {底对底或顶对顶}
drawline(指定时间=0 and barpos=Ka,Pa,barpos=Kb,Pb,0),color77FFFF,linethick1;
drawline(barpos=Kb,Pb,barpos=Kc,Pc,0),color77FFFF,linethick1;
drawline(指定时间>0 and barpos=指定位置,zig(4,p),barpos=Kb,Pb,0),color77FFFF,linethick1;
drawline(barpos=Ka,Pa,barpos=Kc,Pc,0),colorffaa99,linethick1;
tac:if(指定时间>0,Kc-指定位置,Kc-Ka),linethick0;
DRAWTEXTEX(1,1,5,50,'初始时间段有 '+numtostr(tac,0)+' 个周期'),color77FFFF;
VERTLINE(指定时间=0 and barpos=Ka),colorffaa99,LINEDOT;
VERTLINE(指定时间>0 and barpos=指定位置),colorffaa99,LINEDOT;
VERTLINE(barpos=Kc),colorffaa99,LINEDOT;
VERTLINE(barpos=Kc+tac*1),colorred,LINEDOT;
drawtext(barpos=Kc+tac*1,Pc,'1'),color77FFFF;
VERTLINE(barpos=Kc+tac*2),colorred,LINEDOT;
drawtext(barpos=Kc+tac*2,Pc,'2'),color77FFFF;
if 参自定义1>0then {call}
begin
VERTLINE(barpos=Kc+INTPART(tac*参自定义1)),colorred,LINEDOT;
drawtext(barpos=Kc+INTPART(tac*参自定义1),Pc,NUMTOSTR(参自定义1,2)),color77FFFF;
end; {retn}
if 参自定义2>0 then {call}
begin
VERTLINE(barpos=Kc+INTPART(tac*参自定义2)),colorred,LINEDOT;
drawtext(barpos=Kc+INTPART(tac*参自定义2),Pc,NUMTOSTR(参自定义2,2)),color77FFFF;
end; {retn}
if 参自定义3>0 then {call}
begin
VERTLINE(barpos=Kc+INTPART(tac*参自定义3)),colorred,LINEDOT;
drawtext(barpos=Kc+INTPART(tac*参自定义3),Pc,NUMTOSTR(参自定义3,2)),color77FFFF;
end; {retn}
if 参自定义4>0 then {call}
begin
VERTLINE(barpos=Kc+INTPART(tac*参自定义4)),colorred,LINEDOT;
drawtext(barpos=Kc+INTPART(tac*参自定义4),Pc,NUMTOSTR(参自定义4,2)),color77FFFF;
end; {retn}
end;
{☆§-------------------------------------§☆}
if 顶对底开关>0 then begin {顶对底或底对顶}
drawline(指定时间=0 and barpos=Kb,Pb,barpos=Kc,Pc,0),color77FFFF,linethick1;
drawline(指定时间>0 and barpos=指定位置,zig(4,p),barpos=Kc,Pc,0),color77FFFF,linethick1;
//xx:=x;
//SETLBOUND(xx,k看);
{{小花园}---------------------说话啊-------------------}
tbc:if(指定时间>0,Kc-指定位置,Kc-Kb),linethick0;
DRAWTEXTEX(1,1,5,50,'初始时间段有 '+numtostr(tbc,0)+' 个周期'),color00aaFF;
VERTLINE(指定时间=0 and barpos=Kb),colorffaa99,LINEDOT;
VERTLINE(指定时间>0 and barpos=指定位置),colorffaa99,LINEDOT;
VERTLINE(barpos=Kc),colorffaa99,LINEDOT;
VERTLINE(barpos=Kc+tbc*1),colorred,LINEDOT;
drawtext(barpos=Kc+tbc*1,Pc,'1'),color00aaFF;
VERTLINE(barpos=Kc+tbc*2),colorred,LINEDOT;
drawtext(barpos=Kc+tbc*2,Pc,'2'),color00aaFF;
{☆§-------------------------------------§☆}
if 参自定义1>0then {call}
begin
VERTLINE(barpos=Kc+INTPART(tbc*参自定义1)),colorred,LINEDOT;
drawtext(barpos=Kc+INTPART(tbc*参自定义1),Pc,NUMTOSTR(参自定义1,2)),color00aaFF;
end; {retn}
if 参自定义2>0 then {call}
begin
VERTLINE(barpos=Kc+INTPART(tbc*参自定义2)),colorred,LINEDOT;
drawtext(barpos=Kc+INTPART(tbc*参自定义2),Pc,NUMTOSTR(参自定义2,2)),color00aaFF;
end; {retn}
if 参自定义3>0 then {call}
begin
VERTLINE(barpos=Kc+INTPART(tbc*参自定义3)),colorred,LINEDOT;
drawtext(barpos=Kc+INTPART(tbc*参自定义3),Pc,NUMTOSTR(参自定义3,2)),color00aaFF;
end; {retn}
if 参自定义4>0 then {call}
begin
VERTLINE(barpos=Kc+INTPART(tbc*参自定义4)),colorred,LINEDOT;
drawtext(barpos=Kc+INTPART(tbc*参自定义4),Pc,NUMTOSTR(参自定义4,2)),color00aaFF;
end; {retn}
end;
{-------------------------------------}
{觉得k线被线阻挡,就重新画k线}
KLINE(O,H,L,C,0);
{§未来多美好 公式组§}
{题外话 一直以来,在和周围股友交流中有种感觉,不知道各位是否也有同感,那就是学习
经典理论知识分析的人看不起只会用公式的,而用公式的人又觉得传统分析已经跟不上时代了。
我觉得这种误会源于缺乏沟通,假如传统分析者要是了解到用公式可以更加方便的“一把尺量天下”
,只用公式的人要是清楚求新求变的公式内核算法都是由传统技术演变而来,然后互相重视起来,就好了。
希望我做的公式能给使用者带来一点方便。}
M1:EMA(CLOSE,3),LINETHICK1,COLORFF;
PARTLINE(M1<REF(M1,1),M1),LINETHICK1,COLORFF00;
M2:EMA(CLOSE,5),LINETHICK2,COLORFF;
PARTLINE(M2<REF(M2,1),M2),LINETHICK2,COLORFF00;
M3:EMA(CLOSE,8),LINETHICK2,COLORFF;
PARTLINE(M3<REF(M3,1),M3),LINETHICK2,COLORFF00;
界:MA(CLOSE,8),POINTDOT,LINETHICK1,COLORFF;
PARTLINE(界<REF(界,1),界),POINTDOT,LINETHICK1,COLORFF0000;
买线:=EMA(CLOSE,3);
卖线:=EMA(SLOPE(CLOSE,8)*13+CLOSE,21);
BU:=CROSS(买线,卖线);
SEL:=CROSS(卖线,买线);
DRAWTEXT(BU,LOW,'买'),ALIGN0,PXDN30,COLORFF;
DRAWTEXT(SEL,HIGH,'卖'),ALIGN0,PXUP30,COLORFF00;
STICKLINE(CROSS(买线,卖线) OR CROSS(卖线,买线),OPEN,CLOSE,6,0),COLORFFFF00;
M4:EMA(SLOPE(CLOSE,13)*21+CLOSE,44),LINETHICK1,COLORFF00FF;
PARTLINE(M4<REF(M4,1),M4),LINETHICK1,COLORFF0000;