Trendwechsel short long

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #207399 quote
    killerplatuze
    Participant
    New

    Moin,

     

    wenn der Trend wechselt soll die Position gedreht werden, das klappt soweit auch. Nur wenn ich die Bedingungen longonmarket und shortonmarket hinzu füge dann findet laut Auswertung kein Wechsel mehr statt.

    Ich möchte den Trade mit 2 Kontrakten eröffnen und einen Kontrakt bei TP 50 verkaufen, den zweiten beim Trendwechsel. Was ist falsch?

    Gruen = myMagicTrend > myMagicTrend[1]
    Rot = myMagicTrend < myMagicTrend[1]
    
    // Verhindert das Trading an bestimmten Wochentagen
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    // Bedingungen zum Einstieg in Long-Positionen
    
    IF Gruen AND not daysForbiddenEntry THEN
    BUY 2 CONTRACT AT MARKET
    ENDIF
    //Bedingungen zum Ausstieg von Long-Positionen
    if longonmarket then
    if close - tradeprice(1) >= 50 then
    SELL 1 CONTRACT AT MARKET
    endif
    endif
    
    IF Rot THEN
    SELL AT MARKET
    ENDIF
    
    // Bedingungen zum Einstieg in Short-Positionen
    
    IF Rot AND not daysForbiddenEntry THEN
    SELLSHORT 2 CONTRACT AT MARKET
    ENDIF
    
    // Bedingungen zum Ausstieg aus Short-Positionen
    if shortonmarket then
    if TRADEPRICE(1) - CLOSE >= 50 then
    EXITSHORT 1 CONTRACT AT MARKET
    //endif
    IF gruen THEN
    EXITSHORT AT MARKET
    ENDIF
    ENDIF
    ENDIF
    #207400 quote
    Razz
    Participant
    Master

    Servus

    Probier mal das :

    // Festlegen der Code-Parameter
    DEFPARAM CumulateOrders = False // Kumulieren von Positionen deaktiviert
     
    myMagicTrend = CALL "Magic Trend custom"[20, 9, 2, 5]
    
    Gruen = myMagicTrend > myMagicTrend[1]
    Rot = myMagicTrend < myMagicTrend[1]
     
    // Verhindert das Trading an bestimmten Wochentagen
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
     
    // Bedingungen zum Einstieg in Long-Positionen
     
    IF Gruen AND not daysForbiddenEntry THEN
    BUY 2 CONTRACT AT MARKET
    ENDIF
    //Bedingungen zum Ausstieg von Long-Positionen
    if longonmarket and close - tradeprice(1) >= 50 then
    SELL 1 CONTRACT AT MARKET
    endif
    
     
    IF Rot THEN
    SELL AT MARKET
    ENDIF
     
    // Bedingungen zum Einstieg in Short-Positionen
     
    IF Rot AND not daysForbiddenEntry THEN
    SELLSHORT 2 CONTRACT AT MARKET
    ENDIF
     
    // Bedingungen zum Ausstieg aus Short-Positionen
    if shortonmarket and TRADEPRICE(1) - CLOSE >= 50 then
    EXITSHORT 1 CONTRACT AT MARKET
    
    IF gruen THEN
    EXITSHORT AT MARKET
    ENDIF
    
    ENDIF
    killerplatuze thanked this post
    #207401 quote
    Razz
    Participant
    Master

    Wenn Du versuche mit dem Take Profit machen willst habe Ich Dir folgende Datei da gibt es dann eine Variable da kannst Du dann Filtern was am besten ist .

    Die KP1.itf kannst Du über die Importfunktion hinzufügen

    Im Anhang der Report

    killerplatuze and JohnScher thanked this post
    #207408 quote
    killerplatuze
    Participant
    New

    Hmm, geht aber trotzdem nicht. Es sind doppelt soviele longs wie shorts wenn ich das hier raus nehmen

    Wenn ich die Zeile 18/19 und 34/35 rausnehme dann passt es wieder, sind auch nur ein Bruchteil der Trades.

    #207447 quote
    Razz
    Participant
    Master

    Hallo

    Ja komischerweise schließt er schließt er manche Long Positionen und eröffnet dann gleich wieder Neue Long Positionen .
    Sorry habe leider keine Lösung dafür vielleicht Antwortet ja noch einer von den Spezialisten robertogozzi oder Nicolas die haben mir bisher immer sehr gut geholfen .

    Und Ich habe bisher noch kein Handelssystem für mich gefunden das dauerhaft gute Gewinne liefert

    Wünsche Dir eine gute Zeit mein Abo bei EdgebyRs ist nun ja ausgelaufen und werden mich wieder mehr den MichaBL`s Drehpunkten widmen da lässt sich einfacher
    Geld verdienen .

    Gruß

    killerplatuze thanked this post
    #207519 quote
    killerplatuze
    Participant
    New

    Hat jemand hierzu eine Lösung oder gibt es keine?

    #207572 quote
    robertogozzi
    Moderator
    Master

    Versuche dies:

    // Festlegen der Code-Parameter
    DEFPARAM CumulateOrders = False // Kumulieren von Positionen deaktiviert
     
    myMagicTrend = CALL "Magic Trend custom"[20, 9, 2, 5]
    
    Gruen = (myMagicTrend > myMagicTrend[1])
    Rot   = (myMagicTrend < myMagicTrend[1])
    IF Gruen = 0 AND Rot = 0 THEN
    Gruen = Gruen[1]
    Rot   = Rot[1]
    ENDIF
     
    // Verhindert das Trading an bestimmten Wochentagen
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
     
    // Bedingungen zum Einstieg in Long-Positionen
     
    IF Gruen AND Rot[1] AND not daysForbiddenEntry AND Not OnMarket THEN
    BUY 2 CONTRACT AT MARKET
    ENDIF
    //Bedingungen zum Ausstieg von Long-Positionen
    if longonmarket and close - tradeprice(1) >= TP AND abs(CountOfPosition) = 2 then
    SELL 1 CONTRACT AT MARKET
    endif
     
    IF Rot THEN
    SELL AT MARKET
    ENDIF
     
    // Bedingungen zum Einstieg in Short-Positionen
     
    IF Rot AND Gruen[1] AND not daysForbiddenEntry THEN
    SELLSHORT 2 CONTRACT AT MARKET
    ENDIF
     
    // Bedingungen zum Ausstieg aus Short-Positionen
    if shortonmarket and TRADEPRICE(1) - CLOSE >= TP then
    EXITSHORT 1 CONTRACT AT MARKET
    
    IF gruen THEN
    EXITSHORT AT MARKET
    ENDIF
    
    ENDIF
    killerplatuze thanked this post
    #207574 quote
    robertogozzi
    Moderator
    Master

    Ich habe einige Fehler korrigiert und einen Handelsplan hinzugefügt, den ich auf 24 Stunden eingestellt habe:

    // Festlegen der Code-Parameter
    DEFPARAM CumulateOrders = False // Kumulieren von Positionen deaktiviert
     
    myMagicTrend = CALL "Magic Trend custom"[20, 9, 2, 5]
    
    Gruen = (myMagicTrend > myMagicTrend[1])
    Rot   = (myMagicTrend < myMagicTrend[1])
    IF Gruen = 0 AND Rot = 0 THEN
    Gruen = Gruen[1]
    Rot   = Rot[1]
    ENDIF
     
    // Verhindert das Trading an bestimmten Wochentagen
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    tradinghours       = OpenTime >= 000000 AND OpenTime <= 240000
     
    // Bedingungen zum Einstieg in Long-Positionen
     
    IF Gruen AND Rot[1] AND not daysForbiddenEntry AND tradinghours AND Not OnMarket THEN
    BUY 2 CONTRACT AT MARKET
    ENDIF
    //Bedingungen zum Ausstieg von Long-Positionen
    if longonmarket and close - tradeprice(1) >= TP AND abs(CountOfPosition) = 2 then
    SELL 1 CONTRACT AT MARKET
    endif
     IF Rot THEN
    SELL AT MARKET
    ENDIF
     
    // Bedingungen zum Einstieg in Short-Positionen
     
    IF Rot AND Gruen[1] AND not daysForbiddenEntry AND tradinghours AND Not OnMarket THEN
    SELLSHORT 2 CONTRACT AT MARKET
    ENDIF
     
    // Bedingungen zum Ausstieg aus Short-Positionen
    if shortonmarket and (TRADEPRICE(1) - CLOSE) >= TP AND abs(CountOfPosition) = 2 then
    EXITSHORT 1 CONTRACT AT MARKET
    IF gruen THEN
    EXITSHORT AT MARKET
    ENDIF
    ENDIF
    killerplatuze thanked this post
    #207576 quote
    killerplatuze
    Participant
    New

    Super, danke dafür, sieht schon besser aus!

    Wenn ich teste wird eine Position mit 2 Short Kontrakten eröffnet, 1 Kontrakt wird verkauft, der 2te jedoch nie. Es werden auch keine weiteren Trades eröffnet.

     

    Fehler gefunden, das letzte endif war falsch gesetzt

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

Trendwechsel short long


ProOrder: Automatischer Handel & Backtesting

New Reply
Author
Summary

This topic contains 8 replies,
has 3 voices, and was last updated by killerplatuze
3 years ago.

Topic Details
Forum: ProOrder: Automatischer Handel & Backtesting
Language: German
Started: 01/13/2023
Status: Active
Attachments: 6 files
Logo Logo
Loading...