COUNT Candle Indicator

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #213472 quote
    ivan66
    Participant
    New

    Goodmorning, working with tick candles, I would like to ask if is possible to have an indicator that counts the number of the candles created every defined period of time (1 minute for example) and if is possible also how many are green and how many are red. Thanks and best regards, Ivan

    #213941 quote
    JC_Bywan
    Moderator
    Master

    Hi,

    To be added as a window below price, for all candles within 1 minute, with red as “negative histogram” in order to be more distinct from green count:

    if OpenMinute<>OpenMinute[1] or OpenHour<>OpenHour[1] then
    total=0
    red=0
    green=0
    flat=0
    endif
    if open>close then
    red=red+1
    elsif open<close then
    green=green+1
    elsif open=close then
    flat=flat+1
    endif
    total=total+1
    
    return total as "Total", -red coloured(255,0,0) style(histogram) as "Red", green coloured(0,150,0) style(histogram) as "Green", flat as "open=close"
    repropel thanked this post
    #230072 quote
    repropel
    Participant
    New

    Hello,

    Could you do the same code but instead of making it 10 minutes?

    Thank you.

    #230078 quote
    JC_Bywan
    Moderator
    Master

    Hello,

    Adapting the code to count on (x) ticks timeframes red and green candles for intervals of 10 minutes instead of 1:

    same10= floor(openminute/10)
    if same10<>same10[1] or OpenHour<>OpenHour[1] then // the openhour part is not unnecessary between same10=5 and same10=0 , it is there in case of ovn with 2 consecutive candles of same same10 minute category but for 2 different hours
    total=0
    red=0
    green=0
    flat=0
    endif
    if open>close then
    red=red+1
    elsif open<close then
    green=green+1
    elsif open=close then
    flat=flat+1
    endif
    total=total+1
    
    return total as "Total", -red coloured(255,0,0) style(histogram) as "Red", green coloured(0,150,0) style(histogram) as "Green", flat as "open=close"
    repropel thanked this post
    #230161 quote
    repropel
    Participant
    New

    Hello,

    It seemed like an incredible solution to me. I’ve tried it and it works perfectly.

    Thank you so much.

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

COUNT Candle Indicator


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
ivan66 @ivan66 Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by repropel
1 year, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/19/2023
Status: Active
Attachments: 1 files
Logo Logo
Loading...