940.問(wèn):
求所有K線的收盤(pán)價(jià)總數(shù)是 sum(Close,0);
如果要得到符合某一個(gè)條件的K線收盤(pán)總和,要如何表示?
例如符合 C>MA(C,60) 的K線收盤(pán)總和
答(hx817):
sum(if(c>ma(c,60),c,0),0);
941.問(wèn):
(1)今日k線在N天位置排序值,即收盤(pán),開(kāi)盤(pán)價(jià)在n天的排序值 如今天收盤(pán)價(jià)在10天內(nèi)收盤(pán)價(jià)由高至低排序?yàn)榈?,收盤(pán)價(jià)排序=2,如何飛弧函數(shù)表示;
(2)30日次高點(diǎn),第3高點(diǎn)的值和位置(距今日的天數(shù))如何飛弧函數(shù)表示.
答(peter109):
HH: =H;
A: =MA(C,5);
B: =MA(C,10);
CC: =MA(C,20);
D: =MA(C,30);
要求做下降排序
這是我照做的做法
可是當(dāng)中有一個(gè)值(D) 始終為零
哪位可以幫我看一下並修正嗎
HH: =H;
A: =MA(C,5);
B: =MA(C,10);
CC: =MA(C,20);
D: =MA(C,30);
VARIABLE:SLN[5]=0, SLNPOS[5]=0, SS[5]='';
ss[1]:='HH:'; ss[2]:='A:'; ss[3]:='B:'; ss[4]:='CC:'; ss[5]:='D:';
for n=LBOUND(HH) to ubound(HH) do begin
SLN[1]:=HH[n]; LBNO:=1;
if n>=LBOUND(A) then begin
SLN[2]:=A[n]; LBNO:=LBNO+1;
end;
else SLN[2]:=0;
if n>=LBOUND(B) then begin
SLN[3]:=B[n]; LBNO:=LBNO+1;
end;
else SLN[3]:=0;
if n>=LBOUND(CC) then begin
SLN[4]:=CC[n]; LBNO:=LBNO+1;
end;
else SLN[4]:=0;
if n>=LBOUND(D) then begin
SLN[5]:=D[n]; LBNO:=LBNO+1;
end;
else SLN[5]:=0;
for i = 1 to 5 do begin
SLNPOS[i]:=SLN[i];
end;
tmp:=SORT(SLN,1,1,LBNO);
tmp:=SORTPOS(SLNPOS,1,1,LBNO);
EXPN1[n]:=SLN[1]; EXPS1[n]:=SLNPOS[1];
EXPN2[n]:=SLN[2]; EXPS2[n]:=SLNPOS[2];
EXPN3[n]:=SLN[3]; EXPS3[n]:=SLNPOS[3];
EXPN4[n]:=SLN[4]; EXPS4[n]:=SLNPOS[4];
EXPN5[n]:=SLN[5]; EXPS5[n]:=SLNPOS[5];
end;
EXPLAINEX(EXPS1=1,ss[1],EXPN1,2,0),ColorGreen;
EXPLAINEX(EXPS1=2,ss[2],EXPN1,2,0),ColorGreen;
EXPLAINEX(EXPS1=3,ss[3],EXPN1,2,0),ColorGreen;
EXPLAINEX(EXPS1=4,ss[4],EXPN1,2,0),ColorGreen;
EXPLAINEX(EXPS1=5,ss[5],EXPN1,2,0),ColorGreen;
EXPLAINEX(EXPS2=1,ss[1],EXPN2,2,0),ColorGreen;
EXPLAINEX(EXPS2=2,ss[2],EXPN2,2,0),ColorGreen;
EXPLAINEX(EXPS2=3,ss[3],EXPN2,2,0),ColorGreen;
EXPLAINEX(EXPS2=4,ss[4],EXPN2,2,0),ColorGreen;
EXPLAINEX(EXPS2=5,ss[5],EXPN2,2,0),ColorGreen;
EXPLAINEX(EXPS3=1,ss[1],EXPN3,2,0),ColorGreen;
EXPLAINEX(EXPS3=2,ss[2],EXPN3,2,0),ColorGreen;
EXPLAINEX(EXPS3=3,ss[3],EXPN3,2,0),ColorGreen;
EXPLAINEX(EXPS3=4,ss[4],EXPN3,2,0),ColorGreen;
EXPLAINEX(EXPS3=5,ss[5],EXPN3,2,0),ColorGreen;
EXPLAINEX(EXPS4=1,ss[1],EXPN4,2,0),ColorGreen;
EXPLAINEX(EXPS4=2,ss[2],EXPN4,2,0),ColorGreen;
EXPLAINEX(EXPS4=3,ss[3],EXPN4,2,0),ColorGreen;
EXPLAINEX(EXPS4=4,ss[4],EXPN4,2,0),ColorGreen;
EXPLAINEX(EXPS4=5,ss[5],EXPN4,2,0),ColorGreen;
EXPLAINEX(EXPS5=1,ss[1],EXPN5,2,0),ColorGreen;
EXPLAINEX(EXPS5=2,ss[2],EXPN5,2,0),ColorGreen;
EXPLAINEX(EXPS5=3,ss[3],EXPN5,2,0),ColorGreen;
EXPLAINEX(EXPS5=4,ss[4],EXPN5,2,0),ColorGreen;
EXPLAINEX(EXPS5=5,ss[5],EXPN5,2,0),ColorGreen;
942.問(wèn):
假如變量是var,現(xiàn)在要輸出這個(gè)var
var;
運(yùn)行第:var;
天
實(shí)際要顯示出:運(yùn)行第45天,但是這個(gè)天字如何出來(lái)?
因?yàn)橐话悴荒軉为?dú)對(duì)常量進(jìn)行輸出的。
假如變量var值為30
我想這樣輸出
var1:=ma(c,3);
var2:=SELFSTRING('天');
var:=var1+var2;
第:var;
輸出結(jié)果是第30天
我關(guān)鍵是想輸出var,“天”這個(gè)字符串并連接在一起
答(cwy):
變通辦法,不知可否,例如:
運(yùn)行第:=BARPOS;
sz:='運(yùn)行第(天):'+NUMTOSTR(運(yùn)行第[SYSPARAM(1)],2);
DRAWTEXT(BARPOS=SYSPARAM(2),c,sz)align4;
問(wèn):
你的還是數(shù)字后面沒(méi)有文字
答(股市騎兵00):
變通改下
運(yùn)行第:=BARPOS;
sz:='MA1:'+NUMTOSTR(運(yùn)行第[SYSPARAM(1)],2)+'天';
DRAWTEXT(BARPOS=SYSPARAM(2),c,sz)align4
(注: joneslee寫(xiě)了一個(gè)更好的辦法,上市第:var4,LINETHICK0;年 :PARTLINE(0,0); )
943.問(wèn):
M1:= C>REF(C,1) AND REF(C,1)<REF(C,2); //漲跌=1 今日漲昨日跌
M2:= C<REF(C,1) AND REF(C,1)>REF(C,2); //跌漲=2 今日跌昨日漲
M3:= C>REF(C,1) AND REF(C,1)>REF(C,2); //漲漲=3 今日漲昨日漲
M4:= C<REF(C,1) AND REF(C,1)<REF(C,2); //跌跌=4 今日跌昨日跌
漲跌標(biāo)記:M1*1+M2*2 +M3*3 +M4*4,linethick0;
drawnumber(1,漲跌標(biāo)記,漲跌標(biāo)記,0),align5;
我需要在N周期內(nèi) 出現(xiàn)1 / 2 / 3 / 4 四個(gè)數(shù)值都有的時(shí)候 做個(gè)標(biāo)記
答(bajatje):
M1:= C>REF(C,1) AND REF(C,1)<REF(C,2); //漲跌=1 今日漲昨日跌
M2:= C<REF(C,1) AND REF(C,1)>REF(C,2); //跌漲=2 今日跌昨日漲
M3:= C>REF(C,1) AND REF(C,1)>REF(C,2); //漲漲=3 今日漲昨日漲
M4:= C<REF(C,1) AND REF(C,1)<REF(C,2); //跌跌=4 今日跌昨日跌
a:=any(m1,n) and any(m2,n) and any(m3,n) and any(m4,n);
漲跌標(biāo)記:M1*1+M2*2 +M3*3 +M4*4,linethick0;
drawnumber(1,漲跌標(biāo)記,漲跌標(biāo)記,0),align5;
DRAWICON(a,LOW,4)
問(wèn):
或許沒(méi)說(shuō)清楚
要標(biāo)記的位置點(diǎn)是A區(qū)和B區(qū)分隔線的地方
C區(qū)和B區(qū)分隔線
答(bajatje):
DRAWICON(a and 區(qū)域劃分條件,LOW,4)
答(peter109):
//作業(yè)要求
DRAWTEXT(barpos=sysparam(2),1.8,'漲,跌=1');
DRAWTEXT(barpos=sysparam(2),1.6,'跌,漲=2');
DRAWTEXT(barpos=sysparam(2),1.4,'漲,漲=3');
DRAWTEXT(barpos=sysparam(2),1.2,'跌,跌=4');
DRAWTEXT(barpos=sysparam(2),1.1,'平=前一');
INPUT:N(7);
varA:=C>ref(C,1);
varB:=REF(varA,1);
AA:=IF(varA=0 AND varB=1,2,IF(varA=1 AND varB=0,1,IF(varA=1 AND varB=1,3,IF(varA=0 AND varB=0,4,0)))),LINETHICK0;
FH:=IF(C=ref(C,1),ref(AA,1),AA),LINETHICK0;
XX:=COUNT(FH=1,N)>0 AND COUNT(FH=2,N)>0 AND COUNT(FH=3,N)>0 AND COUNT(FH=4,N)=1,linethick;//條件判定 N區(qū)間內(nèi) 包含1 2 3 4的數(shù)值
XX1:=FILTER(XX,3);
Y:=MOD(count(FH,0),2);
//分天地兩列
drawnumber(Y=0,3,FH,0);//天
drawnumber(Y>0,2,FH,0);//地
//判定結(jié)果
DRAWTEXT(XX1 AND FH=1,2.5,'1'),COLORCYAN;
DRAWTEXT(XX1 AND FH=2,2.5,'2'),COLORYELLOW;
DRAWTEXT(XX1 AND FH=3,2.5,'3'),COLORRED;
DRAWTEXT(XX1 AND FH=4,2.5,'4'),COLORGREEN;
1,COLORBLACK;
944.問(wèn):
修改公式:加上條件kd金叉如超過(guò)5天不指示的寫(xiě)法?
cci:="cci"(14);
a:=ref(c,1);
rsi:=sma(max(c-a,0),6,1)/sma(abs(c-a),6,1)*100;
a1:=c-ma(c,5)/ma(c,5)*100<1;
a2:=c-ma(c,13)/ma(c,13)*100<-10;
a3:=c-ma(c,34)/ma(c,34)*100<-15;
a4:=rsi<18;
a5:=cci<-120;
a6:=EMA(IF(L<= LLV(l,99),SMA(ABS(L-REF(L,1)),99,1)/SMA(MAX(L-REF(l,1),0),99,1),0),3);
超跌:(a1 and a2 and a3 and a4 and a5 and a6>0 *85),COLORRED,LINETHICK2 ;
k:="kdj.k#day";
d:="kdj.d#day";
j:="kdj.j#day";
金叉1:cross(BARSLAST(cross(超跌,0.5)),BARSLAST(cross(k,d)));
答(cwy):
cci:="cci"(14);
a:=ref(c,1);
rsi:=sma(max(c-a,0),6,1)/sma(abs(c-a),6,1)*100;
a1:=c-ma(c,5)/ma(c,5)*100<1;
a2:=c-ma(c,13)/ma(c,13)*100<-10;
a3:=c-ma(c,34)/ma(c,34)*100<-15;
a4:=rsi<18;
a5:=cci<-120;
a6:=EMA(IF(L<= LLV(l,99),SMA(ABS(L-REF(L,1)),99,1)/SMA(MAX(L-REF(l,1),0),99,1),0),3);
超跌:(a1 and a2 and a3 and a4 and a5 and a6>0 *85),COLORRED,LINETHICK2 ;
k:="kdj.k#day";
d:="kdj.d#day";
j:="kdj.j#day";
金叉1:cross(BARSLAST(cross(超跌,0.5)),BARSLAST(cross(k,d))) and BARSLAST(cross(超跌,0.5))<6;
945.問(wèn):
如何才能再一條語(yǔ)句里輸出:A年B月C日,ABC都是字符變量.
答(bajatje):
y:=YEAR;
m:=MONTH;
d:=DAY;
p:=SYSPARAM(1);
U:=NUMTOSTR(y[p],0)+'年'+NUMTOSTR(m[p],0)+'月'+NUMTOSTR(d[p],0)+'日';
DRAWTEXT(ISLASTBAR,H,u)ALIGN2;
EXPLAIN(1,u);
946.問(wèn):
100日內(nèi)上升區(qū)域和下跌區(qū)域所對(duì)應(yīng)的換手率
1. 100日內(nèi)上升區(qū)域換手率。
2. 100日內(nèi)下跌區(qū)域換手率。
公式意思是這樣如:100日內(nèi)有30天屬于上升區(qū)域,70天屬于下跌區(qū)域,分別寫(xiě)出100日
上升區(qū)域和下跌區(qū)域所對(duì)應(yīng)的換手率。兩者總和應(yīng)等于100日的總換手率
答(股市騎兵00):
上升:sum(v*ISUP,100)/FINANCE( 7);
下跌:sum(v*ISDOWN,100)/FINANCE( 7);
947.問(wèn):
sum((date>=1050413 and date<=1050606)*v,0)/FINANCE(7);
sum((date>=1050607 and date<=1050818)*v,0)/FINANCE(7);
區(qū)域能否用周期代替時(shí)間, 以利于調(diào)整參數(shù).
答(股市騎兵00):
時(shí)間定位是你要求的呀?
INPUT:n(56),m(32);
sum(v,n)/FINANCE(7);
ref(sum(v,m)/FINANCE(7),n+1);
948.問(wèn):
大智指數(shù)轉(zhuǎn)向低點(diǎn)時(shí)間
先用之字轉(zhuǎn)向取得大盤(pán)指數(shù)1a0001產(chǎn)生低點(diǎn)的時(shí)間,再以該時(shí)間為基準(zhǔn)日,取股票的前后n個(gè)交易日內(nèi)的最低價(jià),再求最低價(jià)之后的最高價(jià)和最后一個(gè)交易日與該最低價(jià)的比值.
答(bajatje):
p:="1A0001close";
w:=PEAKBARS(p,10,1);
LL:=LLv(L,if(w>n,2*n,n+w));
wL:=LLvbars(L,if(w>n,2*n,n+w));
hh:=hhv(h,wL);
bh:hh/LL;
bc:c/LL
問(wèn):
能不能把低點(diǎn)以前的信號(hào)過(guò)濾掉?
答(cwy):
P:="1A0001$CLOSE";
W:=BARSSINCE(BACKSET(ISLASTBAR,PEAKBARS(P,10,2)+1));
WL:=BARSSINCE(BACKSET(ISLASTBAR,LLvbars(L,W)+1))+1;
LL:REF(L,WL-1),LINETHICK0;
HH:=HHV(H,WL),LINETHICK0;
BH:HH/LL;
BC:C/LL
949.問(wèn):
求歷史最低點(diǎn)的時(shí)間,但是上市首日的點(diǎn)就是歷史最低點(diǎn),分開(kāi)取很簡(jiǎn)單,怎樣合成一個(gè)語(yǔ)句?
歷史低點(diǎn):ref(date+19000000,BARSLAST(歷史最低值<ref(歷史最低值,1)));
首日:ref(date+19000000,barssince(c));
歷史最低時(shí):if(歷史低點(diǎn)>0,歷史低點(diǎn),首日);
答(bajatje):
d:=LLvbars(L,0)=barscount(c)-1;
if(d,ref(date,llvbars(L,0)),0);//不要加19000000,否則日期會(huì)出現(xiàn)1~2天的偏差
答(cwy):
參考:
(BACKSET(ISLASTBAR,LLvbars(L,0))=0)*date;//這是首日是歷史最低點(diǎn),取時(shí)間
cross(BACKSET(ISLASTBAR,LLvbars(L,0)+1),0.5)*date;//這是非首日是歷史最低點(diǎn),取時(shí)間
cross(BACKSET(ISLASTBAR,LLvbars(L,0)),0.5)*ref(date,1);//這是首日與非首日是歷史最低點(diǎn),取時(shí)間
(注:南客提示,日期不要想當(dāng)然地加上19000000,飛狐軟件不能表達(dá)這么大的整數(shù),
硬要加上這個(gè)數(shù)字,會(huì)導(dǎo)致很簡(jiǎn)單的加減都出錯(cuò))
950.問(wèn):
怎樣求歷史最高點(diǎn)向后五天內(nèi)的最低點(diǎn)?
答(bajatje):
wh:=hhvbars(h,0)+1;
w:=if(wh<6,wh,6);
a:ref(LLv(L,w),wh-w);