Using ahead bars for calculating current bar indicator

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #20241 quote
    vsolervsoler
    Participant
    Junior

    Hello,

    I always thought that in ProRealTime I could not use the the values of bars of next week (d+5), next month (d+20) and so on, for calculating the current bar (d) of a calculated indicator.

    However, I am surprised to see that in the Darvas boxes indicator bellow, PRT is able to do so.

    In an uptrend ticker, the top-left corner of a box is derived from the highest value of a bar some days ahead. How can this be possible.

    Could you please explain the mechanism used?

    Thank you in advance

    Vicente

    k=48
    once tth=undefined
    once ttl=undefined
    n=(k*2)-4
    p=(n/2)-1
    
    h1=dpo[n](high)
    moyh=high-h1
    hi=(moyh-moyh[1]+(high[p])/n)*n
    hi=(round(hi*100))/100
    
    l1=dpo[n](low)
    moyl=low-l1
    lo=(moyl-moyl[1]+(low[p])/n)*n
    lo=(round(lo*100))/100
    
    low1=(round(low*100))/100
    high1=(round(high*100))/100
    
    if barindex > 100 then
    if box=1 and (high1>tth or low1<ttl) then
    box=0
    flag=0
    endif
    if box=0 and flag=0 and low1<=lo[46] and low1<=lo[45] and low1<=lo[44] then
    th=low1
    flag=1
    endif
    if box=0 and flag=1 then
    for zz=0 to 44
    if  lo[47-zz-1]<th or lo[47-zz-2]<th or lo[47-zz-3]<th then
    flag=0
    break
    endif
    if hi[47-zz]>hi[47-zz-1] and hi[47-zz]>hi[47-zz-2] and hi[47-zz]>hi[47-zz-3] then
    box=1
    ttl=th
    tth=hi[47-zz]
    break
    endif
    next
    endif
    else
    tth=undefined
    ttl=undefined
    endif
    
    if box=1 then
    ba=ttl
    else
    ba=tth
    endif
    
    return ba coloured by box-1, tth coloured by box-1, ttl coloured by box-1
    
    Darvas.png Darvas.png
    #20247 quote
    NicolasNicolas
    Keymaster
    Legend

    Because this indicator use DPO to know in advance the ahead bars of the price. DPO is known to use future prices, so in this case its values are reversed to get prices and use it in a different manner.

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Using ahead bars for calculating current bar indicator


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
vsoler @vsoler Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by NicolasNicolas
9 years, 8 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 01/09/2017
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...