hackedtrade Posted July 10, 2015 Report Share Posted July 10, 2015 Hi Jerry, I was curious if you could share the code for the Parabolic SAR indicator that Medved Trader uses. I've been trying to duplicate it in Python referencing the online wiki page for the indicator as well as ohter sources, but it never seems to match up correctly with how Medved Trader displays it. If you don't want to share, then I understand - I figured I would at least ask. Thanks Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted July 10, 2015 Report Share Posted July 10, 2015 (Almost) none of our implementations will be secret, except ones that are not "public domain", in fact, almost all will be open code as soon as we do the custom indicator support (so that people can look at existing implementations to create their own). I will give you the algorithm in a bit. Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted July 10, 2015 Report Share Posted July 10, 2015 direction length - how many candle are in the current direction period Current Direction - can be up or down do this for each candle: if direction is up if candle high > intra high intra high = candle high increase step by step increment up to step max SAR = SAR + step * (intra high - SAR) if SAR > candle low // switch directions direction = down SAR = intra high step = step increment // initialize step intra low = intra high direction length = 0 else if direction length>=1 and SAR > low of one candle back SAR = low of one candle back else if direction length>=2 and SAR > low of two candles back SAR = low of two candles back else if direction is down if candle low < intra low intra low = candle low increase step by step increment up to step max SAR = SAR - step * (SAR - intra low) if SAR < candle high // switch directions direction = up SAR = intra low step = step increment // initialize step intra high = intra low direction length = 0 else if direction length>=1 and SAR < high of one candle back SAR = high of one candle back else if direction length>=2 and SAR < high of two candles back SAR = high of two candles back direction length = direction length + 1 Quote Link to comment Share on other sites More sharing options...
hackedtrade Posted July 10, 2015 Author Report Share Posted July 10, 2015 Mike - thanks for the explanation and sharing... this is extremely useful. Thanks! Quote Link to comment Share on other sites More sharing options...
hackedtrade Posted July 14, 2015 Author Report Share Posted July 14, 2015 what defines 'direction is up' or 'direction is down'? Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted July 14, 2015 Report Share Posted July 14, 2015 At the very start of the chart, you arbitrarily set the direction to up or down. Then, as you go through the algorithm for each subsequent candle, the direction either switches or stays the same. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.