0 beğenilme 0 beğenilmeme
281 kez görüntülendi
Merhabalar; aşağıdaki tradingview kodunu matrix e uyarlamak istedim, ancak tam olarak başarılı olamadım. Yardımcı olabilir misiniz?

//////////Trading View Codes///////////////
SC = input(close, 'Source')

// Fast Trail //
AP1 = input(5, 'Fast ATR period')  // ATR Period  
AF1 = input(0.5, 'Fast ATR multiplier')  // ATR Factor
SL1 = AF1 * ta.atr(AP1)  // Stop Loss   M:= ATR(Period)
Trail1 = 0.0
iff_1 = SC > nz(Trail1[1], 0) ? SC - SL1 : SC + SL1
iff_2 = SC < nz(Trail1[1], 0) and SC[1] < nz(Trail1[1], 0) ? math.min(nz(Trail1[1], 0), SC + SL1) : iff_1
Trail1 := SC > nz(Trail1[1], 0) and SC[1] > nz(Trail1[1], 0) ? math.max(nz(Trail1[1], 0), SC - SL1) : iff_2

// Slow Trail //
AP2 = input(10, 'Slow ATR period')  // ATR Period
AF2 = input.float(3, 'Slow ATR multiplier')  // ATR Factor
SL2 = AF2 * ta.atr(AP2)  // Stop Loss
Trail2 = 0.0
iff_3 = SC > nz(Trail2[1], 0) ? SC - SL2 : SC + SL2
iff_4 = SC < nz(Trail2[1], 0) and SC[1] < nz(Trail2[1], 0) ? math.min(nz(Trail2[1], 0), SC + SL2) : iff_3
Trail2 := SC > nz(Trail2[1], 0) and SC[1] > nz(Trail2[1], 0) ? math.max(nz(Trail2[1], 0), SC - SL2) : iff_4

// Bar color for trade signal //
Green = Trail1 > Trail2 and close > Trail2 and low > Trail2
Blue = Trail1 > Trail2 and close > Trail2 and low < Trail2
Red = Trail2 > Trail1 and close < Trail2 and high < Trail2
Yellow = Trail2 > Trail1 and close < Trail2 and high > Trail2

// Signals //
Bull = ta.barssince(Green) < ta.barssince(Red)
Bear = ta.barssince(Red) < ta.barssince(Green)

Buy = ta.crossover(Trail1, Trail2)
Sell = ta.crossunder(Trail1, Trail2)

TS1 = plot(Trail1, 'Fast Trail', style=plot.style_line, color=Trail1 > Trail2 ? color.blue : color.yellow, linewidth=2, display=display.none)
TS2 = plot(Trail2, 'Slow Trail', style=plot.style_line, color=Trail1 > Trail2 ? color.green : color.red, linewidth=2)
fill(TS1, TS2, Bull ? color.new(color.green, 90) : color.new(color.red, 90))

plotbuysell = input(true, 'Plot Buy/Sell arrows')
plotshape(Buy and plotbuysell == 1, 'BUY', shape.labelup, location.belowbar, color.new(color.green, 0), text='BUY', textcolor=color.new(color.black, 0))
plotshape(Sell and plotbuysell == 1, 'SELL', shape.labeldown, location.abovebar, color.new(color.red, 0), text='SELL', textcolor=color.new(color.black, 0))
İndikatör Pozisyonları ve Değerleri kategorisinde (16 puan) tarafından | 281 kez görüntülendi

1 cevap

0 beğenilme 0 beğenilmeme
merhaba,

diğer dillere hakim olmadığımızdan bu tür formül isteklerine olumlu dönüş yapamıyoruz,

ancak bizlerde bulunan trailstop dan türettiğimiz istenilen periyodlarda yapılan aşağıdaki formülleri deneyebilirsiniz,

bilgilerinize

 

 

period:=10;
coeff:=3;
AP:=C;
period1:=5;
coeff1:=0.5;
AP1:=C;
OFFSET:=coeff*ATRe(period);
STR:=AP+OFFSET;
STS:=AP-OFFSET;
FUB:=IF(STR<PREV OR REF(C,-1)>PREV,STR,PREV);
FLB:=IF(STS>PREV OR REF(C,-1)<PREV,STS,PREV);
OFFSET1:=coeff1*ATRe(period);
STR1:=AP1+OFFSET1;
STS1:=AP1-OFFSET1;
FUB1:=IF(STR1<PREV OR REF(C,-1)>PREV,STR1,PREV);
FLB1:=IF(STS1>PREV OR REF(C,-1)<PREV,STS1,PREV);
ATRStop:=IF(PREV=REF(FUB,-1) AND C<FUB,FUB,IF(PREV=REF(FUB,-1) AND C>FUB,FLB,IF(PREV=REF(FLB,-1) AND C>FLB,FLB,IF(PREV=REF(FLB,-1) AND C<FLB,FUB,fub))));
ATRStop1:=IF(PREV=REF(FUB1,-1) AND C<FUB1,FUB1,IF(PREV=REF(FUB1,-1) AND C>FUB1,FLB1,IF(PREV=REF(FLB1,-1) AND C>FLB1,FLB1,IF(PREV=REF(FLB1,-1) AND C<FLB1,FUB1,fub1))));
cross(ATRStop1,ATRStop)

