Pls Make this afl

#1
hi i want to combine ema,macd and psar into one and if all are bullish/bearish i want the candle to turn blue/red,can anyone code this ,i will tell the param for all shortly.do leave a coment if coding this is possible

thank you
 

casoni

Well-Known Member
#2
hi i want to combine ema,macd and psar into one and if all are bullish/bearish i want the candle to turn blue/red,can anyone code this ,i will tell the param for all shortly.do leave a coment if coding this is possible

thank you

is this you are looking for ?

_SECTION_BEGIN("Ema");
Periods = Param("Periods", 15, 2, 300, 1, 10 );
_SECTION_END();
_SECTION_BEGIN("macd");
r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );
_SECTION_END();
_SECTION_BEGIN("sar");
acc = Param("SAR Acceleration", 0.02, 0, 1, 0.001 );
accm = Param("SAR Max. acceleration", 0.2, 0, 1, 0.001 );
_SECTION_END();

bull= C > EMA(C,Periods) AND MACD(r1, r2)>Signal(r1,r2,r3) AND C> SAR( acc, accm );
bear= C < EMA(C,Periods) AND MACD(r1, r2)<Signal(r1,r2,r3) AND C< SAR( acc, accm );

Plot(C,"",IIf(bull,colorGreen,IIf(bear,colorRed,colorGrey40)),styleBar);

if Yes.. then enjoy :)
thank you
 

Similar threads