midtownsk8rguy

Modified Stochastic MACD Oscillator - Vitali Apirine

For all MACD enthusiasts out there, hot off the press, I present this next generation "Modified Stochastic MACD Oscillator" employing PSv4.0, originally formulated by Vitali Apirine for TASC - November 2019 Traders Tips. Just when you may have thought it was the end of the evolutionary line for MACD technology, it's not! Basically it's a NEW hybridization of a MACD and stochastic rolled into one, maintaining scale symmetry to support overbought/oversold defined levels across time frames and assets, unlike the ordinary MACD . On the ordinary MACD , this is virtually impossible to do properly, and trust me, I have tried with zero success. My less than 40 line implementation, at initial release, is a heavily modified version of the original indicator using novel techniques, surpassing not only Apirine's original intended design, but also the "contemporary MACD" provided by TV, visible on the bottom of the chart.

Utilizing the "Power of Pine", I included the maximum amount of features I could surmise in an ultra small yet powerful package. I provided an abundance of control over each feature as an attempt to create another heavenly MACD experience in an open source package, only rivaled by my "Ultimate MACD Super Pack". Configurations are displayed above in multiple scenarios that should be suitable for most traders. Of notable mention, I rescaled the oscillator more towards a zero mean unity scale, while still leaving the waveforms completely intact.

Features List Includes:
Dark Background - Easily disabled in indicator Settings->Style for "Light" charts or with Pine commenting
AND much, much more... you have the source!

For those of you who are new to Pine Script, this script also may help you understand advanced programming techniques in Pine and how they may be utilized in a most effective manner. I would like to see Tradingview become the go to platform for the best MACD indicators attainable with this contribution to the TV community. This is commonly what my dense intricate code looks like behind the veil, and if you are wondering why there is no notes, that's because the notation is in the variable naming. If you wish to contribute additional ideas, please do so below in the comments about all things MACD in Pine.

NOTICE: Copy pasting bandits who may be having nefarious thoughts, DO NOT attempt this, because this may violate Tradingview's terms, conditions and/or house rules. "WE" are always watching the TV community vigilantly for mischievous behaviors and actions that exploit well intended authors for the purpose of unscrupulously increasing brownie points in reputation scores. Hiding behind a "protected" wall may not protect you from investigation and account penalization by TV staff. Be respectful, and don't just throw a meaningless feature in there branding it as "your" gizmo. Fair enough? Alrighty then... I firmly believe in "innovating" future state-of-the-art indicators, and please contact me if you wish to do so.

The comments section below is solely just for commenting and other remarks, ideas, compliments, etc... regarding only this indicator, not others. When available time provides itself, I will consider your inquiries, thoughts, and concepts presented below in the comments section if you do have any questions or comments regarding this indicator. When my indicators achieve more prevalent use by TV members , I may implement more ideas when they present themselves as worthy additions. As always, "Like" it if you simply just like it with a proper thumbs up, and also return to my scripts list occasionally for additional postings. Have a profitable future everyone!
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Comments

No worries. With this source code, you can edit it as you see fit in Pine Editor. You may replace some of the inputs() you don't need, coloring, ect... For example, wouldn't it be nice if we could color our own running shoes? The other possibility is evolving it into something better like taking a simple car and turning it into a flying car. MACD of the past had values wildly ranging from about 0.05 to 12.0 max depending on the asset, it's value, and time frame used. This version is predominantly between +/-2.0, which allows for levels and custom alertcondition()s for it's user. You may still use it as is, of course.

Think of it as the code is grain within a piece of Pine wood. You can knock out those knots you don't like, glue a grain oriented plug in, sand it smooth, and color it to your favorite shade of stain. You can make the grain look like what ever you want, too. If you wish to learn more about Pine Scripting here are some educational links to get you started:

Pine Script User Manual - https://www.tradingview.com/pine-script-docs/en/v4/index.html
Pine Reference - https://www.tradingview.com/pine-script-reference/v4/#fun_study
PineCoders resources - http://www.pinecoders.com/
+1 Reply
I'm new to this pine script and is trying to build a strategy that I can backtest. May I ask why you build a study and not a script. As I understand it is not possible to backtest a study script? So how do you know how profitable the study is when you can't backtest it?
Reply
midtownsk8rguy LasseHeggeland
@LasseHeggeland, This specific script, was a new form of MACD from TASC magazine last month. Yes, I could have created a strategy, but this script's purpose is for code dissemination in a simplistic form, for Tradingview's members to do what they wish with it. One potential scenario is the formation of a strategy, choosing strategy conditions they may devise and experiment with, which may entail filtering from another tandem indicator. I included visual logic that may be applicable to a strategy(), which may have long/short conditions varying in a thousand different ways. This may be converted from a study() to a strategy() if you wish to code it that way. If I did build a strategy() it wouldn't ONLY employ one indicator tethered to backtesting logic.
+1 Reply
Sorry for the ignorance, but how exactly do I use this code? 53 year old teacher trying to learn more. Thank you in advance for your time.
Reply
Ultranice! :)
Reply