Aide Indicateur RSI

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #230053 quote
    paulPRT
    Participant
    New

    Bonjour à tous,

    J’ai codé un indicateur qui achète quand le RSI est en dessous de 30 et vend quand il est à 55.

    Il marche plutôt bien (autour de 85% de win) mais sur le Nikkei et le Dax, il nous offre des performances catastrophiques.

    Je me suis renseigné dessus et me suis rendu compte qu’il perdait tout le capital car il pyramidait une position (voir photo ci-joint).

    Voici donc ma question : Comment faire pour lui faire attendre qu’une position soit clôturée avant de prendre une nouvelle position ?

    Autre question : Connaissez vous une méthode une manière de demander à un indicateur d’acheter et de vendre à une heure donnée ?

    Voici le code que vous pouvez aussi retrouver ci-joint.

    // Define a variable to keep track of whether a position is open or not
    positionOpen = 0

    // Setting the parameters for the RSI indicator
    RSILength = 14

    // Calculate RSI
    RSIValue = RSI[RSILength]

    // Setting the parameters for the ATR indicator
    ATRLength = 14
    ATRValue = AverageTrueRange[ATRLength]

    // Define buy and sell conditions
    BuyCondition = RSIValue < 30 and 40 < ATRValue
    SellCondition = RSIValue > 55

    // Check if a position is already open
    if positionOpen = 0 then
    if BuyCondition then
    buy at market
    positionOpen = 1 // Update positionOpen to indicate a long position is opened
    endif

    endif

    if SellCondition then
    sell at market
    positionOpen = 0 // Update positionOpen to indicate a short position is opened
    endif

    Capture-decran-2024-03-19-172540.png Capture-decran-2024-03-19-172540.png RSI-Strat.itf
    #230059 quote
    JC_Bywan
    Moderator
    Master

    Bjr,

    Je déplace le sujet du forum probuilder (indicateurs graphiques sans passage d’ordre, codes se terminant par return) au forum proorder (backtests/stratégies auto avec ordres d’achat/de vente)

    Pour prendre “une seule position à la fois”, on peut ajouter en début de code:

    defparam cumulateorders=false

     

    https://www.prorealcode.com/documentation/cumulateorders/

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

Aide Indicateur RSI


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
paulPRT @paulprt Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by JC_Bywan
1 year, 11 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 03/19/2024
Status: Active
Attachments: 2 files
Logo Logo
Loading...