What's wrong in my code?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #5673 quote
    rainerbrainerb
    Participant
    New

    what wrong in the code?

    n = 4
    h = highest[n]
    l = lowest[n]
    once b = 2
    v = h
    if h = high[n-1] and high[n-1] > high and high[n-1] > low and (b = 1 or b = 2 ) then
    v = h
    b = 0
    else
    if l = low[n-1] and low[n-1] < low and low[n-1] < high and ( b = 0 or b = 2 ) then
     v = l
     b = 1
    else
     v = v[1]
    endif
    endif
    return v
    #5683 quote
    NicolasNicolas
    Keymaster
    Legend

    Hello rainerd,

    You cannot use the letter “h” for a variable as it is reserved by the programming language.

    Also, on line 2 and 3, you must define the chosen price to look for the highest and lowest. I modified your code a bit, here it is:

    n = 4
    hh = highest[n](high)
    l = lowest[n](low)
    once b = 2
    v = hh
    
    if hh = high[n-1] and high[n-1] > high and high[n-1] > low and (b = 1 or b = 2 ) then
     v = hh
     b = 0
    else
    if l = low[n-1] and low[n-1] < low and low[n-1] < high and ( b = 0 or b = 2 ) then
     v = l
     b = 1
    else
     v = v[1]
    endif
    endif
    
    return v

     

    Please find attached what we get for your indicator.

    rainerb-indicator.png rainerb-indicator.png
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

What's wrong in my code?


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
rainerb @rainerb Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/19/2016
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...