Demand Index not working anymore in version 11

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #114311 quote
    regusregus
    Participant
    Veteran

    The indicator Demand Index  programmed by Nicolas does not seem to function in V11.

    https://www.prorealcode.com/wp-content/uploads/2017/01/Demand-index.itf

    #114327 quote
    NicolasNicolas
    Keymaster
    Legend

    Here the code with a fix (indicator is not mine). I just added a condition to be sure there are enough bars loaded for the indicator to calculate:

    ///////////////////////////////////////////////////////
    /////////////SIBBET DEMAND INDEX////////////////
    //////////////////////////////////////////////////////
    
    //{Programmed by David Fenstemaker}
    //{Omega Code downloaded from}
    //{http://www.purebytes.com/archives/omega/2002/msg04345.html}
    //{converted to MS by wabbit here}
    //http://www.stator-afm.com/demand-index.html
    //tradotto per PRT da tetsuo
    //{04 April 2008}
    
    //creare la variabile len(11)
    
    len=11
    
    if barindex<=1 then
    
    volavg=volume
    else
    volavg=(volavg[1]*(len-1)+volume)/len
    endif
    
    if barindex>len then 
    wcl=(high+low+close+close)/4
    avgTR=average[len](highest[2](high)-lowest[2](low))
    
    If Wcl <> 0 and wcl[1] <> 0 and AvgTR <> 0 and VolAvg <> 0 then
    
    wtcratio=(wcl-wcl[1])/(min(wcl,wcl[1]))
    volratio=volume/volavg
    
    const2=((wcl*3)/avgtr)*abs(wtcratio)
    
    const=volratio/exp(min(const2,88))
    
    if wtcratio>0 then
    buypr=volratio
    sellpr=const
    
    else
    buypr=const
    sellpr=volratio
    endif
    
    buypress=(buypress[1]*(len-1)+buypr)/len
    sellpress=(sellpress[1]*(len-1)+sellpr)/len
    tempdi=1
    
    if sellpress>buypress then
    sign=-1
    else
    sign=1
    endif
    
    if sellpress>buypress then
    tempDI=sign*(buypress/sellpress)
    else
    tempDI=sign*(sellpress/buypress)
    endif
    
    if tempDI<0 then
    myDMI=100*(-1-tempDI)
    else
    myDMI=100*(1-tempDI)
    endif
    endif
    endif 
    
    return mydmi coloured(0,0,255) as "DEMAND INDEX", 0
    
    /////////////////////////FINE///////////////////////////
    
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

Demand Index not working anymore in version 11


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
regus @regus Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 12/06/2019
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...