Zusätzliche Bedingung mit Supertrend Indikator

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #153609 quote
    Rim
    Participant
    Average

    Hallo,

    ich bräuchte eine zusätzliche Bedingung mit Supertrend Indikator für mein Bestehendes Handelssystem basierend auf CCI Indikaror , welcher nur auf Kaufen eingestellt ist.(kleine Zeiteinheit).

    Gekauft soll nur dann wenn Supertrendlinie grün ist.

    Danke.

    // Festlegen der Code-Parameter
    DEFPARAM CumulateOrders = False // Kumulieren von Positionen deaktiviert
    // Das Handelssystem wird um 0:00 Uhr alle pending Orders stornieren und alle Positionen schließen. Es werden vor der "FLATBEFORE"-Zeit keine neuen Orderaufträge zugelassen.
    DEFPARAM FLATBEFORE = 100000
    // Stornieren aller pending Orders und Schließen aller Positionen zur "FLATAFTER"-Zeit
    DEFPARAM FLATAFTER = 210000
    
    IF breakevenLevel>0 THEN
    SELL AT breakevenLevel STOP
    ENDIF
    
    IF NOT ONMARKET THEN
    breakevenLevel=0
    ENDIF
    // Bedingungen zum Einstieg in Long-Positionen
    indicator1 = CCI[78]
    c1 = (indicator1 CROSSES UNDER -148)
    
    IF c1 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven1*pipsize THEN
    breakevenLevel = tradeprice(1)+PointsToKeep1*pipsize
    ENDIF
    //////////////////////////////////////////// Stops und Targets
    
    startBreakeven1 = 1.8 //how much pips/points in gain to activate the breakeven function?
    PointsToKeep1 = 1.8 //how much pips/points to keep in profit above of below our entry price when the breakeven is activated (beware of spread)
    
    IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven2*pipsize THEN
    breakevenLevel = tradeprice(1)+PointsToKeep2*pipsize
    ENDIF
    //////////////////////////////////////////// Stops und Targets
    
    startBreakeven2 =5 //how much pips/points in gain to activate the breakeven function?
    PointsToKeep2 =1//how much pips/points to keep in profit above of below our entry price when the breakeven is activated (beware of spread)
    
    IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven3*pipsize THEN
    breakevenLevel = tradeprice(1)+PointsToKeep3*pipsize
    ENDIF
    //////////////////////////////////////////// Stops und Targets
    
    startBreakeven3 = 9.0 //how much pips/points in gain to activate the breakeven function?
    PointsToKeep3 = 5.0 //how much pips/points to keep in profit above of below our entry price when the breakeven is activated (beware of spread)
    
    IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven4*pipsize THEN
    breakevenLevel = tradeprice(1)+PointsToKeep4*pipsize
    ENDIF
    //////////////////////////////////////////// Stops und Targets
    
    startBreakeven4 = 14 //how much pips/points in gain to activate the breakeven function?
    PointsToKeep4 = 10 //how much pips/points to keep in profit above of below our entry price when the breakeven is activated (beware of spread)
    
    IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven5*pipsize THEN
    breakevenLevel = tradeprice(1)+PointsToKeep5*pipsize
    ENDIF
    //////////////////////////////////////////// Stops und Targets
    
    startBreakeven5 = 16 //how much pips/points in gain to activate the breakeven function?
    PointsToKeep5 = 12 //how much pips/points to keep in profit above of below our entry price when the breakeven is activated (beware of spread)
    
    IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven6*pipsize THEN
    breakevenLevel = tradeprice(1)+PointsToKeep6*pipsize
    ENDIF
    //////////////////////////////////////////// Stops und Targets
    
    startBreakeven6 = 21 //how much pips/points in gain to activate the breakeven function?
    PointsToKeep6 = 16 //how much pips/points to keep in profit above of below our entry price when the breakeven is activated (beware of spread)
    
    IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven7*pipsize THEN
    breakevenLevel = tradeprice(1)+PointsToKeep7*pipsize
    ENDIF
    //////////////////////////////////////////// Stops und Targets
    
    startBreakeven7 = 24 //how much pips/points in gain to activate the breakeven function?
    PointsToKeep7 = 20 //how much pips/points to keep in profit above of below our entry price when the breakeven is activated (beware of spread)
    
    takeprofit = 31 //takeprofit in points
    stoploss =6 //stoploss in points
    //reset the breakevenLevel when no trade are on market
    IF NOT ONMARKET THEN
    breakevenLevel=0
    ENDIF
    
    set target pprofit takeprofit
    set stop ploss stoploss
    
    #153612 quote
    robertogozzi
    Moderator
    Master

    Schreiben Sie dies in Zeile 18:

    st = close > Supertrend[3,10]

    Ändern Sie dann Zeile 19 wie folgt:

    IF c1 AND St THEN
    #153763 quote
    Rim
    Participant
    Average

    Es funktioniert, vielen dank!

    Können Sie bitte mit Parabolic SAR Indikator auch das gleiche machen.

    Gekauft soll nur dann wenn Parabolic SAR Punkte grün sind.

    Danke im Voraus.

    #153779 quote
    robertogozzi
    Moderator
    Master

    Fügen Sie diese neue Zeile nach 18 ein:

    MySAR = close > SAR[0.02,0.02,0.2]

    Ändern Sie dann Zeile 19 erneut wie folgt:

    IF c1 AND St AND MySAR THEN
    #153884 quote
    Rim
    Participant
    Average

    Klasse, hat auch funktioniert.

    Welche Bedingung bei Supertrend soll stehen wenn verkauft wird, rote Linie ?

    Danke.

    Bei Parabolic SAR komme ich selber darauf 🙂

    #153889 quote
    robertogozzi
    Moderator
    Master

    Das Gegenteil von oben:

    close < Supertrend[3,10]
    #154676 quote
    Rim
    Participant
    Average

    Hallo,

    welche zusätzliche Bedingung soll stehen bei Linear Regression Indikator, gekauft soll nur dann wenn Linear Regressionlinie grün ist.

    Danke.

    #154680 quote
    robertogozzi
    Moderator
    Master

    Sie müssen die Bedingung hinzufügen, dass die Regressionslinie> die des vorherigen Balkens ist:

    LR = LinearRegression[10](close) > LinearRegression[10](close)[1]
    #155776 quote
    Rim
    Participant
    Average

    Läuft alles ganz gut.

    Es fehlt noch eine Kleinigkeit. Ich habe dein Programm”Need a trailing stop loss that moves more dynamic” in das Handelssystem eingefügt.

    Was aber nicht geht ist “trailingstep“. Egal welche Zahl, keine änderung. Kannst du bitte überprüfen

    Vielleicht habe ich Fehler gemacht

    #155778 quote
    robertogozzi
    Moderator
    Master

    Was ist mein Trailing Stop? Vielleicht ist es besser, wenn Sie den vollständigen Code veröffentlichen.

    #155784 quote
    Rim
    Participant
    Average
    // Festlegen der Code-Parameter
    DEFPARAM CumulateOrders = False // Kumulieren von Positionen deaktiviert
    // Das Handelssystem wird um 0:00 Uhr alle pending Orders stornieren und alle Positionen schließen. Es werden vor der "FLATBEFORE"-Zeit keine neuen Orderaufträge zugelassen.
    DEFPARAM FLATBEFORE = 120000
    // Stornieren aller pending Orders und Schließen aller Positionen zur "FLATAFTER"-Zeit
    DEFPARAM FLATAFTER = 210000
    
    IF breakevenLevel>0 THEN
    SELL AT breakevenLevel STOP
    ENDIF
    
    IF NOT ONMARKET THEN
    breakevenLevel=0
    ENDIF
    // Bedingungen zum Einstieg in Long-Positionen
    indicator1 = CCI[58]
    c1 = (indicator1 CROSSES UNDER -149.0)
    st = close > Supertrend[11,9]
    st2 = close > Supertrend[11,9]
    IF c1 AND St AND St2 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    //     trailing stop function
    trailingstep      = 3   //5    trailing step to move the "stoploss" after BreakEven
    startBreakeven    = 3     //5    pips in gain to activate the breakeven function
    PointsToKeep      = 2     //3    pips to keep in profit above/below entry price when the breakeven is activated
    
    
    IF newSL > 0 THEN
    SELL      AT newSL STOP
    
    ENDIF
    IF NOT ONMARKET THEN
    newSL          = 0
    breakevenLevel = 0
    ENDIF
    
    IF LONGONMARKET AND (close - tradeprice(1)) >= (startBreakeven * pipsize) AND breakevenlevel = 0 THEN
    breakevenLevel = tradeprice(1) + (PointsToKeep * pipsize)                         //calculate the breakevenLevel
    ENDIF
    
    
    IF LONGONMARKET AND BreakEvenLevel THEN
    //next moves after BreakEven
    IF newSL > 0 AND ((close - newSL) >= (trailingstep * pipsize)) THEN
    newSL = newSL + (trailingstep * pipsize)
    ENDIF
    ENDIF
    
    IF breakevenLevel > 0 THEN
    newSL = BreakEvenLevel
    ENDIF
    
    set target pprofit takeprofit
    set stop ploss stoploss
    takeprofit = 31 //takeprofit in points
    stoploss =6.2 //stoploss in points
    
    #155791 quote
    robertogozzi
    Moderator
    Master

    Ich sehe keine Fehler im Code, aber ich sehe extrem kleine Werte in Trailingstart, Trailingstep und StopLoss. Erkundigen Sie sich bei IG nach den Mindeststopppunkten. 3, 3 und 6.2 scheinen mir sehr niedrig.

    #155795 quote
    Rim
    Participant
    Average

    Für US500 sollte gehen, hoffe ich.

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.

Zusätzliche Bedingung mit Supertrend Indikator


ProBuilder: Indikatoren & Custom Tools

New Reply
Author
author-avatar
Rim @rim Participant
Summary

This topic contains 12 replies,
has 2 voices, and was last updated by Rim
5 years, 2 months ago.

Topic Details
Forum: ProBuilder: Indikatoren & Custom Tools
Language: German
Started: 12/13/2020
Status: Active
Attachments: No files
Logo Logo
Loading...