Hey Pete,
I’ve been trying to get a stochasticslow indicator for daily time frame to work on my 15min chart. Ive been playing with using data2 in the code to display the daily chart data that I have open within my 15min chart. I’ve been succsessful at manipulating other indicators this way but have no luck with stochastic. I have attached the code below but the only thing I havechanged is adding data 2 to high low and close. Please help. Thanks!
inputs:
PriceH( High data2) [DisplayName = “PriceH”, ToolTip =
“Price High. Enter the High value to use in the Stochastics calculations.”],
PriceL( Low data2) [DisplayName = “PriceL”, ToolTip =
“Price Low. Enter the Low value to use in the Stochastics calculations.”],
PriceC( Close data2) [DisplayName = “PriceC”, ToolTip =
“Price Close. Enter the current price value to use in the Stochastics calculations.”],
StochLength( 10 ) [DisplayName = “StochLength”, ToolTip =
“Stochastic Length. Enter the length used in the stochastic calculations.”],
SmoothingLength1( 3 ) [DisplayName = “SmoothingLength1”, ToolTip =
“Enter number of bars to use in the moving average of the FastK values.”],
SmoothingLength2( 10 ) [DisplayName = “SmoothingLength2”, ToolTip =
“Enter number of bars to use in the moving average of the FastD values.”],
SmoothingType( 1 ) [DisplayName = “SmoothingType”, ToolTip =
“Enter the smoothing type to use. Enter 1 for Original (simple average), 2 for Legacy (exponential smoothing).”],
OverSold( 20 ) [DisplayName = “OverSold”, ToolTip =
“Enter the level of the indicator at which you consider the market to be oversold (too low).”],
OverBought( 80 ) [DisplayName = “OverBought”, ToolTip =
“Enter the level of the indicator at which you consider the market to be overbought (too high).”] ;
variables:
ReturnValue( 0 ),
oFastK( 0 ),
oFastD( 0 ),
oSlowK( 0 ),
oSlowD( 0 ) ;
ReturnValue = Stochastic( PriceH , PriceL , PriceC , StochLength, SmoothingLength1,
SmoothingLength2, SmoothingType, oFastK, oFastD, oSlowK, oSlowD ) ;
Plot1( oSlowK, !( “SlowK” ) ) ;
Plot2( oSlowD, !( “SlowD” ) ) ;
Plot3( OverBought, !( “OverBot” ) ) ;
Plot4( OverSold, !( “OverSld” ) ) ;
{ alert criteria }
if AlertEnabled and CurrentBar > 2 then
begin
{ CB > 2 check used to avoid spurious cross confirmation at CB = 2
(at CB = 1, MySlowK and MySlowD will be the same) }
if oSlowK crosses over oSlowD and oSlowK < OverSold then
Alert( !( “SlowK crossing over SlowD” ) )
else if oSlowK crosses under oSlowD and oSlowK > OverBought then
Alert( !( “SlowK crossing under SlowD” ) ) ;
end ;
Like this:
Like Loading...