sat

 

period:=10;
coeff:=3;
AP:=C;
period1:=5;
coeff1:=0.5;
AP1:=C;
OFFSET:=coeff*ATRe(period);
STR:=AP+OFFSET;
STS:=AP-OFFSET;
FUB:=IF(STR<PREV OR REF(C,-1)>PREV,STR,PREV);
FLB:=IF(STS>PREV OR REF(C,-1)<PREV,STS,PREV);
OFFSET1:=coeff1*ATRe(period);
STR1:=AP1+OFFSET1;
STS1:=AP1-OFFSET1;
FUB1:=IF(STR1<PREV OR REF(C,-1)>PREV,STR1,PREV);
FLB1:=IF(STS1>PREV OR REF(C,-1)<PREV,STS1,PREV);
ATRStop:=IF(PREV=REF(FUB,-1) AND C<FUB,FUB,IF(PREV=REF(FUB,-1) AND C>FUB,FLB,IF(PREV=REF(FLB,-1) AND C>FLB,FLB,IF(PREV=REF(FLB,-1) AND C<FLB,FUB,fub))));
ATRStop1:=IF(PREV=REF(FUB1,-1) AND C<FUB1,FUB1,IF(PREV=REF(FUB1,-1) AND C>FUB1,FLB1,IF(PREV=REF(FLB1,-1) AND C>FLB1,FLB1,IF(PREV=REF(FLB1,-1) AND C<FLB1,FUB1,fub1))));
cross(ATRStop,ATRStop1)
(40,149 puan) tarafından
0 0
Serkan Bey yardımlarınız için çok teşekkürler. Gönderdiğiniz kodlar da işime yaradı.
Bir sorum daha olacak;

al geldiğinde grafik üzerinde "AL", sat geldiğinde "SAT" yazamadım.

TextOut(CROSS(Trail1, Trail2),"AL", D);
TextOut(CROSS(Trail2, Trail1),"SAT", U)

kullandım ama bu istediğimi değil de indikatöre verdiğim ismi yazıyor.
0 0

merhaba,

period:=10;
coeff:=3;
AP:=C;
period1:=5;
coeff1:=0.5;
AP1:=C;
OFFSET:=coeff*ATRe(period);
STR:=AP+OFFSET;
STS:=AP-OFFSET;
FUB:=IF(STR<PREV OR REF(C,-1)>PREV,STR,PREV);
FLB:=IF(STS>PREV OR REF(C,-1)<PREV,STS,PREV);
OFFSET1:=coeff1*ATRe(period);
STR1:=AP1+OFFSET1;
STS1:=AP1-OFFSET1;
FUB1:=IF(STR1<PREV OR REF(C,-1)>PREV,STR1,PREV);
FLB1:=IF(STS1>PREV OR REF(C,-1)<PREV,STS1,PREV);
ATRStop:=IF(PREV=REF(FUB,-1) AND C<FUB,FUB,IF(PREV=REF(FUB,-1) AND C>FUB,FLB,IF(PREV=REF(FLB,-1) AND C>FLB,FLB,IF(PREV=REF(FLB,-1) AND C<FLB,FUB,fub))));
ATRStop1:=IF(PREV=REF(FUB1,-1) AND C<FUB1,FUB1,IF(PREV=REF(FUB1,-1) AND C>FUB1,FLB1,IF(PREV=REF(FLB1,-1) AND C>FLB1,FLB1,IF(PREV=REF(FLB1,-1) AND C<FLB1,FUB1,fub1))));
TextOut(cross(ATRStop1,ATRStop),"AL", D);
TextOut(cross(ATRStop,ATRStop1),"SAT", U)

şeklinde deneyebilirsiniz,

bizlerde sorun çıkarmadı,

bilgilerinize

 

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.



7,674 soru
7,673 cevap
4,461 yorum
11,251 kullanıcı