Merhaba,
Aşağıdaki PMAXRsiT3 formülünü koşullu formülümde destek altındaysan bir PMAX1', üstündeyse PMAX'e göre sat olarak formüle ettiğimde matriks donuyor sorun nerede? AYnı formülü daha basit nasıl yazablirim?
coeff:=OPT1;
MovPeriod:=OPT2;
periods:=10;
Periodr:=14;
A:=OPT3;
i:=if(c>=Ref(c,-1),c-Ref(c,-1),0);
i2:=if(c<Ref(c,-1),Ref(c,-1)-c,0);
AvgUp:=MOV(i,Periodr,S);
AvgDown:=MOV(i2,Periodr,S);
AvgUpc:=MOV(i,Periodr,ww);
AvgDownc:=MOV(i2,Periodr,ww);
AvgUpH:=(AvgUp*(periodr-1)+if(H>Ref(c,-1),H-Ref(c,-1),0))/periodr;
AvgDownH:=(AvgDown*(periodr-1)+if(H<Ref(c,-1),Ref(c,-1)-H,0))/periodr;
AvgUpL:=(AvgUp*(periodr-1)+if(L>Ref(c,-1),L-Ref(c,-1),0))/periodr;
AvgDownL:=(AvgDown*(periodr-1)+if(L<Ref(c,-1),Ref(c,-1)-L,0))/periodr;
rsc:=AvgUpc/AvgDownc;
rsic:=if(rsc=-1,0,(100-(100/(1+rsc))));
rsh:=AvgUph/AvgDownh;
rsih:=if(rsh=-1,0,(100-(100/(1+rsh))));
rsl:=AvgUpl/AvgDownl;
rsil:=if(rsl=-1,0,(100-(100/(1+rsl))));
TR:=max(rsih-rsil,max(abs(rsih-REF(rsic,-1)),abs(rsil-REF(rsic,-1))));
ATRSI:=Mov(TR,periods,s);
K:=TILL(rsic,MovPeriod,A);
OFFSET:=coeff*ATRSI;
STR:=K+OFFSET;
STS:=K-OFFSET;
FUB:=IF(STR<PREV OR REF(K,-1)>PREV,STR,PREV);
FLB:=IF(STS>PREV OR REF(K,-1)<PREV,STS,PREV);
PMax:=IF(PREV=REF(FUB,-1) AND K<FUB,FUB,IF(PREV=REF(FUB,-1) AND K>FUB,FLB,IF(PREV=REF(FLB,-1) AND K>FLB,FLB,IF(PREV=REF(FLB,-1) AND K<FLB,FUB,FUB))));
coeff1:=OPT4;
MovPeriod1:=OPT5;
periods1:=10;
Periodr1:=14;
A1:=OPT6;
i1:=if(c>=Ref(c,-1),c-Ref(c,-1),0);
i21:=if(c<Ref(c,-1),Ref(c,-1)-c,0);
AvgUp1:=MOV(i1,Periodr1,S);
AvgDown1:=MOV(i21,Periodr1,S);
AvgUpc1:=MOV(i1,Periodr1,ww);
AvgDownc1:=MOV(i21,Periodr1,ww);
AvgUpH1:=(AvgUp1*(periodr1-1)+if(H>Ref(c,-1),H-Ref(c,-1),0))/periodr1;
AvgDownH1:=(AvgDown*(periodr1-1)+if(H<Ref(c,-1),Ref(c,-1)-H,0))/periodr1;
AvgUpL1:=(AvgUp1*(periodr1-1)+if(L>Ref(c,-1),L-Ref(c,-1),0))/periodr1;
AvgDownL1:=(AvgDown1*(periodr1-1)+if(L<Ref(c,-1),Ref(c,-1)-L,0))/periodr1;
rsc1:=AvgUpc1/AvgDownc1;
rsic1:=if(rsc1=-1,0,(100-(100/(1+rsc1))));
rsh1:=AvgUph1/AvgDownh1;
rsih:=if(rsh1=-1,0,(100-(100/(1+rsh1))));
rsl1:=AvgUpl1/AvgDownl1;
rsil1:=if(rsl1=-1,0,(100-(100/(1+rsl1))));
TR1:=max(rsih1-rsil1,max(abs(rsih-REF(rsic1,-1)),abs(rsil1-REF(rsic1,-1))));
ATRSI1:=Mov(TR1,periods1,s);
K1:=TILL(rsic1,MovPeriod1,A1);
OFFSET1:=coeff1*ATRSI1;
STR1:=K1+OFFSET1;
STS1:=K1-OFFSET1;
FUB1:=IF(STR1<PREV OR REF(K1,-1)>PREV,STR1,PREV);
FLB1:=IF(STS1>PREV OR REF(K1,-1)<PREV,STS1,PREV);
PMax1:=IF(PREV=REF(FUB1,-1) AND K1<FUB1,FUB1,IF(PREV=REF(FUB1,-1) AND K1>FUB1,FLB1,IF(PREV=REF(FLB1,-1) AND K1>FLB1,FLB1,IF(PREV=REF(FLB1,-1) AND K1<FLB1,FUB1,FUB1))));