I have the below code. It works fine on a chart and plots as required on a low amount of bar showing e.g. 100 bars.
however, if I put this indicator into a watch list screener window, I need to 'Format Resolution (all instruments)' to a custom data range of 300+ bars back! Or else I get the 'Not Enough Data' error.
I specifically want to show the value of Plot 5 (the Overbought or Oversold text) against any stock I put in the watch list.
Am I missing something obvious!?!
Why does this indicator need so many bars back to give me a value in a Watchlist screen, when the calculations only need a few bars to calculate and it works fine on a chart????
thank you so much for any time and help,
Kindest Regards,
KJ
Code: Select all
inputs:
BollingerPrice( Close ),
TestHighPrice( High ),
TestLowPrice( Low ),
Length( 21 ),
NumDevsDn( 3 ),
RSIPrice (Close),
RSILen (14),
RSIOverbought(70),
RSIOversold(30),
PriceH( High ),
PriceL( Low ),
PriceC( Close ),
StochLength( 14 ),
SmoothingLength1( 3 ),
SmoothingLength2( 3 ),
SmoothingType( 1 ),
StoOverSold( 20 ),
StoOverBought( 80 ) ;
variables:
TopBollingerValue( 0 ) ,
BottomBollingerValue( 0 ),
RSIValue (0) ,
StochasticValue (0),
var0( 0 ),
var1( 0 ),
var2( 0 ),
var3( 0 ) ;
TopBollingerValue = BollingerBand( BollingerPrice, Length, NumDevsDn ) ;
BottomBollingerValue= BollingerBand( BollingerPrice, Length, -NumDevsDn ) ;
RSIValue = RSI(RSIPRice,RSILen);
Value1 = Stochastic( PriceH, PriceL, PriceC, StochLength, SmoothingLength1, SmoothingLength2, SmoothingType, var0, var1, var2, var3 ) ;
StochasticValue = var3 ;
condition1 = TestHighPrice> TopBollingerValue ;
condition2 = TestLowPrice< BottomBollingerValue ;
Condition3 = RSIValue > RSIOverbought;
Condition4 = RSIValue < RSIOversold;
condition5 = StochasticValue > StoOverBought;
condition6 = StochasticValue < StoOverSold;
if condition1 and condition3 and condition5 then
begin
PlotPaintBar (high, low, open, close,"");
plot5("Overbought");
end
else
if condition2 and condition4 and condition6 then
begin
PlotPaintBar (high, low, open, close,"");
plot5("Oversold");
end
else
plot5("");