Usage of the UNDEFINED keyword

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

    Hello everyone,

    I have programmed custom indicators for years, but I’m unable to use the UNDEFINED keyword.

    In order to learn how to use in its simplest form, I’ve created the following indicator

    if close>close[1] then
      a=1
    else
      a=undefined
    endif
    return a

    I would have expected the custom indicator to have returned One (1) if there is an increase in the closing price, or Zero (or unknown or error, but different from zero in any case) in any other case.

    My indicator always returns One(1)

    There must be something that I am missing. Could you please help me understand?

    Thank you in advance

    Vicente

    #20217 quote
    NicolasNicolas
    Keymaster
    Legend

    The “undefined” keyword can only be used one time in a prorealtime code. It’s mainly use to set a variable to “nothing” before giving it a value for the first time, but then you cannot revert the variable to nothing (undefined).

    So, the best you can do is set your variable to 0 if you don’t want to see it on your chart or your oscillator.

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

Usage of the UNDEFINED keyword


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/08/2017
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...