ET News & Sponsor Info
General Topics
Trading Instruments
Technical Topics
Brokerage Firms
Tools of the Trade
Trading for a Living
Community Lounge
Site Support

# Software to easily program divergences

Discussion in 'Technical Analysis' started by OpenSource, Jul 30, 2009.

1. ### OpenSource

Software packages have different strengths and weaknesses when it comes to programming. I was wondering which are some of the good software packages that are easy and accurate to program divergences? So, for instance, to programmicaly find divergence between price and RSI, etc.

Thanks.

2. ### circadian

I can't really recommend you to a software package, but I would say that you can get started using Excel and VBA. Pretty simple stuff, use some "if" statements to identify important swing highs/lows in price action, and do the same for your RSI or stochastic indicator.

Then just establish the divergence criterion as something like:

=if (and(previous price maxima <= most recent price maxima, previous stochastic maxima > most recent stochastic maxima, "Negative Divergence Present", (""))

Just reverse the function to find positive divergences.

The math for calculating stochs and RSI really isn't tough at all, and I think that everyone who uses indicator/rule based trading needs to know how to manually construct the indicators. It just helps one understand them that much more. I hope this helps.

3. ### Murray RuggieroVendor

Here the code for bearish divergence, pass this a Oscillator and it will return 1 when it finds divergence. This is code for TradersStudio. You can learn more about TradersStudio at www.TradersStudio.com

'*******************************************************************
'Description: Bearish Divergence
'********************************************************************
' TradersStudio(r) copyright 2004-2007 , All rights reserved
Function BearishDivergence(Price As BarArray, Oscillator As BarArray, Strength, Length) As BarArray
Dim Return
Dim Value1
Dim Value2
Dim Value3
Dim Value4
Dim Condition1
Dim Condition2

Return = 0
Value1 = 0
Value2 = 0
Value3 = 0
Value4 = 0
Condition1 = 0
Condition2 = 0

Value1 = -1
Value2 = -1
Value3 = -1
Value4 = -1
Return = 0
Value1 = SwingHighBar(1, Price, Strength, Length)
If Value1 > -1 Then
Value2 = SwingHighBar(2, Price, Strength, Length)
End If
If Value2 > -1 Then
Value3 = SwingHighBar(1, Oscillator, Strength, Length)
End If
If Value3 > -1 Then
Value4 = SwingHighBar(2, Oscillator, Strength, Length)
End If
If Value4 > -1 Then
Condition1 = Price[Value1] > Price[Value2]
Condition2 = Oscillator[Value3] < Oscillator[Value4]
If Condition1 And Condition2 Then
Return = 1
End If
End If
BearishDivergence = Return
End Function

ET IS FREE BECAUSE OF THE FINANCIAL SUPPORT FROM THESE COMPANIES:
 AMP Global Clearing Futures and FX Trading Collective2 Automated Trading Services EdgeAnalytix Options Mentorship & Signals IC Markets True ECN for FX and CFDs Jigsaw Trading Advanced Trading Tools Lightspeed Trading Equities & Options Trading NinjaTrader Trading Software & Brokerage Optimus Futures Futures Trading Platforms and Order Routing Option Workshop Option Analysis Software PTMC Full Multi-Asset Trading Platform Rithmic Futures Trade Execution Platform SpreadProfessor Spread Trading Instruction TD Ameritrade Get the #1 trading app in the App Store TopstepTrader We Fund Traders Trademetria Trade Logging & Analysis TradersStudio System Development Platform Trading Technologies Trading Software Provider Tradovate Commision-Free Futures Trading