determiner une semaine en particuliers

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #163705 quote
    magiclil
    Participant
    Average

    Bonjour Nicolas,

    j’aimerais avoir la possibilité de déterminer certaines semaines en particuliers.

    Exemple :

    and year = 2021 and month = 1 and week = 1

    year et month fonctionne très bien dans cet exemple. Par contre, ce n’est pas le cas pour ce qui est des semaines.

    Une idée ? Merci d’avance

    #163714 quote
    Nicolas
    Keymaster
    Master

    L’instruction “week” n’existe pas, il faut donc calculer soit même le numéro de la semaine, par exemple :

    if dayofweek<dayofweek[1] then
     w=w+1
    endif
    if year<>year[1] then 
     w = 1
    endif 
    
    return w

    Bien sûr il faut que le début de l’année soit affichée sur le graphique pour que le compte démarre correctement.

    magiclil thanked this post
    #169489 quote
    christophe11560
    Participant
    Senior

    Bonjour Nicolas et magiclil,
    Je suis entrain d’utiliser ce code et je me rend compte qu’il y a plusieurs erreurs:
    -if year<>year[1] then => w=0 et non à 1 sauf erreur de ma part et l’année commence bien à 1 et non à 2.
    parcontre j’ai des années à 53 voir 56 semaines pour 2021?
    Je joins mon indicateur de numérotation de semaine en histogramme pour avis de votre part.

    #169491 quote
    christophe11560
    Participant
    Senior
    //Testing if today is Wednesday
    //ouverture= 0 ou 1
    //FermetureVeille=0 ou 1
    
    if ouverture=1 then
    val=open
    elsif FermetureVeille=1 then
    val=close[1]
    else
    val=open
    endif
    
    if dayofweek<dayofweek[1] then
    w=w+1
    endif
    if year<>year[1] then
    w = 0
    endif
    w=w+1
    IF customclose>=val THEN
    indicateur = 1
    r = 0
    g = 255
    b=0
    drawtext("#w#",barindex[0],1.2,Dialog,Bold,10) coloured(0,200,0)
    ELSif customclose<val THEN
    indicateur = -1
    r = 255
    g = 0
    b=0
    drawtext("#w#",barindex[0],-1.2,Dialog,Bold,10) coloured(200,0,0)
    Else
    indicateur = 0
    ENDIF
    
    RETURN indicateur coloured(r,g,b) style(histogram) as "achat vente semaine"
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

determiner une semaine en particuliers


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
magiclil @magiclil Participant
Summary

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

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 03/10/2021
Status: Active
Attachments: No files
Logo Logo
Loading...