Solar Wind Indicator

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #247798 quote
    efahmyefahmy
    Participant
    Average
    // Solar Wind Indicator for ProRealTime
    
    // --- Parameter ---
    period = 50
    
    // --- Persistent state ---
    once VL1 = 0
    once fish1 = 0
    
    for i = 0 to BarIndex do
    hh = highest[period](high)[i]
    ll = lowest[period](low)[i]
    denom = hh - ll
    
    PC = (high[i] + low[i]) / 2
    
    if denom <> 0 then
    tempVal = ((PC - ll) / denom) - 0.5
    VL = 0.33 * 2 * tempVal + 0.67 * VL1
    else
    VL = VL1
    endif
    
    VL = min(max(VL, -0.999), 0.999)
    fish = 0.5 * log((1 + VL) / (1 - VL)) + 0.5 * fish1
    
    VL1 = VL
    fish1 = fish
    
    if i > 0 then
    prev = fish[1]
    if (fish < 0 and prev > 0) or fish < 0 then
    up = 0
    elsif (fish > 0 and prev < 0) or fish > 0 then
    up = 1
    endif
    else
    up = 1
    endif
    
    if up then
    histoGreen = fish
    histoRed = 0
    else
    histoGreen = 0
    histoRed = fish
    endif
    next
    
    // --- Draw colored histograms ---
    HISTOGRAM(histoGreen) COLOURED(0,255,0) // Green bars
    HISTOGRAM(histoRed) COLOURED(255,0,0)   // Red bars
    
    return close
    

    there are errors in line 51 and 52, could anyone help in fixing that

    #247799 quote
    JSJS
    Participant
    Master

    Try this:

    Return Close, HistoGreen as “HistoGreen” Coloured(“Green”) Style(Histogram), HistoRed as “HistoRed” Coloured(“Red”) Style(Histogram)

    robertogozzi thanked this post
    #247800 quote
    efahmyefahmy
    Participant
    Average

    I tried, it seems your line is correct, but still the histogram does not appear, could you please check the whole code

    #247801 quote
    JSJS
    Participant
    Master

    It seems that “HistoRed” is always equal to zero…

    Scherm­afbeelding-2025-06-02-om-13.17.00.jpg Scherm­afbeelding-2025-06-02-om-13.17.00.jpg
    #247803 quote
    JSJS
    Participant
    Master

    Also check the settings of the indicator (style=Histogram)… (see screenshot)

    Iván González thanked this post
    Scherm­afbeelding-2025-06-02-om-13.20.55.png Scherm­afbeelding-2025-06-02-om-13.20.55.png
Viewing 5 posts - 1 through 5 (of 5 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

Solar Wind Indicator


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
efahmy @efahmy Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by JSJS
1 year, 3 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 06/02/2025
Status: Active
Attachments: 2 files
ProRealCode ProRealCode
Loading...