// 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
JSParticipant
Senior
Try this:
Return Close, HistoGreen as “HistoGreen” Coloured(“Green”) Style(Histogram), HistoRed as “HistoRed” Coloured(“Red”) Style(Histogram)
I tried, it seems your line is correct, but still the histogram does not appear, could you please check the whole code
JSParticipant
Senior
It seems that “HistoRed” is always equal to zero…
JSParticipant
Senior
Also check the settings of the indicator (style=Histogram)… (see screenshot)