What's wrong in my code?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #5673 quote
    rainerb
    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
    Nicolas
    Keymaster
    Master

    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.

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

What's wrong in my code?


ProBuilder support

New Reply
Author
author-avatar
rainerb @rainerb Participant
Summary

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

Topic Details
Forum: ProBuilder support
Language: English
Started: 04/19/2016
Status: Active
Attachments: No files
Logo Logo
Loading...