Same high/low as previous candle

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #180033 quote
    magikern
    Participant
    New

    Hello, I do not know how to code at all and I have tried around a little. I think it’s a relativly easy indicator to write, but I can’t figure out how.

    What I want is the indicator to do is:

    if 2 candles that are next to eachother have the same high, change the candle colour of the second/or both candles  to R67 G140 B166

    and if 2 candles that are next to eachother have the same low, change the candle colour of the second/ or both candles R124 G55 B203

     

    I have made it work on tradingview with this code if that helps in any way.

    barcolor((high == high[1] ) ? color.navy : na)
    barcolor((low == low[1] ) ? color.black: na)
    plot (close)

    #180034 quote
    JC_Bywan
    Moderator
    Master

    Hello, and welcome on PRC forums,

    you need to use the drawcandle command, as code is progressing through loaded history you can color your second candle at each occurence this way:

    if high=high[1] then
     DRAWCANDLE(open, high, low, close) coloured(67,140,166)
    endif
    if low=low[1] then
     DRAWCANDLE(open, high, low, close) coloured(124,55,203)
    endif
    
    return

    You then need to validate this code first as a created indicator below the price window.

    Once this is done, the indicator becomes available in your list of available custom indicators that can be added to price, and this can be done this way:

    https://www.prorealcode.com/blog/video-tutorials/how-to-add-an-indicator-on-price-prorealtime/

    magikern thanked this post
    #180038 quote
    magikern
    Participant
    New

    Thanks you so much, this is exactly what I wanted!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Same high/low as previous candle


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
magikern @magikern Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 10/20/2021
Status: Active
Attachments: No files
Logo Logo
Loading...