MACD_Divergence
Click the file above to Download.
NOTE: For easy import into your charts, save to some where that you will be able to remember, for example your computer's desktop. Be sure to save using .alt as the file extension.
Copy to Clipboard //============================================================================ //MACD Divergence global lastCrossDownPrice=-1 global lastCrossDown=-1 global lastCrossUpPrice=-1 global lastCrossUp=-1 if isBeginBar() then lastCrossDownPrice=-1 lastCrossDown=-1 lastCrossUpPrice=-1 lastCrossUp=-1 endif if BarClosed() then if crossup(MACD[0](Close, 12, 26, 9), MACD_Signal[0](Close, 12, 26, 9)) then if close lastCrossUp then addbuyentry endif lastCrossUpPrice=close lastCrossUp= MACD_Signal[0](Close, 12, 26, 9) endif if crossdown(MACD[0](Close, 12, 26, 9), MACD_Signal[0](Close, 12, 26, 9))then if close>lastCrossDownPrice and lastCrossDownPrice>0 and MACD_Signal[0](Close, 12, 26, 9) < lastCrossDown then addsellentry endif lastCrossDownPrice=close lastCrossDown= MACD_Signal[0](Close, 12, 26, 9) endif endif
Enlarge Chart