Single candle color change

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #120371 quote
    Stocks008
    Participant
    Average

    Good day,

    I need some assistance coding a candle a different color after breakout of an indicator.

    Criteria:

    When price crosses over supertrend 3,10 then the 6th candle should be black unless it crossed back over again.

    thank you,

    kind regards,

    #120380 quote
    robertogozzi
    Moderator
    Master

    Try this (not tested):
    [scode]
    ONCE Count = 0
    If Count > 0 then
    Count = Count + 1
    Endif
    MyST = SuperTrend[3,10]
    If Close crosses over MyST Then
    Count = 1
    Endif
    If Count = 6 Then
    Count = 0
    Drawcandle(open,high,low,close) coloured(0,0,0,255) bordercolor(0,0,0,255)
    Endif
    [/scode]
    If you want to clear Count even when there is a crossunder, then place these lines after line 5:
    [scode]
    If Close crosses Under MyST Then
    Count = 0
    Endif
    [/scode]

    Stocks008 thanked this post
    #120382 quote
    robertogozzi
    Moderator
    Master

    You need to append this line at the end:
    [scode]
    Return
    [/scode]

    Stocks008 thanked this post
    #120522 quote
    Stocks008
    Participant
    Average

    Thank you so much, I appreciate it 🙂

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

Single candle color change


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Stocks008 @jd008 Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by Stocks008
5 years, 11 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 02/25/2020
Status: Active
Attachments: No files
Logo Logo
Loading...