# Formula for identifying Stochastic Divergence

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
Posts: 8
Joined: 27 Jun 2009

### 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: 7380
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 996 times
Been thanked: 2110 times
if you can describe it, you can program it.

SP
Posts: 460
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 285 times

brodnicki steven
Posts: 407
Joined: 01 Jan 2008
Been thanked: 3 times
** Is the code available ? (or only for sale)

SP
Posts: 460
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 285 times
As he shows the complete code and all vars i replicated it watching the video. I am not sure if it is ok if i post my version here.

brodnicki steven
Posts: 407
Joined: 01 Jan 2008
Been thanked: 3 times
It should be ok to post to code, since the code is public info, being displayed on the video.

SP
Posts: 460
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 285 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: 7380
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 996 times
Been thanked: 2110 times
thankyou !

brodnicki steven
Posts: 407
Joined: 01 Jan 2008
Been thanked: 3 times
Thanks !!
That will save considerable time.
Now I wonder if it's more accurate at actually calling a turn using divergence, it does make more sense this way.

TJ
Posts: 7380
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 996 times
Been thanked: 2110 times
someone has posted all the codes in his blog.

I regret not saving the URL when I saw it,
because I did not think I would need them at that time.

SUPER
Posts: 633
Joined: 03 Mar 2007
Has thanked: 105 times
Been thanked: 81 times
SP,

Thanks for sharing, the tutorials are very useful.

One can buy easylanguage code for entire tutorial for \$49.95 at following link.