schliessen am nächsten Tag

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #250259 quote
    sstef3
    Participant
    New

    Hallo,

    weiß jemand wie man eine Position am nächsten Tag zu einer bestimmten Zeit schließt?

    #250265 quote
    Iván González
    Moderator
    Master

    Hier ist ein Beispiel. Das Kreuzen der gleitenden Durchschnitte ist das Ausstiegssignal, aber dieses erfolgt erst am nächsten Tag um 11:00 Uhr.

    timetoExit=110000
    avg1=average[200](close)
    avg2=average[50](close)
    
    if not onmarket and avg2 crosses over avg1 then
       buy 1 contract at market
    endif
    
    if onmarket then
       
       if avg2 crosses under avg1 then
          checkTimeToExit=1
          signalday=1
       endif
       
       if intradaybarindex=0 and checkTimeToExit=1 and signalday=1 then
          signalday=0
       endif
       
       if checkTimeToExit and signalday=0 and opentime>=timeToExit and opentime[1]<timeToExit then
          sell at market
       endif
    else
       checkTimeToExit=0
    endif
    
    graphonprice avg1 coloured("blue")
    graphonprice avg2 coloured("red")
    
    graph signalday coloured("blue")
    
    robertogozzi thanked this post
    #250266 quote
    sstef3
    Participant
    New

    Danke.Das Programm funktioniert.

    Leider bekomme ich es mit meinen Einstiegsbedingungen nich hin.

    Wie müsste es mit meinen Einstiegsbedingungen aussehen?

    IF time = 192800 and c0>o0 and c1>o1 and NOT LongOnMarket THEN
    buy 5 CONTRACTS AT MARKET
    endif

    und jetzt am nächsten Tag um 192800 schließen?

    #250271 quote
    Iván González
    Moderator
    Master

    Ich weiß nicht, was c0, c1, o0 und o1 sind. Sie müssen in dem Code, den ich Ihnen sende, nur die genannten Variablen ersetzen.

    timeToEnter = 192800
    timeToExit  = 192800
    
    // Benutzerdefinierte Variablen
    c0 = close
    o0 = open
    c1 = close[1]
    o1 = open[1]
    
    if not onmarket and opentime>= timeToEnter and opentime[1]<timeToEnter AND c0 > o0 AND c1 > o1 then
       buy 5 contract at market
    endif
    
    if onmarket then
       
       if checkTimeToExit=0 then
          checkTimeToExit=1
          signalday=1
       endif
       
       if intradaybarindex=0 and checkTimeToExit=1 and signalday=1 then
          signalday=0
       endif
       
       if checkTimeToExit and signalday=0 and opentime>=timeToExit and opentime[1]<timeToExit then
          sell at market
       endif
    else
       checkTimeToExit=0
    endif
    
    graph signalday coloured("blue")
    
    robertogozzi thanked this post
    #250295 quote
    sstef3
    Participant
    New

    Vielen,vielen Dank Ivan.

    Es funktioniert 🙂

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

schliessen am nächsten Tag


ProOrder: Automatischer Handel & Backtesting

New Reply
Author
author-avatar
sstef3 @sstef3 Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by sstef3
5 months, 1 week ago.

Topic Details
Forum: ProOrder: Automatischer Handel & Backtesting
Language: German
Started: 09/02/2025
Status: Active
Attachments: No files
Logo Logo
Loading...