Indicator not working

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

    Hello,

    The following indicator does not return any values.

    I want to build an indicator called “a” where each value is the one from the previous bar to which I add the price variation for the day multiplied (weighted) by the volume variation of the day.

    1. Why it does not work?
    2. How should the problem be fixed?

    Thank you in advance

     

    once a=close
    
    v=volume
    rv=v/v[1]
    
    p=close
    dp=p-p[1]
    
    a=a[1]+dp*rv
    
    return a
    #21092 quote
    NicolasNicolas
    Keymaster
    Legend

    Did you test your indicator on instrument that have Volumes?

    #21101 quote
    vsolervsoler
    Participant
    Junior

    Yes Nicolas,

    I attach a chart on Pepsico. My indicator is in the bottom window

    Captura.png Captura.png
    #21107 quote
    NicolasNicolas
    Keymaster
    Legend

    It should work with this modified code, like you did for the ‘a’ variable, giving only once the volume value to the ‘v’ one, fixed it. Because v[1] is not defined the first time the code is read, the calculation can’t complete itself and that’s why you didn’t get anything.

    once a=close
    once v=volume
    
    if barindex>2 then 
    v=volume
    rv=v/v[1]
    
    p=close
    dp=p-p[1]
    
    a=a[1]+dp*rv
    endif
    
    return a
    volume-and-close-indicator-fixed.png volume-and-close-indicator-fixed.png
Viewing 4 posts - 1 through 4 (of 4 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

Indicator not working


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
vsoler @vsoler Participant
Summary

This topic contains 3 replies,
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/14/2017
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...