Created
October 15, 2019 23:01
-
-
Save afifhusnul/2ddcffc3b733fc9e2a097827a4b22a67 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
SetChartOptions(0,chartShowArrows | chartShowDates); | |
HaClose = (O + H + L + C)/4; | |
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 ); | |
HaHigh = Max( H, Max( HaClose, HaOpen ) ); | |
HaLow = Min( L, Min( HaClose, HaOpen ) ); | |
xDiff = (HaHigh - Halow) * 10000; | |
barcolor = IIf(HaClose >= HaOpen,colorGreen,colorRed); | |
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "", barcolor, styleCandle ); | |
stochup= StochK()>StochD() ; | |
MACDup= MACD()>Signal() ; | |
Hist= MACD()-Signal() ; | |
Histup= Hist>Ref(Hist,-1) ; | |
HAup= HaClose>=HaOpen ; | |
BuyHa= HaClose>=HaOpen ; | |
SellHa= HaClose<HaOpen ; | |
//====================================================================== | |
//PARAMTOGGLE | |
// This combines indicators into one timing Signal | |
//function ParamOptimize( description, default, minv, maxv, step ) | |
// { return Optimize(description, Param(description,default, minv, maxv, step ), minv, maxv, step ); } | |
tgl = ParamToggle("Result", "AND logic|Compare"); | |
// switch test calculation and compare the results | |
if(tgl) | |
{ | |
myBuy = BuyHa AND macdup AND histup AND stochup ; | |
myShort = SellHa AND !histup AND !stochup ; | |
} | |
else | |
{ | |
myBuy = IIf( HaClose>=HaOpen AND MACD()>Signal() AND Hist>Ref(Hist,-1) AND StochK()>StochD() ,1,0) ; | |
myShort = IIf( HaClose<HaOpen AND Hist<Ref(Hist,-1) AND StochK()<StochD() ,1,0); | |
} | |
Buy = ExRem(mybuy,myshort); | |
Sell = ExRem(myshort,mybuy); | |
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,haLow,Offset=-15); | |
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,haHigh,Offset=-15); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment