Monatsendestrategie mir felhel eine Variable

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

    Hallo,

     

    können Sje mir helfen bei eine code.

     

    Ich möchte mit Hilfe von 2 Variablen herrausfinden,  welches  in den letzten Jahren die optimale Tradedauer für eine Trade über den  Monatswechsel im S&P  gewesen wäre.

    Variable 1 soll den  optimalen Einstiegstag ermitteln, der im Vormonat vom 17. bis zum 22. Handelstag erfolgen kann.

    Variable 2 soll die Dauer des Trades sein, die aber nicht länger als 10 Tage dauern soll. Also im Code auf Tagesbasis wäre das dann X = Barindex – Tradeindex

    Vielen Dank

    #246292 quote
    Iván González
    Moderator
    Master

    Hier sind sie:

    bestEntryDay=17
    limitdaysonmarket=10
    
    if month<>month[1] then
    tradingDays=1
    else
    tradingDays=tradingDays+1
    endif
    
    if tradingdays>=bestEntryDay and tradingdays[1]<bestEntryDay then
    buy 1 contract at market
    endif
    
    if onmarket then
    daysonmarket=daysonmarket+1
    if daysonmarket>=limitdaysonmarket then
    sell at market
    endif
    else
    daysonmarket=0
    endif
    
    #246333 quote
    axmichi
    Participant
    Senior

    Hallo,

     

    danke das funktioniert toll!!!

    Jetzt möchte ich gern mit Hilfe der Variablen Funktion in einem Test testen, welcher der folgenden Filter sich für den Handel dieser Strategie am besten eignen würde.

    Muss ich nun jeden der Filter allein testen und mir die Ergebenisse aufschreiben oder kann ich die Filter über die Variablen Funktion miteinander vergleichen?

    F1 = volume[1] < Volume[2]

    F2 = High[1]-Low[1] < High[2]-Low[2]

    F3 = RSI[1] < 20

    F4 = Open[1] > Close[1]

     

    Vielen Dank

    #246351 quote
    Iván González
    Moderator
    Master

    Es besteht die Möglichkeit, einen Filter zu verwenden und die angezeigten Bedingungen zu ändern. Darüber hinaus können Sie mehrere Kombinationen einführen, die Ihnen angezeigt werden.

    bestEntryDay=17
    limitdaysonmarket=10
    filter = 2 // from 1 to X (all combinations you create)
    
    if month<>month[1] then
    tradingDays=1
    else
    tradingDays=tradingDays+1
    endif
    
    if filter=1 then
    setup = volume[1] < Volume[2]
    elsif filter=2 then
    setup = High[1]-Low[1] < High[2]-Low[2]
    elsif filter=3 then
    setup = RSI[1] < 20
    elsif filter=4 then
    setup = Open[1] > Close[1]
    elsif filter=5 then
    setup = volume[1] < Volume[2] and High[1]-Low[1] < High[2]-Low[2]
    // complete with more combinations if you want
    endif
    
    if setup and tradingdays>=bestEntryDay and tradingdays[1]<bestEntryDay then
    buy 1 contract at market
    endif
    
    if onmarket then
    daysonmarket=daysonmarket+1
    if daysonmarket>=limitdaysonmarket then
    sell at market
    endif
    else
    daysonmarket=0
    endif
    
    graph daysonmarket coloured("red")
    graph limitdaysonmarket coloured("red")
    graph tradingdays coloured("blue")
    graph bestEntryDay coloured("blue")
    
    robertogozzi thanked this post
    #246398 quote
    axmichi
    Participant
    Senior

    Wow, das ist wirklich Super, vielen Dank!!!

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

Monatsendestrategie mir felhel eine Variable


ProOrder: Automatischer Handel & Backtesting

New Reply
Author
author-avatar
axmichi @axmichi Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by axmichi
9 months, 2 weeks ago.

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