Nocheinmal die Stochastik

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #214974 quote
    f1_maikf1_maik
    Participant
    Junior

    Hallo Ihr Lieben.

    Ich möchte eine 3-Indatoren-Strategie erstellen.

    Die Indikatoren sind Stoch, RSI, MACD

     

    Betrachen wir zunächst nur die Longseite

    Ein Kaufsignal tritt auf wenn:

    Stoch: In den letzten n-Perioden soll die K-Line die D-Line im Oversoldbereich von unten nach oben überquert hat. Im Moment des Kaufens soll die K- und die D-Linie nicht im Overbougtbereich sein.

    RSI: In den letzten n1-Perionden soll der RSI die 50-Linie von unten nach oben überquert haben und im Moment des Kaufens über der 50-Linie stehen und seit der letzten Überquerung nicht unter die 50-Linie gefallen sein.

    MACD: In den letzten n-Perioden soll die MACD-Linie die Signallinie unterhalb der Null-Linie von unten nach oben überquert haben und im Moment des Kaufens seit der letzten Überquerung unterhalb der Null-Linie stehen.

    Wir kaufen wenn die Bedingungen für alle 3 Indikatoren erfüllt sind.

     

    Für Verkaufen

    Ist alles vice versa.

     

    Bitte seht anbei das Bild.

    Kann jemand für mich den Code für die Longseite erstellen?

    Screenshot_2.jpg Screenshot_2.jpg
    #215040 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Los geht’s:

    DEFPARAM CumulateOrders = False
    //
    Nperiods1    = 10                     //lookback periods for RSI
    Nperiods2    = 10                     //lookback periods for STOCHASTIC
    Nperiods3    = 10                     //lookback periods for MACD
    //
    // 14-period RSI
    RsiOB        = 70                     //OverBought
    RsiOS        = 100 - RsiOB            //OverSold
    MidLine      = 50
    myRSI        = rsi[14](close)
    L1           = summation[Nperiods1](myRSI CROSSES OVER MidLine) //Crossover in the last Nperiods1 bars
    L2           = myRSI > MidLine                                  //RSI must currently be > 50
    L3           = 1
    FOR i = 1 TO Nperiods1
       IF myRSI[i] CROSSES OVER MidLine THEN
          break
       ENDIF
       IF myRSI[i] < MidLine THEN                                   //RSI souldn't have returned below 50 since
          L3     = 0                                                //  the crossover
          break
       ENDIF
    NEXT
    //
    // Stochastic(10,3,6)
    StOB         = 80                     //OverBought
    StOS         = 100 - StOB             //OverSold
    Kline        = Stochastic[10,3](close)
    Dline        = Average[6,0](Kline)
    L4           = summation[Nperiods2]((Kline CROSSES OVER Dline) AND (Kline < StOS)) //Crossover of lines K and D
    //                                                                                   in the last Nperiods2 bars,
    //                                                                                   provided it occurred when
    //                                                                                   both lines were still in the
    //                                                                                   OverSold area
    L5           = (Kline < StOB) AND (Dline < StOB)                                   //currently both lines are
    //                                                                                   below the OverBought area
    //
    // MACD 12,26,9
    myMACD       = ExponentialAverage[12](close) - ExponentialAverage[26](close)
    mySignalLine = ExponentialAverage[9](myMACD)
    myHisto      = myMACD - mySignalLine
    L6           = summation[Nperiods3]((myMACD CROSSES OVER mySignalLine) AND (myMACD < 0)) //Crossover in the last
    //                                                                                         Nperiods3 bars, provided
    //                                                                                         it's below the ZERO line
    L7           = 1
    FOR i = 1 TO Nperiods3
       IF myMACD[i] CROSSES OVER mySignalLine[i] THEN
          break
       ENDIF
       IF myMACD[i] > 0 THEN                               //MACD souldn't have returned below 0 since the crossover
          L7     = 0
          break
       ENDIF
    NEXT
    L8           = myMACD < 0                              //MACD is currently below 0
    //
    LongCond     = L1 AND L2 AND L3 AND L4 AND L5 AND L6 AND L7 AND L8 AND Not OnMarket
    //
    IF LongCond THEN
       BUY 1 Contract at Market
    ENDIF
    SET STOP   plOSS   300
    SET TARGET pPROFIT 600
    MySystem.itf
Viewing 2 posts - 1 through 2 (of 2 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

Nocheinmal die Stochastik


ProOrder: Automatischer Handel & Backtesting

New Reply
Author
author-avatar
f1_maik @f1_maik Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzirobertogozzi
3 years, 4 months ago.

Topic Details
Forum: ProOrder: Automatischer Handel & Backtesting
Language: German
Started: 05/21/2023
Status: Active
Attachments: 2 files
ProRealCode ProRealCode
Loading...