programme de calcul des points pivots

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #247042 quote
    phil3034
    Participant
    Junior

    Bonjour a tous,

     

    Je cherche a intégrer a mon programme les points pivots journaliers, semaine et mois ainsi que 4h mais leurs mid.
    Il y a plusieurs formules sur le forum et je vousais etre de prendre la bonne c’est a dire identique aux calculs de PRT nativement.
    Pouvez vous m’aider ?
    Merci !

    #247071 quote
    robertogozzi
    Moderator
    Master

    Essayez cet indicateur (c’est un indicateur existant sur le forum, que j’ai modifié).

    DEFPARAM CalculateOnLastBars = 5000
    Once mode = 0               //0, 1, 2, 3
     
    Once dailyPivot = 0
    Once dailyHigh = 0
    Once dailyLow = 0
    Once dailyR1 = 0
    Once dailyS1 = 0
    Once dailyR2 = 0
    Once dailyS2 = 0
    Once dailyR3 = 0
    Once dailyS3 = 0
     
    Once lastWeekBarIndex = 0
    Once weeklyHigh = 0
    Once weeklyLow = 0
    Once weeklyPivot = 0
    Once weeklyR1 = 0
    Once weeklyS1 = 0
    Once weeklyR2 = 0
    Once weeklyS2 = 0
    Once weeklyR3 = 0
    Once weeklyS3 = 0
     
    Once lastMonthBarIndex = 0
    Once monthlyHigh = 0
    Once monthlyLow = 0
    Once monthlyPivot = 0
    Once monthlyR1 = 0
    Once monthlyS1 = 0
    Once monthlyR2 = 0
    Once monthlyS2 = 0
    Once monthlyR3 = 0
    Once monthlyS3 = 0
    
    Once lastHourBarIndex = 0
    Once hourlyHigh = 0
    Once hourlyLow = 0
    Once hourlyPivot = 0
    Once hourlyR1 = 0
    Once hourlyS1 = 0
    Once hourlyR2 = 0
    Once hourlyS2 = 0
    Once hourlyR3 = 0
    Once hourlyS3 = 0
    
    If Day<>Day[1] then
    If mode = 0 then
    dailyPivot = (High[1] + Low[1] + Close[1]) / 3
    Elsif mode = 1 then
    dailyPivot = (Open + High[1] + Low[1] + Close[1]) / 4
    Elsif mode = 2 then
    dailyPivot = (High[1] + Low[1] + Close[1]*2) / 4
    Else
    dailyPivot = (Open*2 + High[1] + Low[1]) / 4
    Endif
    dailyR1 = 2*dailyPivot - Low[1]
    dailyS1 = 2*dailyPivot - High[1]
    dailyR2 = dailyPivot + (High[1] - Low[1])
    dailyS2 = dailyPivot - (High[1] - Low[1])
    dailyR3 = dailyR1 + (High[1] - Low[1])
    dailyS3 = dailyS1 - (High[1] - Low[1])
    Endif
    
    If DayOfWeek<>DayOfWeek[1] then
    weeklyHigh = Highest[BarIndex - lastWeekBarIndex](High)[1]
    weeklyLow = Lowest[BarIndex - lastWeekBarIndex](Low)[1]
    lastWeekBarIndex = BarIndex
    If mode = 0 then
    weeklyPivot = (weeklyHigh + weeklyLow + Close[1]) / 3
    Elsif mode = 1 then
    weeklyPivot = (Open + weeklyHigh + weeklyLow + Close[1]) / 4
    Elsif mode = 2 then
    weeklyPivot = (weeklyHigh + weeklyLow + Close[1]*2) / 4
    Else
    weeklyPivot = (Open*2 + weeklyHigh + weeklyLow) / 4
    Endif
    weeklyR1 = 2*weeklyPivot - weeklyLow
    weeklyS1 = 2*weeklyPivot - weeklyHigh
    weeklyR2 = weeklyPivot + (weeklyHigh - weeklyLow)
    weeklyS2 = weeklyPivot - (weeklyHigh - weeklyLow)
    weeklyR3 = weeklyR1 + (weeklyHigh - weeklyLow)
    weeklyS3 = weeklyS1 - (weeklyHigh - weeklyLow)
    Endif
    
    If Month<>Month[1] then
    monthlyHigh = Highest[BarIndex - lastMonthBarIndex](High)[1]
    monthlyLow = Lowest[BarIndex - lastMonthBarIndex](Low)[1]
    lastMonthBarIndex = BarIndex
    If mode = 0 then
    monthlyPivot = (monthlyHigh + monthlyLow + Close[1]) / 3
    Elsif mode = 1 then
    monthlyPivot = (Open + monthlyHigh + monthlyLow + Close[1]) / 4
    Elsif mode = 2 then
    monthlyPivot = (monthlyHigh + monthlyLow + Close[1]*2) / 4
    Else
    monthlyPivot = (Open*2 + monthlyHigh + monthlyLow) / 4
    Endif
    monthlyR1 = 2*monthlyPivot - monthlyLow
    monthlyS1 = 2*monthlyPivot - monthlyHigh
    monthlyR2 = monthlyPivot + (monthlyHigh - monthlyLow)
    monthlyS2 = monthlyPivot - (monthlyHigh - monthlyLow)
    monthlyR3 = monthlyR1 + (monthlyHigh - monthlyLow)
    monthlyS3 = monthlyS1 - (monthlyHigh - monthlyLow)
    Endif
    
    If (hour mod 4 = 1) then
    hourlyHigh = Highest[BarIndex - lastHourBarIndex](High)[1]
    hourlyLow = Lowest[BarIndex - lastHourBarIndex](Low)[1]
    lastHourBarIndex = BarIndex
    If mode = 0 then
    hourlyPivot = (hourlyHigh + hourlyLow + Close[1]) / 3
    Elsif mode = 1 then
    hourlyPivot = (Open + hourlyHigh + hourlyLow + Close[1]) / 4
    Elsif mode = 2 then
    hourlyPivot = (hourlyHigh + hourlyLow + Close[1]*2) / 4
    Else
    hourlyPivot = (Open*2 + hourlyHigh + hourlyLow) / 4
    Endif
    hourlyR1 = 2*hourlyPivot - hourlyLow
    hourlyS1 = 2*hourlyPivot - hourlyHigh
    hourlyR2 = hourlyPivot + (hourlyHigh - hourlyLow)
    hourlyS2 = hourlyPivot - (hourlyHigh - hourlyLow)
    hourlyR3 = hourlyR1 + (hourlyHigh - hourlyLow)
    hourlyS3 = hourlyS1 - (hourlyHigh - hourlyLow)
    Endif
     
    Return dailyPivot coloured(255,0,0) as "dP", dailyR1 coloured(255,0,0) as "dR1", dailyS1 coloured(255,0,0) as "dS1", dailyR2 coloured(255,0,0) as "dR2", dailyS2 coloured(255,0,0) as "dS2", dailyR3 coloured(255,0,0) as "dR3", dailyS3 coloured(255,0,0) as "dS3", weeklyPivot coloured(0,255,0) as "wP", weeklyR1 coloured(0,255,0) as "wR1", weeklyS1 coloured(0,255,0) as "wS1", weeklyR2 coloured(0,255,0) as "wR2", weeklyS2 coloured(0,255,0) as "wS2", weeklyR3 coloured(0,255,0) as "wR3", weeklyS3 coloured(0,255,0) as "wS3", monthlyPivot coloured(0,0,255) as "mP", monthlyR1 coloured(0,0,255) as "mR1", monthlyS1 coloured(0,0,255) as "mS1", monthlyR2 coloured(0,0,255) as "mR2", monthlyS2 coloured(0,0,255) as "mS2", monthlyR3 coloured(0,0,255) as "mR3", monthlyS3 coloured(0,0,255) as "mS3", hourlyPivot coloured("Fuchsia") as "hP", hourlyR1 coloured("Fuchsia") as "hR1", hourlyS1 coloured("Fuchsia") as "hS1", hourlyR2 coloured("Fuchsia") as "hR2", hourlyS2 coloured("Fuchsia") as "hS2", hourlyR3 coloured("Fuchsia") as "hR3", hourlyS3 coloured("Fuchsia") as "hS3"
    Iván González thanked this post
    myPivoys.itf
    #247237 quote
    phil3034
    Participant
    Junior

    Merci Roberto pour votre retour et cette proposition. J’ai essayé mais ca ne donne pas du tout les meme niveaux. Peut etre parce que nous sommes le we ?

    merci a vous,

    #247257 quote
    phil3034
    Participant
    Junior

    Bonjour,

     

    En fait cf le screenshot ci dessous, dans un premier temps je n’ai regardé que les points pivots journaliers sur MNQ :

    -> le point pivot n’est pas le meme : c’est la ligne rouge qui est calculée par ton programme et les lignes bleues sont celles de PRT (reglé en standard)
    -> je ne sais pas pourquoi mais le point pivot se calcule a 7 h du matin ce qui explique sans doute l’écart

    Peut etre avez vous une idée?

    bien a vous,

    Capture-decran-2025-05-18-a-09.39.23.png Capture-decran-2025-05-18-a-09.39.23.png
    #247265 quote
    robertogozzi
    Moderator
    Master

    Certains instruments financiers, notamment non européens, ont des horaires différents.
    Apparemment, le nouveau jour commence à 07h00, cela pourrait être une cause.

    #247273 quote
    phil3034
    Participant
    Junior

    merci pour votre retour. Mais PRT n’est pas calé la dessus lui d’ou les lignes de points pivots qui ne sont pas sur les meme points. Comment pourrais arranger cela selon vous ? merci !

    #247738 quote
    LucasBest
    Participant
    Average

    Une erreur ligne 65 ?

    If DayOfWeek<>DayOfWeek[1] then // n'y a t'il pas une erreur dans cette ligne ?
    //N'importe quel nouveau jour de la semaine et le code pense que l'on change de semaine
    
    If DayOfWeek<DayOfWeek[1] then //Retour au 1er jour de la semaine = changement de semaine
    #248206 quote
    LucasBest
    Participant
    Average

    Pivots jour et hebdo identiques à ceux de PRT

    if OpenTime=010000 and dayofweek=1 then
    WeekHigh = High
    WeekLow = Low
    WeekClose = Close
    endif
    
    IF (OpenTime=010000 and dayofweek<>1) or (dayofweek<dayofweek[1]) THEN
    
    IF dayofweek <> 1 or dayofweek<DAYOFWEEK[1] THEN
    
    WeekHigh = Max(WeekHigh, DHigh(1))
    WeekLow = Min(WeekLow, DLow(1))
    WeekClose = DClose(1)
    
    PivotDuJour  = (DHigh(1) + DLow(1) + DClose(1)) / 3
    Elsif dayofweek = 1 and dayofweek=dayofweek[1] then
    
    WeekHigh = Max(WeekHigh, DHigh(2))
    WeekLow = Min(WeekLow, DLow(2))
    WeekClose = DClose(2)
    
    PivotDuJour  = (DHigh(2) + DLow(2) + DClose(2)) / 3
    endif
    
    if dayofweek<dayofweek[1] then
    
    PivotHebdo  = (WeekHigh+WeekLow+WeekClose)/3
    endif
    endif
    
    Return PivotDuJour coloured'"blue",200), PivotHebdo coloured("red",200) 
    phil3034 thanked this post
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

programme de calcul des points pivots


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
phil3034 @phil3034 Participant
Summary

This topic contains 7 replies,
has 3 voices, and was last updated by LucasBest
8 months, 3 weeks ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 05/13/2025
Status: Active
Attachments: 2 files
Logo Logo
Loading...