Looking for Ulcer Index Source Code

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #145898 quote
    flightclock91flightclock91
    Participant
    Junior

    Hello, I am looking for the PRT  Ulcer Index Source Code?

    Appreciate any help thanks so much!

    #145905 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    There’s a strategy based on Ulcer Index at https://www.prorealcode.com/topic/ulcer-index-system/

    #146007 quote
    flightclock91flightclock91
    Participant
    Junior

    Hi,

    many thanks for the reply I used your code to build the ulcer index but for some reason I cant get the Ulcer Index to match the PRT one there are slight differences

    #146019 quote
    flightclock91flightclock91
    Participant
    Junior

    Here is a pic of the differences any ideas how to get them the same?

    Thanks a lot

    Ulcer-Index2.png Ulcer-Index2.png
    #146049 quote
    juanjjuanj
    Participant
    Master

    Try this (I coded this from memory so didn’t check syntax or result in PRT):

    N = 14
    PD = ((Close - highest[N](close))/highest[N](close))*100
    SquaredAverage = sqrt(summation[N](PD)/N)
    
    UlcerIndex = sqrt(SquaredAverage)
    
    #146068 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    @juanj

    Line 3 should read:

    SquaredAverage  = (summation[N](sqr(PD))/N)

    to replicate exactly PRT’s.

    #146078 quote
    juanjjuanj
    Participant
    Master

    Thanks Robertogozzi, here is the corrected assembled code @flightclock91 can use:

    N = 14
    PD = ((Close - highest[N](close))/highest[N](close))*100
    SquaredAverage  = (summation[N](sqr(PD))/N)
     
    UlcerIndex = sqrt(SquaredAverage)
    #146099 quote
    flightclock91flightclock91
    Participant
    Junior

    Thank you so much robertogozzi and juanj 

    You guys are legends have been stuck on this for a while

    #163933 quote
    MattiasMattias
    Participant
    Senior

    When used in a strategy, I couldn’t get this to work, I got error message probacktest.error.’sqr’. It worked fine in an indicator though. However, changing sqr to square did the trick.

    SquaredAverage  = (summation[N](square(PD))/N)
Viewing 9 posts - 1 through 9 (of 9 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

Looking for Ulcer Index Source Code


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 8 replies,
has 4 voices, and was last updated by MattiasMattias
5 years, 7 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 09/29/2020
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...