Created
October 15, 2019 23:02
-
-
Save afifhusnul/43cb4fcc782c3be950a0d6f25d1b1b18 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_SECTION_BEGIN("MACD1"); | |
r1 = Param( "Fast avg", 12, 2, 200, 1 ); | |
r2 = Param( "Slow avg", 26, 2, 200, 1 ); | |
r3 = Param( "Signal avg", 9, 2, 200, 1 ); | |
Plot( ml = MACD(r1, r2), StrFormat(_SECTION_NAME()+"(%g,%g)", r1, r2), ParamColor("MACD color", colorBrightGreen ), ParamStyle("MACD style") ); | |
Plot( sl = Signal(r1,r2,r3), "Signal" + _PARAM_VALUES(), ParamColor("Signal color", colorRed ), ParamStyle("Signal style") ); | |
Plot( ml-sl, "MACD Histogram", ParamColor("Histogram color", colorBlack ), styleNoTitle | ParamStyle("Histogram style", styleHistogram | styleNoLabel, maskHistogram ) ); | |
Buy= Cross(ml , sl); | |
Sell= Cross( sl, ml); | |
// | |
//Buy= Signal()<MACD(); | |
//Sell= Signal()>MACD(); | |
PlotShapes( Buy * shapeUpArrow + Sell * shapeDownArrow, IIf( Buy, colorGreen, colorRed ) ); | |
_SECTION_END(); | |
_SECTION_BEGIN("macd with color"); | |
r1 = Param( "Fast avg", 12, 2, 200, 1 ); | |
r2 = Param( "Slow avg", 26, 2, 200, 1 ); | |
r3 = Param( "Signal avg", 9, 2, 200, 1 ); | |
ml = MACD(r1, r2); | |
sl = Signal(r1,r2,r3); | |
Hist = ml-sl; | |
MACUP = Hist > Ref(Hist,-1); | |
MACDN = Hist < Ref(Hist,-1); | |
BarColor = IIf(MACUP,colorGreen,IIf(MACDN,colorRed,colorblue )); | |
styleNoTitle | ParamStyle("Histogram style", styleHistogram | styleNoLabel,maskHistogram ); | |
Plot( Hist, "MACD Histogram", BarColor , styleHistogram | styleNoLabel ); | |
Plot(0, "0", colorcustom12 , styleNoLabel ); | |
_SECTION_END(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment