Premier signal apres changement de trend

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #58806 quote
    avgjoeavgjoe
    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
    NicolasNicolas
    Keymaster
    Legend

    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
    avgjoeavgjoe
    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
    NicolasNicolas
    Keymaster
    Legend

    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.
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

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 NicolasNicolas
8 years, 8 months ago.

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