Stochastic over Spread

Hi Guys, i need to use an Stochastic %d over a composed Spread. I know we have some functions like RSIa for doing that with RSI but they are not avalible for Stochastic. So, how can we do that?

Best,

Take a look here

1 Like

Thanks Fxshrat! I'll try to do it as first link you posted.
Best,

What i have done is creating a simple spread for the AD line and apply an Stochastic for using like an ADn. I add at the end the Stochastic over the OHLC of chart ( Advance line) just for comparing purposes only. If something is wrong please comment. Symbols are based on IQ Feed Data:

_SECTION_BEGIN("ADn OSC NYSE OVER TICKET DTN IQFEED");
_N( SymbolY= ParamStr("SymbolY", "IIQD.Z") );

SetForeign(SymbolY); //// ASSIGN OHLC VALUES DECLINE SYMBOL TO OHLC
OY = O;
HY = H;
LY = L;
CY = C;
VY = V;
RestorePriceArrays();	////RECOVER OHLC CHART (ADVANCE) Y CALCULATE SPREAD A/D

OP = O-OY;
HP = H-HY;
LP = L-LY;
CP = C-CY;

H = HP;
L = LP;
C = CP;

///CALCULATE AND PLOT STOCH WITH NEW SPREAD OHLC (ADVANCE/DECLINING)

periods = Param( "Periods", 15, 1, 200, 1 );
Ksmooth = Param( "%K avg", 3, 1, 200, 1 );
Dsmooth = Param( "%D avg", 3, 1, 200, 1 );
Plot( StochD( periods , Ksmooth, DSmooth ), _DEFAULT_NAME(), colorGreen, ParamStyle("Style") );

RestorePriceArrays();/// RECOVER CHART OHLC 

///CALULATE AND PLOT STOCH OF CHART (ADVANCE) FOR COMPARING 
periods = Param( "Periods", 15, 1, 200, 1 );
Ksmooth = Param( "%K avg", 3, 1, 200, 1 );
Dsmooth = Param( "%D avg", 3, 1, 200, 1 );
Plot( StochD( periods , Ksmooth, DSmooth ), _DEFAULT_NAME(), colorRed, ParamStyle("Style") );

_SECTION_END();