Premier signal apres changement de trend

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #58806 quote
    avgjoe
    Participant
    Junior

    Bonjour,

    Une petite question: comment coder la reconnaissance d’un “premier signal” d’un trend (define d’une facon ou d’une autre) tout en ignorant les suivants?

    Par exemple disons que nous definissons un changement de trend base sur le RSI comme suit

    if RSI[period](close)> OVBL then
    b=+1 //bullish trend
    elsif RSI[period](close)< OVSL then
    b=-1 //bearish trend
    else
    b=b //keep b value from previous (optional)
    endif

    Comment ensuite coder le “premier evenement” (disons une valeur de RSI par exemple – RSI<x pour un rebond haussier ou RSI>y pour un rebond baissier) dans chacun des trends, et retourner une valeur z pour chacun de ces premiers evenements?

    D’avance merci

    #59054 quote
    Nicolas
    Keymaster
    Master

    C’était le sujet de ce topic: Un seul signal par tendance.

    Tu devrais arriver à reproduire le principe avec ta propre stratégie. Dans la négative, fait le nous savoir.

    avgjoe thanked this post
    #59152 quote
    avgjoe
    Participant
    Junior

    Bonjour Nicolas

    Voila ce que j’ai construit et qui semble fonctionner.

    En revanche, je trouve ce que j’ai fait un peu lourd. Y a-t-il un moyen plus judicieux d’arriver au meme resultat notamment en utilisant barindex?

    once a = 0
    once b = 0
    if RSI[RSIP](close)> OVBL then
    b=+1 //bullish trend
    elsif RSI[RSIP](close)< OVSL then
    b=-1 //bearish trend
    else
    b=b //keep b value from previous (optional)
    endif
    
    c1 = (RSI[RSIP](close)>RSI[RSIP](close[1])) AND (RSI[RSIP](close[1])< OVSLA)
    c2 = (b=+1) and (c1)
    
    if c2 then
    a=+1
    endif
    if b=-1 then
    a=0
    endif
    if a[1]=0 and a=1 then
    sig=+1
    elsif a[1]=1 and a=1 then
    sig=0
    endif
    
    RETURN sig

    Mille merci pour ta disponibility legendaire et tes conseils eclaires

    Bien cordialement

    #59156 quote
    Nicolas
    Keymaster
    Master

    Tous les chemins mènent à Rome en programmation, je ne vais m’investir plus dans ton code si il fonctionne. Par contre tu pourrais l’optimiser en ne déclarant qu’une seule fois l’indicateur RSI dans une variable au début du code et en utilisant uniquement celle-ci plutôt que de rappeler l’indicateur à chaque fois.

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

Premier signal apres changement de trend


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
avgjoe @avgjoe Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by Nicolas
8 years, 1 month ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 01/10/2018
Status: Active
Attachments: No files
Logo Logo
Loading...