affichage plus haut et plus bas les plus proche du prix

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

    Bonjour,

     

    J’utilise actuellement l’indicateur écrit par Vonasi : https://www.prorealcode.com/prorealtime-indicators/candlesticks-ohlc-yearly-quarterly-monthly-weekly-daily-h4-h1/

    et je souhaiterai également y inclure une fonction qui trace une ligne sur le prochain plus haut ou bas daily que les prix vont rencontrer.

    Je l’ai fait avec un 2sd indicateur (ci-dessous), mais le problème est qu’il met très longtemps à se charger à chaque changement de page. Y a t’il un moyen de le rendre plus rapide ou de l’inclure dans le code de Vonasi ?

    Le code est très différent dans les 2 indics, et je ne comprends pas la logique du code de Vonasi et ne peut donc pas le modifier.

    Merci pour votre aide.

     

    DEFPARAM DrawOnLastBarOnly = True
    
    
    PlusHaut = Dhigh(1)
    PlusBas = Dlow(1)
    NbJours = 2
    FOR cpt=NbJours To 0
    PlusHaut = MAX(PlusHaut,Dhigh(cpt))
    PlusBas = MIN(PlusBas,Dlow(cpt))
    NEXT
    
    
    DernierHaut = 100000
    DernierBas = 0
    
    
    For cpt = 1 to NbJoursHistorique
    If Dhigh(cpt) > Close  and Dhigh(cpt) < DernierHaut then
    DernierHaut = Dhigh(cpt)
    endif
    If Dhigh(cpt) < Close and Dhigh(cpt) > DernierBas then
    DernierBas = Dhigh(cpt)
    endif
    If DLow(cpt) < Close and DLow(cpt) > DernierBas  then
    DernierBas = DLow(cpt)
    endif
    If DLow(cpt) > close and DLow(cpt) < DernierHaut then
    DernierHaut = DLow(cpt)
    endif
    Next
    
    If DernierHaut < 100000 then
    DRAWHLINE(DernierHaut) COLOURED(50,50,250,150)
    endif
    If DernierBas > 0 then
    DRAWHLINE(DernierBas) COLOURED(50,50,250,150)
    endif
    
    
    
    RETURN PlusHaut COLOURED(0,205,0) AS"PlusHaut", PlusBas COLOURED(205,0,0) AS"PlusBas"
    Exemple-level.jpg Exemple-level.jpg
    #145250 quote
    Nicolas
    Keymaster
    Master

    Pour bien comprendre ta demande, tu souhaites parcourir l’historique des daily High et Low et afficher en temps réel, ceux qui sont les plus proches du prix courant ?

    #145494 quote
    Shark
    Participant
    Senior

    Bonjour

    Je tombe sur ce post et ta remarque Nicolas m’intéresse. A savoir comment afficher les +haut et +bas (4h, daily, hebdo, monthly… ) qui sont proche du prix afin d’éviter une surcharge du graphe ?

    Merci par avance

    #145630 quote
    Nicolas
    Keymaster
    Master

    L’idéal serait de les enregistrer dans un tableau de données et tester ces valeurs pour trouver la plus proche.

    Exemple avec les niveaux daily les plus proches : (PRT v11)

    defparam drawonlastbaronly=true
    
    //saving the daily high/low while reading the history 
    if day<>day[1] then 
     $dh[i]=dhigh(1)
     $dl[i]=dlow(1)
     i=i+1
    endif
    
    //find the closest daily high/low
    if islastbarupdate then 
     hh=0
     ll=close*1000
     lasthhdiff=0
     lastlldiff=0
     for a = 0 to i do 
      hhdiff=abs($dh[a]-close)
      if hhdiff<lasthhdiff or lasthhdiff=0 then 
       hh=$dh[a]
       lasthhdiff=hhdiff
      endif 
      lldiff=abs($dl[a]-close)
      if lldiff<lastlldiff or lastlldiff=0 then
       ll=$dl[a]
       lastlldiff=lldiff
      endif
     next
     //plot the closest levels
     drawhline(hh)
     drawhline(ll)
    endif 
    
    return
    
    
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

affichage plus haut et plus bas les plus proche du prix


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
thierrybl @thierrybl Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by Nicolas
5 years, 5 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 05/22/2020
Status: Active
Attachments: 1 files
Logo Logo
Loading...