Formula for identifying Stochastic Divergence
Formula for identifying Stochastic Divergence
I am new to MultiCharts and don't yet understand the programming language at all. But, I'm wondering if anyone is aware of an exiting study that will spot Stochastic divergences.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
-
- Posts: 407
- Joined: 01 Jan 2008
- Been thanked: 3 times
-
- Posts: 407
- Joined: 01 Jan 2008
- Been thanked: 3 times
Code: Select all
// http://markplex.com/tutorial26.php
Inputs : PriceL(Low),StochLength(7),SmoothingLength1(3),SmoothingLength2(3),SmoothingType(1),
Length(20),LeftStrength(3),RightStrength(1),BarTol(3);
vars: ofastk(0),oFastD(0),oSlowk(0),oSlowD(0),oPivotPrice1(0),oPivotBar1(0),oPivotPrice2(0),oPivotBar2(0),
oPivotPrice3(0),oPivotBar3(0),oPivotPrice4(0),oPivotBar4(0);
Value1=Stochastic(H,L,C,StochLength,SmoothingLength1,SmoothingLength2,SmoothingType,ofastk,ofastd,oslowk,oslowd);
//Determine if pivots in the price have occurred
Condition3 = Pivot(PriceL,Length,LeftStrength,RightStrength,1,-1,oPivotPrice3,oPivotBar3)<>-1;
Condition4 = Pivot(PriceL,Length,LeftStrength,RightStrength,2,-1,oPivotPrice4,oPivotBar4)<>-1;
//Determine if pivots in the stochstic have occurred
Condition1 = Pivot(oslowd,Length,LeftStrength,RightStrength,1,-1,oPivotPrice1,oPivotBar1)<>-1;
Condition2 = Pivot(oslowd,Length,LeftStrength,RightStrength,2,-1,oPivotPrice2,oPivotBar2)<>-1;
if condition3 and condition4 and condition1 and condition2
and (absvalue(oPivotbar1-oPivotBar3)<BarTol)
and (absvalue(oPivotbar2-oPivotBar4)<BarTol)
and (oPivotBar3 = RightStrength or oPivotbar1 = RightStrength)
and (oPivotPrice3<=oPivotPrice4 and oPivotPrice1>oPivotPrice2) and barstatus(1)=2 then
begin
value2= tl_new_S(D[oPivotBar4],Time_S[oPivotBar4],L[oPivotBar4],D[oPivotBar3],Time_s[oPivotBar3],L[oPivotBar3]);
tl_setcolor(value2,Green);
tl_setsize (value2,3);
value3= tl_new_Self_s(D[oPivotBar1],Time_S[oPivotBar1],oPivotPrice1,D[oPivotBar2],Time_s[oPivotBar2],oPivotPrice2);
tl_setcolor(value3,Green);
tl_setsize (value3,3);
end;
Plot1(oSlowD);
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
-
- Posts: 407
- Joined: 01 Jan 2008
- Been thanked: 3 times
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times