Indikator im Sastem und als Stop loss
Forums › ProRealTime Deutsch forum › ProBuilder Support › Indikator im Sastem und als Stop loss
- This topic has 7 replies, 2 voices, and was last updated 1 month ago by
Iván.
-
-
01/15/2025 at 2:48 PM #242636
Hallo
ich habe im forum hier einen Indikator gefunden, den ATR Stop loss finder.
diesen möchte ich als Bedingung für den einstieg und auch als Stop loss benutzen
Wenn ich diesen im code anlege, dann kommt als Meldung ignored und das der Indikator nicht gefunden werden kann.
Was muss ich tun, damit das funktioniert??
Hier der code des Indikators
// HstopL v1 20-07-2022 druby//// Dynamic variable settings// NAME Type Default (comment)// ——————————————————————-// Period integer 14 lookback range// Mul Decimal 1.5 multiply the ATR value by:defparam drawonlastbaronly = true// input limiters – limit the range of values used in code calculationsperiod = max(min(Period,barindex),1) // (1 to barindex)mul = max(min(Mul,10),0) // (0 to 10)//true range calculationtr1 = abs(high – low)tr2 = abs(high – close[1])tr3 = abs(low – close[1])trf = max(tr3,max(tr1,tr2)) // absolute maximum of (tr1,tr2,tr3)if barindex > period then // delay average calculations till enough bars avaliable// manual RMA calculationk= 1/(period)RMA = range * k + RMA[1] * (1–k)xma = RMA// Atr, HLline calculations// Atr valuea = xma * mul// Atr +/- high/low valuesx = xma * mul + highx2 = low – xma * mulendif // barindex > period// Drawing main text and valuesDrawtext(“ATR: #a#”,–255,10,dialog,bold,20)anchor(bottom) coloured (“dodgerblue”)Drawtext(“H: #x#”, –70,10,dialog,bold,20)anchor(bottom) coloured (“red”)Drawtext(“L: #x2#”, 100,10,dialog,bold,20)anchor(bottom) coloured (“teal”)// draw averageType labelDrawtext(“RMA”,40,10,dialog,bold,20)anchor(bottomLeft) coloured (“grey”)// return (atr * mul) high and low linesreturn x as“Hstop”,x2 as“Lstop”01/15/2025 at 4:07 PM #242641Tiene que definir la variable Period y Mul.
123456789101112131415161718192021222324252627282930313233343536// HstopL v1 20-07-2022 druby//// Dynamic variable settings// NAME Type Default (comment)// ——————————————————————-defparam drawonlastbaronly = truePeriod =14// integer 14 lookback rangeMul=1.5// Decimal 1.5 multiply the ATR value by:// input limiters - limit the range of values used in code calculationsperiod = max(min(Period,barindex),1) // (1 to barindex)mul = max(min(Mul,10),0) // (0 to 10)//true range calculationtr1 = abs(high - low)tr2 = abs(high - close[1])tr3 = abs(low - close[1])trf = max(tr3,max(tr1,tr2)) // absolute maximum of (tr1,tr2,tr3)if barindex > period then // delay average calculations till enough bars avaliable// manual RMA calculationk= 1/(period)RMA = range * k + RMA[1] * (1-k)xma = RMA// Atr, HLline calculations// Atr valuea = xma * mul// Atr +/- high/low valuesx = xma * mul + highx2 = low - xma * mulendif // barindex > period// Drawing main text and valuesDrawtext("ATR: #a#",-255,10,dialog,bold,20)anchor(bottom) coloured ("dodgerblue")Drawtext("H: #x#", -70,10,dialog,bold,20)anchor(bottom) coloured ("red")Drawtext("L: #x2#", 100,10,dialog,bold,20)anchor(bottom) coloured ("teal")// draw averageType labelDrawtext("RMA",40,10,dialog,bold,20)anchor(bottomLeft) coloured ("grey")// return (atr * mul) high and low linesreturn x as"Hstop",x2 as"Lstop"01/16/2025 at 1:26 PM #242676Ok, hab ich gemacht. aber wie soll der Name für den Stop Loss sein?? Siehe Bild
Und da steht wieder ignores im code?
Hier der Code:
DEFPARAM CumulateOrders = False // Kumulieren von Positionen deaktiviert
// Bedingungen zum Einstieg in Long-Positionen
indicator1 = ExponentialAverage[22](high)
c1 = (close[1] > indicator1)
ignored, indicator2 = CALL “ATR Stop loss finder”[14, 0.5]
indicator3 = ExponentialAverage[22](low)
c2 = (indicator2 < indicator3)
indicator4 = Williams[4](close)
c3 = (indicator4 < -80)IF c1 AND c2 AND c3 THEN
BUY 1 SHARES AT MARKET
ENDIf01/16/2025 at 1:29 PM #24267701/16/2025 at 3:23 PM #242686Sie können den Stop-Loss festlegen, sobald die Einstiegsbedingungen erfüllt sind, und er bleibt so fixiert.
12345IF not longonmarket and c1 AND c2 AND c3 THENstoploss=x2BUY 1 SHARES AT MARKETset stop price stoplossENDIfx2 stammt aus dem ursprünglichen Code. Von hier aus können Sie die Änderung des Stop-Loss testen, wenn andere Bedingungen erfüllt sind, oder sogar einen Trail-Stop anwenden. Ich überlasse es Ihnen jetzt, damit Sie es studieren können. Du hast im Forum viele Beispiele.
01/16/2025 at 3:48 PM #242690Aber schauen Sie, obwohl der Indicator genau so im Chart ist, wird der Stop loss nicht gehandelt.
Hier der Code mit Ihrem Hinweiß:
EMA22=ExponentialAverage[22](high)
c1 = close[1]>EMA22
ignored, indicator2 = CALL “ATR Stop loss finder”[14, 0.5]
indicator3 = ExponentialAverage[22](low)
c2 = (indicator2 < indicator3)
indicator4 = Williams[4](close)
c3 = (indicator4 < -80)IF c1 AND c2 AND c3 THEN
stoploss=x2
BUY 1 SHARES AT MARKET
ENDIf
set stop price Stoploss01/20/2025 at 4:36 PM #242870Das Problem besteht darin, wo Sie die
set stop price
platzieren. Wie Sie es in Ihren Code eingegeben haben, aktualisiert das System den Stop-Loss-Wert jedes Mal, wenn C1, C2 und C3 gleichzeitig erfüllt werden, auf x2. Schauen Sie sich das an, das ist Ihr Code und im beigefügten Bild können Sie die Aktualisierung des Stop-Loss und den Wert von x2 sehen.123456789101112131415161718192021222324252627282930313233343536373839defparam cumulateorders = falsePeriod =14// integer 14 lookback rangeMul=1.5// Decimal 1.5 multiply the ATR value by:// input limiters - limit the range of values used in code calculationsperiod = max(min(Period,barindex),1) // (1 to barindex)mul = max(min(Mul,10),0) // (0 to 10)//true range calculationtr1 = abs(high - low)tr2 = abs(high - close[1])tr3 = abs(low - close[1])trf = max(tr3,max(tr1,tr2)) // absolute maximum of (tr1,tr2,tr3)if barindex > period then // delay average calculations till enough bars avaliable// manual RMA calculationk= 1/(period)RMA = range * k + RMA[1] * (1-k)xma = RMA// Atr, HLline calculations// Atr valuea = xma * mul// Atr +/- high/low valuesx = xma * mul + highx2 = low - xma * mulendif // barindex > periodEMA22=ExponentialAverage[22](high)c1 = close[1]>EMA22//ignored, indicator2 = CALL "ATR Stop loss finder"[14, 0.5]indicator3 = ExponentialAverage[22](low)c2 = (x2 < indicator3)indicator4 = Williams[4](close)c3 = (indicator4 < -80)IF c1 AND c2 AND c3 THENstoploss=x2BUY 1 SHARES AT MARKETENDIfset stop price Stoplossgraphonprice Stoploss coloured("red")graphonprice x2 coloured("blue")01/20/2025 at 4:42 PM #242873Dies ist der zweite Fall, der Ihnen den Code verrät, den Sie gerade betreten haben. In diesem Fall wird der Stoploss nur am Eingang angezeigt (die Stoploss-Linie wird auf der dunkelgrünen Grafik angezeigt).
123456789101112131415161718192021222324252627282930313233343536373839defparam cumulateorders = falsePeriod =14// integer 14 lookback rangeMul=1.5// Decimal 1.5 multiply the ATR value by:// input limiters - limit the range of values used in code calculationsperiod = max(min(Period,barindex),1) // (1 to barindex)mul = max(min(Mul,10),0) // (0 to 10)//true range calculationtr1 = abs(high - low)tr2 = abs(high - close[1])tr3 = abs(low - close[1])trf = max(tr3,max(tr1,tr2)) // absolute maximum of (tr1,tr2,tr3)if barindex > period then // delay average calculations till enough bars avaliable// manual RMA calculationk= 1/(period)RMA = range * k + RMA[1] * (1-k)xma = RMA// Atr, HLline calculations// Atr valuea = xma * mul// Atr +/- high/low valuesx = xma * mul + highx2 = low - xma * mulendif // barindex > period// Bedingungen zum Einstieg in Long-Positionenindicator1 = ExponentialAverage[22](high)c1 = (close[1] > indicator1)indicator3 = ExponentialAverage[22](low)c2 = (x2 < indicator3)indicator4 = Williams[4](close)c3 = (indicator4 < -80)IF not longonmarket and c1 AND c2 AND c3 THENstoploss=x2BUY 1 SHARES AT MARKETset stop price stoplossENDIfgraphonprice stoploss coloured("darkgreen") -
AuthorPosts
Find exclusive trading pro-tools on