Modify PRC_swing teller live count2 indicator

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #56230 quote
    Marcel van Vliet
    Participant
    Veteran

    Hi,

    Can anyone tell me how to modify the PRC_swing teller live count2 indicator in a way only the recent candle counting (from 1 to ….) is visible on the chart?  This will give the charts a ‘cleaner’ view.

    //PRC_swing teller live count2 | indicator
    //version with rounded numbers and below/above each candle
    //07.04.2017
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //https://www.prorealcode.com/topic/rewrite-code-to-prorealtime-code/
    
    Lb=4
    
    //continue swing Up
    if UpCount>0 and Close>Close[Lb] then
    DownCount=0
    UpCount=UpCount+1
    
    //draw count
    if UpCount=2 then
    drawtext("2",barindex,low-CountDistance*pointsize,Dialog,Standard,12) coloured(0,200,0)
    elsif UpCount=3 then
    drawtext("3",barindex,low-CountDistance*pointsize,Dialog,Standard,12) coloured(0,200,0)
    elsif UpCount=4 then
    drawtext("4",barindex,low-CountDistance*pointsize,Dialog,Standard,12) coloured(0,200,0)
    elsif UpCount=5 then
    drawtext("5",barindex,low-CountDistance*pointsize,Dialog,Standard,12) coloured(0,200,0)
    elsif UpCount=6 then
    drawtext("6",barindex,low-CountDistance*pointsize,Dialog,Standard,12) coloured(0,200,0)
    elsif UpCount=7 then
    drawtext("7",barindex,low-CountDistance*pointsize,Dialog,Standard,12) coloured(0,200,0)
    elsif UpCount=8 then
    drawtext("8",barindex,low-CountDistance*pointsize,Dialog,Standard,12) coloured(0,200,0)
    elsif UpCount=9 then
    drawtext("9",barindex,low-CountDistance*pointsize,Dialog,Standard,12) coloured(0,200,0)
    last9bar=barindex
    //reset count
    UpCount=0
    endif
    //up swing fail
    elsif UpCount>0 and Close<Close[Lb] then
    //draw fail count
    drawtext("F",barindex,low-CountDistance*pointsize,Dialog,Standard,12) coloured(0,200,0)
    //reset count
    UpCount=0
    endif
    
    //continue swing Down
    if DownCount>0 and Close<Close[Lb] then
    UpCount=0
    DownCount=DownCount+1
    
    //draw count
    if DownCount=2 then
    drawtext("2",barindex,high+CountDistance*pointsize,Dialog,Standard,12) coloured(200,0,0)
    elsif DownCount=3 then
    drawtext("3",barindex,high+CountDistance*pointsize,Dialog,Standard,12) coloured(200,0,0)
    elsif DownCount=4 then
    drawtext("4",barindex,high+CountDistance*pointsize,Dialog,Standard,12) coloured(200,0,0)
    elsif DownCount=5 then
    drawtext("5",barindex,high+CountDistance*pointsize,Dialog,Standard,12) coloured(200,0,0)
    elsif DownCount=6 then
    drawtext("6",barindex,high+CountDistance*pointsize,Dialog,Standard,12) coloured(200,0,0)
    elsif DownCount=7 then
    drawtext("7",barindex,high+CountDistance*pointsize,Dialog,Standard,12) coloured(200,0,0)
    elsif DownCount=8 then
    drawtext("8",barindex,high+CountDistance*pointsize,Dialog,Standard,12) coloured(200,0,0)
    elsif DownCount=9 then
    drawtext("9",barindex,high+CountDistance*pointsize,Dialog,Standard,12) coloured(200,0,0)
    last9bar=barindex
    //reset count
    DownCount=0
    endif
    //down swing fail
    elsif DownCount>0 and Close>Close[Lb] then
    //draw fail count
    drawtext("F",barindex,high+CountDistance*pointsize,Dialog,Standard,12) coloured(200,0,0)
    //reset count
    DownCount=0
    endif
    
    //begin swing Up
    if UpCount=0 and barindex-last9bar>1 then
    r = close[Lb]
    if close>r then
    UpCount=1
    DownCount=0
    //draw count
    drawtext("1",barindex,low-CountDistance*pointsize,Dialog,Standard,12) coloured(0,200,0)
    endif
    endif
    
    //begin swing Down
    if DownCount=0 and barindex-last9bar>1 then
    r = close[Lb]
    if close<r then
    DownCount=1
    UpCount=0
    //draw count
    drawtext("1",barindex,high+CountDistance*pointsize,Dialog,Standard,12) coloured(200,0,0)
    endif
    endif
    
    return
    
    #56248 quote
    AVT
    Participant
    Senior
    #56275 quote
    Marcel van Vliet
    Participant
    Veteran

    @AVT Thanks a lot. Is it possible to code this code in multiple (10) bars? It does not seems to work.

    My intention is that only the counted numbers on the last 10 candles are visible.

    DefParam[10}
    
    DefParam DrawOnLastBarOnly = true
    #56284 quote
    AVT
    Participant
    Senior

    I gave you the link. This is describing exactely how you write the code (you can even simply copy and paste it).

    Now for the explanation:

    1. DEFPARAM things always stand in the very beginning of the whole code page
    2. CalculateOnLastBars=x says, all what is calculated in the whole code page is only calculated with (the data of) the said x bars in our chart, be that a line or a range or whatever – means also be careful not make it too small (for example: you can not calculate an ema(200) if you limit calculation to 100 bars).

    So the code looks like this:

    //https://www.prorealcode.com/topic/rewrite-code-to-prorealtime-code/
    DEFPARAM CalculateOnLastBars = 10 // <=== added at the very beginning
    Lb=4
    

    Attached the result. Hope this is what you had in mind.

    Nicolas and Marcel van Vliet thanked this post
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Modify PRC_swing teller live count2 indicator


ProBuilder support

New Reply
Author
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by AVT
8 years, 1 month ago.

Topic Details
Forum: ProBuilder support
Language: English
Started: 12/21/2017
Status: Active
Attachments: 1 files
Logo Logo
Loading...