0 beğenilme 0 beğenilmeme
214 kez görüntülendi
Merhaba aşağıda kodu çevirebilir misiniz. coefficient:=Input("SafeZone coefficient",  0,10,2.5); bkpds:=Input("Lookback periods",1,252,10); pds:=Input("Trend EMA periods",2,252,21); adv:=Input("plot: today's SafeZone=0, tomorrow's stop=1",0,1,0); plot:=Input("plot: trailing stop=1, Long+Short=2, signals=3",1,3,1); delay:=Input("Entry and Exit signal delay",  0,5,0); DwSidePen:=Mov(C,pds,E)>Ref(Mov(C,pds,E),-1)  AND LRef(H,-1); UpSideDiff:=If(UpSidePen,H-Ref(H,-1),0); UpPenAvg:=Sum(UpSideDiff,bkpds)  /(Sum(UpSidePen,bkpds)+.000001); StShort:=Ref(H+UpPenAvg*coefficient,-1); StopShort:=If(C>PREV,StShort,Min(StShort,PREV)); In:=Cross(C,Ref(StopShort,-1)); Out:=Cross(Ref(StopLong,-1),C); flag:=BarsSince(Cum(In+Out>-1)=1 OR In)  < BarsSince(Cum(In+Out>-1)=1 OR Out)  +(Cum(In)=1); signals:=Ref((Cum(In)=1  AND Alert((Cum(In)=1)=0,2)  OR flag AND Alert(flag=0,2))   -(flag=0 AND Alert(flag,2)),-delay); If(plot=1,Ref(If(flag=1,stopLong,stopShort),  -1+adv),If(plot=2,Ref(stopLong,-1+adv),0)); If(plot=1,Ref(If(flag=1,stopLong,stopShort),  -1+adv),If(plot=2,Ref(stopShort,-1+adv),  signals))
Grafik kategorisinde (210 puan) tarafından | 214 kez görüntülendi

1 cevap

0 beğenilme 0 beğenilmeme

Merhaba

Coef:=2.5;
BkPds:=10;
Pds:=21;
Adv:=0;
Plot:=1;
Delay:=0;
TrendEMA:=Mov(C,Pds,E);
DnPen:=If(TrendEMA>Ref(TrendEMA,-1) AND L<Ref(L,-1),1,0);
DnDiff:=If(DnPen=1,Ref(L,-1)-L,0);
DnPenAvg:=Sum(DnDiff,BkPds)/(Sum(DnPen,BkPds)+0.000001);
StLong:=Ref(L-DnPenAvg*Coef,-1);
StopLong:=If(C<PREV,StLong,Max(StLong,PREV));
UpPen:=If(TrendEMA<Ref(TrendEMA,-1) AND H>Ref(H,-1),1,0);
UpDiff:=If(UpPen=1,H-Ref(H,-1),0);
UpPenAvg:=Sum(UpDiff,BkPds)/(Sum(UpPen,BkPds)+0.000001);
StShort:=Ref(H+UpPenAvg*Coef,-1);
StopShort:=If(C>PREV,StShort,Min(StShort,PREV));
In:=Cross(C,Ref(StopShort,-1));
Out:=Cross(Ref(StopLong,-1),C);
Flag:=BarsSince(In OR Out)<BarsSince(Out)+(In);
Signals:=Ref((In OR Flag)-(Flag=0),-Delay);
In

Şeklinde deneyebilirsiniz. 

  • StopLong: Long pozisyon için SafeZone stop seviyesi.

  • StopShort: Short pozisyon için SafeZone stop seviyesi.

  • In / Out: Al-Sat sinyalleri (Cross fonksiyonu).

  • Hangi değişkeni yazdırmak isterseniz son tarafı değiştiriniz.

  • Bilgilerinize.

(7,830 puan) tarafından
Hoş geldiniz, Matriks Destek Platformu sizlere sorularınızın hızlıca cevaplanması için bir ortam sağlar. Sorduğunuz ve cevapladığınız soruların ve yorumlarınızın aldığı oylar üzerinden puan kazanırsınız. Puan sistemine bağlı kampanyamızla ücretsiz kullanım avantajlarından faydalanabilirsiniz.



9,866 soru
9,837 cevap
5,312 yorum
58,635 kullanıcı