4 Hr Pivot on Intraday Timeframe

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #196351 quote
    oyinloyea
    Participant
    Veteran

    I will like to code 4 Hr Pivot on Intraday Timeframe. Please help

    #196362 quote
    oyinloyea
    Participant
    Veteran

    Thanks in advance

    #196366 quote
    robertogozzi
    Moderator
    Master

    There you go:

    // Pivot H4 intraday
    //
    Timeframe(4h,UpdateOnClose)
    //
    // Pivot H4
    //
    Pivot = (high + low + close)/3
    //
    Res1  = 2*((high + low + close)/3) - low
    Res2  = (high + low + close)/3+(high-low)
    Res3  = high+2*((high + low + close)/3-low)
    //
    Sup1  = 2*((high + low + close)/3) - high
    Sup2  = (high + low + close)/3-(high-low)
    Sup3  = high+2*(((high + low + close)/3)-low)
    //
    MidR1 = (3*((high + low + close)/3)-low)/2
    MidR2 = 3*(((high + low + close)/3)+high)/2-low
    MidR3 = high+3*(((high + low + close)/3)-low)/2
    //
    MidS1 = (3*((high + low + close)/3)-high)/2
    MidS2 = 3*(((high + low + close)/3)-low)/2-high
    MidS3 = low+3*(((high + low + close)/3)-high)/2
    //
    Timeframe(default)
    //
    RETURN Pivot AS "Pivot H4",Res1 AS "Res1 H4",Res2 AS "Res2 H4",Res2 AS "Res3 H4",Sup1 AS "Sup1 H4",Sup2 AS "Sup2 H4",Sup3 AS "Sup3 H4",MidR1 AS "MidR1 H4",MidR2 AS "MidR2 H4",MidR3 AS "MidR3 H4",MidS1 AS "MidS1 H4",MidS2 AS "MidS2 H4",MidS3 AS "MidS3 H4"
    oyinloyea thanked this post
    #196383 quote
    oyinloyea
    Participant
    Veteran

    Thanks a million

     

    Regards

    #196393 quote
    oyinloyea
    Participant
    Veteran

    I will like to put labels on the chart

    I realise that i cant add the label because of the update on close statement

    I am using

    drawtext(“Res1”,barindex,Res1+Voffset,SansSerif,Bold,15)
    drawtext(“Res2”,barindex,Res2+Voffset,SansSerif,Bold,15)
    drawtext(“Res3”,barindex,Res3+Voffset,SansSerif,Bold,15) and

    DRAWSEGMENT(barindex, Res1, barindex+10, Res1)
    DRAWSEGMENT(barindex, Res2, barindex+10, Res2)
    DRAWSEGMENT(barindex, Res3, barindex+10, Res3)

     

    Is there a workaround?

    Thanks

    #196405 quote
    druby
    Participant
    New

    Hi, the code additions put fixed text labels at the current bar location. Also while checking I came across a few gremlins which I think I’ve corrected on original lines 15,18,22 and 27.

    I’m curious, why your not using the stock pivot point indicator set to 4 hours.

    // Pivot H4 intraday
    //
    Timeframe(4h,UpdateOnClose)
    //
    // Pivot H4
    //
    Pivot = (high + low + close)/3
    //
    Res1  = 2*((high + low + close)/3) - low
    Res2  = (high + low + close)/3+(high-low)
    Res3  = high+2*((high + low + close)/3-low)
    //
    Sup1  = 2*((high + low + close)/3) - high
    Sup2  = (high + low + close)/3-(high-low)
    Sup3  = low+2*(((high + low + close)/3)-high)
    //
    MidR1 = (3*((high + low + close)/3)-low)/2
    MidR2 = (3*((high + low + close)/3)+high)/2-low
    MidR3 = high+3*(((high + low + close)/3)-low)/2
    //
    MidS1 = (3*((high + low + close)/3)-high)/2
    MidS2 = (3*((high + low + close)/3)+low)/2-high
    MidS3 = low+3*(((high + low + close)/3)-high)/2
    //
    Timeframe(default)
    
    if isLastBarUpdate then
     
    Drawtext("  Piv H4",-20,Pivot+2) Anchor(topRight,xShift,value) Coloured(0,0,0,255)
    
    Drawtext("   R1 H4",-20,Res1+2) Anchor(topRight,xShift,value) Coloured(255,0,0,255) 
    Drawtext("   R2 H4",-20,Res2+2) Anchor(topRight,xShift,value) Coloured(255,0,0,255)
    Drawtext("   R3 H4",-20,Res3+2) Anchor(topRight,xShift,value) Coloured(255,0,0,255)
    
    Drawtext("   S1 H4",-20,Sup1+2) Anchor(topRight,xShift,value) Coloured(0,128,0,255)
    Drawtext("   S2 H4",-20,Sup2+2) Anchor(topRight,xShift,value) Coloured(0,128,0,255)
    Drawtext("   S3 H4",-20,Sup3+2) Anchor(topRight,xShift,value) Coloured(0,128,0,255)
    
    Drawtext("mR1 H4",-20,MidR1+2) Anchor(topRight,xShift,value) Coloured(255,0,0,255)
    Drawtext("mR2 H4",-20,MidR2+2) Anchor(topRight,xShift,value) Coloured(255,0,0,255)
    Drawtext("mR3 H4",-20,MidR3+2) Anchor(topRight,xShift,value) Coloured(255,0,0,255)
    
    Drawtext("mS1 H4",-20,MidS1+2) Anchor(topRight,xShift,value) Coloured(0,128,0,255)
    Drawtext("mS2 H4",-20,MidS2+2) Anchor(topRight,xShift,value) Coloured(0,128,0,255)
    Drawtext("mS3 H4",-20,MidS3+2) Anchor(topRight,xShift,value) Coloured(0,128,0,255)
    endif
    
    //
    RETURN Pivot AS "Pivot H4",Res1 AS "Res1 H4",Res2 AS "Res2 H4",Res3 AS "Res3 H4",Sup1 AS "Sup1 H4",Sup2 AS "Sup2 H4",Sup3 AS "Sup3 H4",MidR1 AS "MidR1 H4",MidR2 AS "MidR2 H4",MidR3 AS "MidR3 H4",MidS1 AS "MidS1 H4",MidS2 AS "MidS2 H4",MidS3 AS "MidS3 H4"
    robertogozzi and oyinloyea thanked this post
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

4 Hr Pivot on Intraday Timeframe


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
oyinloyea @oyinloyea Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 06/29/2022
Status: Active
Attachments: 1 files
Logo Logo
Loading...