anderer Sl ab bestimmten Tag

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #254632 quote
    axmichi
    Participant
    Senior

    Hallo,

     

    in einem System auf Tagesbasis habe ich als Ausstieg festgelegt, dass der Trade nach 15 Tagen geschlossen wird.

    If longonmarket and Barindex – Tradeindex = 14 THEN

    Sell at market

    endif

    Jetzt möchte ich zwei weitere andere Varianten:

    Der Trade soll nach 10 Tagen geschlossen werden wenn er im Verlust ist.

    Ist der Trade am 10. Tag im Gewinn soll er am Supertrend-Indikator getrailt werden, das so lange, bis der Kurs den Supertrend nach unten gekreuzt  hat. Dann folgt der Ausstieg.

    Ist dies mööglich?

     

    Vielen Dank

    #254634 quote
    robertogozzi
    Moderator
    Master

    Hier ist der Code:

    if Not OnMarket Then
       UseST = 0
    ENDIF
    If longonmarket and (Barindex - Tradeindex) = 10 THEN
       IF (PositionPerf < 0) THEN
          Sell at market
       ELSE
          UseST = 1
       endif
    ENDIF
    If longonmarket and Barindex - Tradeindex = 14 THEN
       Sell at market
    endif
    IF UseST THEN
       ST = Supertrend[3,10]
       IF close CROSSES UNDER ST THEN
          SELL at Market
       ENDIF
    endif
    Iván González thanked this post
    #254639 quote
    axmichi
    Participant
    Senior

    Hallo, Danke, die Trades werden im Verlust geschlossen und im Gewinn nach 14 Kerzen geschlossen.

     

    Der Trade soll ja am Supertrend getrailt werden, was aber leider nicht passiert? Siehe Bild, der Trade darf erst mit dem unterkreutzen beendet werden, wo im Bild das gelbe kreuz ist?ß

     

    Vielen Dank

    #254641 quote
    robertogozzi
    Moderator
    Master

    Ich habe die Position des Supertrends geändert und die Ausstiegsbedingung nach 14 Kerzen leicht angepasst (nur falls der Supertrend zuvor nicht aktiviert worden war):

    ST = Supertrend[3,10]
    if Not OnMarket Then
       UseST = 0
    ENDIF
    If longonmarket and (Barindex - Tradeindex) = 10 THEN
       IF (PositionPerf < 0) THEN
          Sell at market
       ELSE
          UseST = 1
       endif
    ENDIF
    If (longonmarket and Barindex - Tradeindex = 14) AND Not UseST THEN
       Sell at market
    endif
    IF UseST THEN
       IF close CROSSES UNDER ST THEN
          SELL at Market
       ENDIF
    endif
    Iván González thanked this post
    #254643 quote
    Iván González
    Moderator
    Master

    Hallo. Ich sehe, dass Robertos Code korrekt funktioniert. Ich habe grafische Elemente hinzugefügt, um zu sehen, was beim Backtesting passiert; Sie werden feststellen, dass er die genannten Bedingungen erfüllt.

    if Not OnMarket Then
       UseST = 0
       if close crosses over Supertrend[3,10] then
          buy 1 contract at market
       endif
    ENDIF
    If longonmarket and (Barindex - Tradeindex) = 10 THEN
       IF (PositionPerf < 0) THEN
          Sell at market
       ELSE
          UseST = 1
       endif
    ENDIF
    If longonmarket and Barindex - Tradeindex = 14 THEN
       Sell at market
    endif
    IF UseST THEN
       ST = Supertrend[3,10]
       IF close CROSSES UNDER ST THEN
          SELL at Market
       ENDIF
    endif
    graph UseST
    //graph positionperf coloured("blue")
    if longonmarket then
       graph Barindex - Tradeindex
    endif
    graphonprice ST coloured("red")
    graphonprice Supertrend[3,10]
    
    #254645 quote
    Iván González
    Moderator
    Master

    Ups… Ich hatte Robertos letzte Nachricht nicht gelesen 🙂

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

anderer Sl ab bestimmten Tag


ProOrder: Automatischer Handel & Backtesting

New Reply
Author
author-avatar
axmichi @axmichi Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by Iván González
1 month, 3 weeks ago.

Topic Details
Forum: ProOrder: Automatischer Handel & Backtesting
Language: German
Started: 12/18/2025
Status: Active
Attachments: 1 files
Logo Logo
Loading...