0 beğenilme 0 beğenilmeme
129 kez görüntülendi
{ --- Input Parameters for Long --- } fastLength_L := Input("Fast MA Length (Long)",5); slowLength_L := Input("Slow MA Length (Long)",18); slopeLength_L := Input("Slope Length (Long)",7); slopeThreshold_L := Input("Slope Threshold (Long)", 0.5); atrLength_L := Input("ATR Length (Long)",1); atrThreshold_L := Input("ATR Threshold (Long)",0.03); { --- Input Parameters for Short --- } fastLength_S := Input("Fast MA Length (Short)",6); slowLength_S := Input("Slow MA Length (Short)",20); slopeLength_S := Input("Slope Length (Short)",6); slopeThreshold_S := Input("Slope Threshold (Short)", 0.4); atrLength_S := Input("ATR Length (Short)",7); atrThreshold_S := Input("ATR Threshold (Short)",0.04); { --- Moving Average Calculation --- } fastMA_L := Mov(C, fastLength_L, E); { EMA for fast MA Long } slowMA_L := Mov(C, slowLength_L, S); { SMA for slow MA Long } fastMA_S := Mov(C, fastLength_S, S); { SMA for fast MA Short } slowMA_S := Mov(C, slowLength_S, E); { EMA for slow MA Short } { --- Slope Calculation --- } fastSlope_L := (fastMA_L - Ref(fastMA_L, -slopeLength_L)) / slopeLength_L; slowSlope_L := (slowMA_L - Ref(slowMA_L, -slopeLength_L)) / slopeLength_L; fastSlope_S := (fastMA_S - Ref(fastMA_S, -slopeLength_S)) / slopeLength_S; slowSlope_S := (slowMA_S - Ref(slowMA_S, -slopeLength_S)) / slopeLength_S; { --- ATR Calculation --- } atr_L := ATR(atrLength_L); atr_S := ATR(atrLength_S); { --- Long Conditions --- } isFlat_L := Abs(fastSlope_L) < slopeThreshold_L AND Abs(slowSlope_L) < slopeThreshold_L; lowVolatility_L := atr_L < atrThreshold_L; longCondition := Cross(fastMA_L, slowMA_L) AND NOT isFlat_L AND NOT lowVolatility_L; { --- Short Conditions --- } isFlat_S := Abs(fastSlope_S) < slopeThreshold_S AND Abs(slowSlope_S) < slopeThreshold_S; lowVolatility_S := atr_S < atrThreshold_S; shortCondition := Cross(slowMA_S, fastMA_S) AND NOT isFlat_S AND NOT lowVolatility_S; { --- Trading Signals --- } Buy := longCondition; Sell := shortCondition; { --- Plot Signals --- } Buy; Sell; Bu kodu matriks diline çevirirmisiniz?
System Tester-Bağlı Emirler kategorisinde (80 puan) tarafından | 129 kez görüntülendi

1 cevap

0 beğenilme 0 beğenilmeme
Merhabalar,

Aşağıdaki şekilde deneyiniz,

al

fastLength_L := 5;
slowLength_L := 18;
slopeLength_L := 7;
slopeThreshold_L :=0.5;
atrLength_L := 1;
atrThreshold_L := 0.03;
 fastLength_S := 6;
 slowLength_S := 20;
slopeLength_S := 6;
slopeThreshold_S := 0.4;
atrLength_S := 7;
atrThreshold_S :=0.04;
fastMA_L := Mov(C, fastLength_L, E);
slowMA_L := Mov(C, slowLength_L, S);
fastMA_S := Mov(C, fastLength_S, S);
 slowMA_S := Mov(C, slowLength_S, E);
fastSlope_L := (fastMA_L - Ref(fastMA_L, -slopeLength_L)) / slopeLength_L;
slowSlope_L := (slowMA_L - Ref(slowMA_L, -slopeLength_L)) / slopeLength_L;
fastSlope_S := (fastMA_S - Ref(fastMA_S, -slopeLength_S)) / slopeLength_S;
slowSlope_S := (slowMA_S - Ref(slowMA_S, -slopeLength_S)) / slopeLength_S;
atr_L := ATR(atrLength_L); atr_S := ATR(atrLength_S);
isFlat_L := Abs(fastSlope_L) < slopeThreshold_L  AND  Abs(slowSlope_L) < slopeThreshold_L;
lowVolatility_L := atr_L < atrThreshold_L;
longCondition := Cross(fastMA_L, slowMA_L) AND isFlat_L AND lowVolatility_L;
 isFlat_S := Abs(fastSlope_S) < slopeThreshold_S AND Abs(slowSlope_S) < slopeThreshold_S;
lowVolatility_S := atr_S < atrThreshold_S;
shortCondition := Cross(slowMA_S, fastMA_S) AND  isFlat_S AND  lowVolatility_S;
Buy := longCondition;
Sell := shortCondition;
Buy

sat

fastLength_L := 5;
slowLength_L := 18;
slopeLength_L := 7;
slopeThreshold_L :=0.5;
atrLength_L := 1;
atrThreshold_L := 0.03;
 fastLength_S := 6;
 slowLength_S := 20;
slopeLength_S := 6;
slopeThreshold_S := 0.4;
atrLength_S := 7;
atrThreshold_S :=0.04;
fastMA_L := Mov(C, fastLength_L, E);
slowMA_L := Mov(C, slowLength_L, S);
fastMA_S := Mov(C, fastLength_S, S);
 slowMA_S := Mov(C, slowLength_S, E);
fastSlope_L := (fastMA_L - Ref(fastMA_L, -slopeLength_L)) / slopeLength_L;
slowSlope_L := (slowMA_L - Ref(slowMA_L, -slopeLength_L)) / slopeLength_L;
fastSlope_S := (fastMA_S - Ref(fastMA_S, -slopeLength_S)) / slopeLength_S;
slowSlope_S := (slowMA_S - Ref(slowMA_S, -slopeLength_S)) / slopeLength_S;
atr_L := ATR(atrLength_L); atr_S := ATR(atrLength_S);
isFlat_L := Abs(fastSlope_L) < slopeThreshold_L  AND  Abs(slowSlope_L) < slopeThreshold_L;
lowVolatility_L := atr_L < atrThreshold_L;
longCondition := Cross(fastMA_L, slowMA_L) AND isFlat_L AND lowVolatility_L;
 isFlat_S := Abs(fastSlope_S) < slopeThreshold_S AND Abs(slowSlope_S) < slopeThreshold_S;
lowVolatility_S := atr_S < atrThreshold_S;
shortCondition := Cross(slowMA_S, fastMA_S) AND  isFlat_S AND  lowVolatility_S;
Buy := longCondition;
Sell := shortCondition;
Sell

iyi çalışmalar
(30,068 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.



8,632 soru
8,586 cevap
4,819 yorum
19,773 kullanıcı