Text Above Candles for Swing High and Swing Low

Viewing 15 posts - 1 through 15 (of 25 total)
  • Author
    Posts
  • #200627 quote
    Kole96
    Participant
    New

    Hello, i’m new here, can somobody help me to write a code to have the value of the Swing High and Low above or under the Candles?

    thank you

    #200628 quote
    JS
    Participant
    Senior
    Hi @Kole96

    How do you define a swing high and a swing low?

    #200630 quote
    Kole96
    Participant
    New
    Swing High H2<H1 and H<H1 Swing Low L2>L1 and L1<L
    #200638 quote
    JS
    Participant
    Senior
    Ok, and how do you define the value of the swing?
    #200639 quote
    Kole96
    Participant
    New
    Jsut want to have the value displayed of a Pivothighs and Pivotlows above or below the candle like we have it with some indicators in tradingview. they display a value in a box with the arrow
    #200642 quote
    JS
    Participant
    Senior

    Should it look something like this?

    (Here you only see the Swing High)

    #200645 quote
    Kole96
    Participant
    New
    Yes
    #200646 quote
    JS
    Participant
    Senior

    OK, nice.

    I’m going to try to finish the indicator tonight.

    #200647 quote
    Kole96
    Participant
    New
    Thank you
    #200655 quote
    JS
    Participant
    Senior
    xPeriod = 20
    
    If High[1] = Highest[xPeriod](High) and High[2] < High[1] and High < High[1] then
    SwingHigh = High[1]
    DrawArrowUP(BarIndex-1,High[1]+10) Coloured(0,255,0)
    DrawText("#SwingHigh#", BarIndex-1, High[1]+30,Dialog,Bold,15) Coloured(0,255,0)
    EndIf
    
    If Low[1] = Lowest[xPeriod](Low) and Low[2] > Low[1] and Low > Low[1] then
    SwingLow = Low[1]
    DrawArrowDown(BarIndex-1,Low[1]-10) Coloured(255,0,0)
    DrawText("#SwingLow#", BarIndex-1, Low[1]-30,Dialog,Bold,15) Coloured(255,0,0)
    EndIf
    
    Return
    
    Hi @Kole96

    Swing High:

    1. Find the Highest High over the past 20 periods (the period is adjustable).
    2. Check if the previous candle makes a lower High than the Highest High.
    3. Check if the next candle makes a lower High than the Highest High

    In principle, they are simple conditions that can possibly be extended with additional conditions for more adjacent candles. There are now three candles involved in a swing and you could expand this to, for example, 5 candles.

    Swing Low is the mirror image of Swing High

    Nicolas, robertogozzi and ZeroCafeine thanked this post
    #200660 quote
    Kole96
    Participant
    New
    Oh thank you so much
    JS and Nicolas thanked this post
    #200725 quote
    ZeroCafeine
    Participant
    Senior
    hi every one hi @JS I do some modification, but it’s just for learning and helping, what do you think about my code about : ù – Drawing button, do you think it’s a goods idea, do have some tips ? – about IF condition, I aded tomuch condition, do you think it’s more helper for prt CPU or more complicated this way ?
    // Atributs :
    OffsetArrow   = nOffsetA * pipsize
    OffsetText = nOffsetT * pipsize
    Pipi = pipsize
    
    // SwingHigh Condition
    C1 = High[1] = Highest[xPeriod](High) and High[2] < High[1] and High < High[1]
    // SwingLow Condition
    C2 = Low[1] = Lowest[xPeriod](Low) and Low[2] > Low[1] and Low > Low[1]
    
    IF C1 Then
    IF DrawingText Then
    DrawText("#SwingHigh#", BarIndex-1, High[1]+OffsetText,Dialog,Bold,15) Coloured(0,255,0)
    ENDIF
    IF DrawingArrow Then
    DrawArrowUP(BarIndex-1,High[1]+OffsetArrow) Coloured(0,255,0)
    ENDIF
    ENDIF
    
    IF C2 Then
    IF DrawingText Then
    DrawText("#SwingLow#", BarIndex-1, Low[1]-OffsetText,Dialog,Bold,15) Coloured(255,0,0)
    ENDIF
    IF DrawingArrow Then
    DrawArrowDown(BarIndex-1,Low[1]-OffsetArrow) Coloured(255,0,0)
    ENDIF
    ENDIF
    
    Return
    @Kole96 I hope this way with offset * pipsize will help you, tks to @robertogozzi he helped me one time with this tips
    robertogozzi and JS thanked this post
    #200727 quote
    ZeroCafeine
    Participant
    Senior
    other question, I just trayed to use this code on a Daily chat but with Weekly time frame, and I got all the text and the arrow only in the bigining of the chat, how to solve this problem ? I think we have to get the position of weekly candle for draw ?
    JS thanked this post
    #200733 quote
    robertogozzi
    Moderator
    Master
    At first glance I can’t find anything wrong.Try increasing the units up to 5K, or even more. You should post the ITF file, as some variables are missing, so I can test it thoroughly.
    ZeroCafeine thanked this post
    #200736 quote
    ZeroCafeine
    Participant
    Senior
    so this the ITF file “Temps – Swing High”, it’s working correctly like on the Photo 01 but this ITF file “Temps – Swing High Weekly” with the instruction in line one with TimeFrame (Weekly) on the Daily chart I have the Photo 02 :
    TimeFrame (Weekly)
    the Idea it’s just to use the idea of SwingHigh and SwingLow on a daily chart with weekly value
Viewing 15 posts - 1 through 15 (of 25 total)
  • You must be logged in to reply to this topic.

Text Above Candles for Swing High and Swing Low


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Kole96 @kole96 Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 09/12/2022
Status: Active
Attachments: 10 files
Logo Logo
Loading...