schliessen am nächsten Tag

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #250259 quote
    sstef3sstef3
    Participant
    Junior
    Hallo, weiß jemand wie man eine Position am nächsten Tag zu einer bestimmten Zeit schließt?
    #250265 quote
    Iván GonzálezIván González
    Moderator
    Legend
    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
    sstef3sstef3
    Participant
    Junior
    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álezIván González
    Moderator
    Legend
    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
    sstef3sstef3
    Participant
    Junior
    Vielen,vielen Dank Ivan. Es funktioniert 🙂
    #259293 quote
    sstef3sstef3
    Participant
    Junior

    wie muss ich das Programm ändern das ich bei c0<o0 and c1<o1 short gehe?

    also short und long im gleichem Programm bei gleichen Zeitbedingungen.

    #259298 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Das war’s:

    /*
    Come devo modificare il programma affinché esegua un'operazione di tipo "short" quando c0<o0 e c1<o1?
    
    In altre parole, eseguire operazioni di tipo "short" e "long" nello stesso programma, nelle stesse condizioni di temporizzazione.
    */
    timeToEnter = 192800
    timeToExit  = 192800
    // Benutzerdefinierte Variablen
    c0 = close
    o0 = open
    c1 = close[1]
    o1 = open[1]
    if not onmarket then
    if opentime>= timeToEnter and opentime[1]<timeToEnter AND c0 > o0 AND c1 > o1 then
    buy 5 contract at market
    elsif opentime>= timeToEnter and opentime[1]<timeToEnter AND c0 < o0 AND c1 < o1 then
    sellshort 5 contract at market
    endif
    endif
    if longonmarket 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
    elsif shortonmarket 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
    exitshort at market
    endif
    else
    checkTimeToExit=0
    endif
    graph signalday coloured("blue")
    
    
    
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

schliessen am nächsten Tag


ProOrder: Automatischer Handel & Backtesting

New Reply
Author
author-avatar
sstef3 @sstef3 Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by robertogozzirobertogozzi
6 months, 1 week ago.

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