Average rise and fall of next candle

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #105341 quote
    Vonasi
    Moderator
    Master

    I wrote an indicator to analyse the average rise and fall from an opening price of every candle and to see how often that average rise and fall is broken by the high or low of a candle.

    The indicator returns the average rise and fall of every candle as well as the average rise and fall after a red candle or after a green candle. It also returns how often in percentage after a red or green candle that average rise or fall was exceeded in the next candle.

    I post it here just in case it is of any interest to someone.

    //Average rise and fall breakout analysis
    //By Vonasi
    //20190822
    
    up = up + (high - open)
    down = down + (open - low)
    count = count + 1
    
    upave = up/count
    downave = down/count
    
    if close[1] < open[1] then
    rup = rup + (high - open)
    rdown = rdown + (open - low)
    rcount = rcount + 1
    
    rupave = rup/rcount
    rdownave = rdown/rcount
    endif
    
    if close[1] > open[1] then
    gup = gup + (high - open)
    gdown = gdown + (open - low)
    gcount = gcount + 1
    
    gupave = gup/gcount
    gdownave = gdown/gcount
    endif
    
    if barindex > 1 then
    if close[1] < open[1] then
    upper = open + rupave[1]
    lower = open - rdownave[1]
    if high > upper then
    rupbreak = rupbreak + 1
    endif
    if low < lower then
    rdownbreak = rdownbreak + 1
    endif
    rbreakcount = rbreakcount + 1
    rbreakupave = (rupbreak/rbreakcount) * 100
    rbreakdownave = (rdownbreak/rbreakcount) * 100
    endif
    
    if close[1] > open[1] then
    upper = open + gupave[1]
    lower = open - gdownave[1]
    if high > upper then
    gupbreak = gupbreak + 1
    endif
    if low < lower then
    gdownbreak = gdownbreak + 1
    endif
    gbreakcount = gbreakcount + 1
    gbreakupave = (gupbreak/gbreakcount) * 100
    gbreakdownave = (gdownbreak/gbreakcount) * 100
    endif
    endif
     
    return rbreakupave as "red break up %", gbreakupave as "green break up %", rbreakdownave as "red break down %", gbreakdownave as "green break down %",upave as "Average Rise", downave as "Average Fall", rupave as "Red Average Rise", rdownave as "Red Average Fall", gupave as "Green Average Rise", gdownave as "Green Average Fall"//upper as "upper", lower as "lower"
    Screenshot_2-1.png Screenshot_2-1.png
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

Average rise and fall of next candle


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Vonasi @vonasi Moderator
Summary

This topic contains 1 voice and has 0 replies.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 08/22/2019
Status: Active
Attachments: 1 files
Logo Logo
Loading...