Strategia RSI apertura e chiusura calcolati sui livelli precedenti

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #191702 quote
    davidelaferla
    Participant
    Average

    Buongiorno a tutti!

    Ho bisogno del vostro aiuto per creare una strategia di swing trading basata sull’indicatore RSI e che dovrebbe funzionare così :

    • Il primo ordine e solo il primo , ad esempio “buy 1 contract” , deve partire quando “RSI crosses over 31.5″ .  Il valore del RSI raggiunto in quel momento, va a diventare il valore di chiusura della posizione attraverso questa formula (70-(valore iniziale-30)) . Quindi quando ” RSI crosses over valore di chiusura” , la posizione si chiude, e il valore del RSI in quel momento diventa il valore di apertura del secondo ordine “sellshort 1 contract”.
    • Il secondo ordine verrà aperto quando “RSI crosses under valore di apertura” ,  e il valore del RSI in quel momento, va a diventare il valore di chiusura della seconda posizione attraverso la formula (30+(70-valore iniziale)) .
    • E così via. Il valore di apertura genera un valore di chiusura, e il valore effettivo nella chiusura diventa il valore di apertura della posizione successiva
    #191724 quote
    robertogozzi
    Moderator
    Master

    Ecco:

    // RSI apertura & chiusura
    //
    DEFPARAM CumulateOrders = false
    DEFPARAM PreLoadBars    = 0
    ONCE RSIapertura    = 31.5
    ONCE RSIchiusura = 0
    ONCE LastTrade   = 0
    MyRSI = rsi[14](close)
    IF MyRSI CROSSES OVER RSIapertura AND LastTrade = 0 AND Not OnMarket  THEN
    LastTrade   = 1
    RSIchiusura = 70 - (RSIapertura - 30)
    BUY 1 CONTRACT AT MARKET
    ENDIF
    IF MyRSI CROSSES OVER RSIchiusura AND LongOnMarket AND LastTrade = 1 THEN
    SELL AT MARKET
    RSIapertura = MyRSI
    ENDIF
    IF MyRSI CROSSES UNDER RSIapertura AND LastTrade = 1 AND Not OnMarket  THEN
    RSIchiusura = 30 + (70 - RSIapertura)
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    IF MyRSI CROSSES UNDER RSIchiusura AND ShortOnMarket AND LastTrade = 1 THEN
    EXITSHORT AT MARKET
    RSIapertura = MyRSI
    LastTrade   = 0
    ENDIF
    /* multiline comments are now available
    
    SET TARGET pPROFIT 400
    SET STOP   pLOSS   100
    
    graph MyRsi AS "Rsi"
    graph RSIapertura
    graph RSIchiusura
    */
    #191732 quote
    davidelaferla
    Participant
    Average

    Grazie Roberto ! Sempre gentilissimo. Ora provo…

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

Strategia RSI apertura e chiusura calcolati sui livelli precedenti


ProOrder: Trading Automatico & Backtesting

New Reply
Author
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by davidelaferla
3 years, 10 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 04/13/2022
Status: Active
Attachments: 1 files
Logo Logo
Loading...