Solar Wind Indicator

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #247798 quote
    efahmy
    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
    JS
    Participant
    Senior

    Try this:

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

    robertogozzi thanked this post
    #247800 quote
    efahmy
    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
    JS
    Participant
    Senior

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

    #247803 quote
    JS
    Participant
    Senior

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

    Iván González thanked this post
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

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 JS
8 months, 1 week ago.

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