Simple Coding Help - No Promise.

Hi please give afl code for the below.
If EMA(C,5) > EMA(C ,20)
then area inbetween two ema's be green and if below color be red.
I tried stylearea ,stylecloud but dint get it.

Thank you
 
Thanks Vijay anna for your interest in helping, My logic is Buy when the price above 200EMA and ribbon is blue and sell is based on tsl. Go short when the price is below the 200EMA and the ribbon is red....
TIA
Code:
_SECTION_BEGIN("OBV Hi Lo");
Ob = OBV();	Hi = HHV(Ob,15);	Lo = LLV(Ob,15);
		HiP= HHV(H,15);		LoP= LLV(L,15);

B1 = Cross(Ob,Ref(Hi,-1));	S1 = Cross(Ref(Lo,-1),Ob);
B2 = Cross(C,Ref(HiP,-1));	S2 = Cross(Ref(LoP,-1),C);
B1 = ExRem(B1,S1);		S1 = ExRem(S1,B1);
B2 = ExRem(B1,S1);		S2 = ExRem(S2,B2);
UP1 = Flip(B1,S1);		DN1 = Flip(S1,B1);
UP2 = Flip(B2,S2);		DN2 = Flip(S2,B2);

B3 = UP1 AND UP2;		S3 = DN1 AND DN2;
B3 = ExRem(B3,S3);		S3 = ExRem(S3,B3);
UP3 = Flip(B3,S3);		DN3 = Flip(S3,B3);

Plot(8,"",IIf(UP3,colorBlue,colorRed),styleOwnScale|styleNoLabel|styleThick,0,200,0,-5,8);
//Plot(4,"",IIf(UP2,colorBlue,colorRed),styleOwnScale|styleNoLabel|styleNoLine|styleDots,0,200);
//Plot(2,"",IIf(UP1,colorBlue,colorRed),styleOwnScale|styleNoLabel|styleNoLine|styleDots,0,200);
_SECTION_END();
_SECTION_BEGIN("OBV1");
Plot( OBV(), _DEFAULT_NAME(), ParamColor("Color", colorCycle ), ParamStyle("Style")  );
_SECTION_END();
Can you describe the exact conditions(logically) as to when to buy, when to sell etc.
Basically in one post, can u consolidate buy and short entry criteria, and subsequent sell and cover criteria, so that we can proceed further. :D

(If your answer is that buy as soon as red ribbon changes to blue, then in my opinion no need to put an extra buy/sell arrow)
 
Thanks Vijay anna for your interest in helping, My logic is Buy when the price above 200EMA and ribbon is blue and sell is based on tsl. Go short when the price is below the 200EMA and the ribbon is red....
TIA
Precisely this is what Vijay is asking . . . .

Whats your logic for the TSL, Profit/Loss booking . . .


Happy :)
 
Hi Dear Friends
Will you please add scan to this afl
buy=slope is under 20
sell=slope is up 80

HTML:
_SECTION_BEGIN("_trending wave");
SetChartOptions(0, chartShowArrows|chartShowDates, chartGrid20 |chartGrid50 |chartGrid80);
_N(Title =EncodeColor(colorGreen)+ StrFormat("{{NAME}} {{DATE}} " + EncodeColor(colorBlack)+" < Open %g > "+ EncodeColor(colorBlue)+ " < High %g > "+ EncodeColor(colorRed)+" < Low %g > "+ EncodeColor(colorBlack) + " < Close %g > " + EncodeColor(colorBrown ) + "< Change" +" %.2f%% > " + "< Range " +(H-L) +" >" +" < Volume " +WriteVal( V, 1.0 ) +" >"+" {{VALUES}} ", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
SetChartBkColor(ParamColor("Outer Panel Color ",colorWhite)); // color of outer border 
SetChartBkGradientFill( ParamColor("Inner Panel Color Upper Half",colorWhite),
ParamColor("Inner Panel Color Lower Half",colorWhite)//color of inner panel
,ParamColor("Behind Text Color", colorLavender));
GraphXSpace=7;

Hc=(O+H+L+C)/4;

Ho = AMA( Ref( Hc, -1 ), 0.5 );

pds = Optimize("pds ",Param("pds ",4,1,25,1),1,25,1);
myArray = (RSIa((HC), pds )+ RSIa( Ho,pds ) + Ref(RSIa(Ho,pds),-1) + Ref(RSIa(Ho,pds),-2) + Ref(RSIa(Ho,pds),-3))/5 ; 

myArrayS = (AMA( myArray , 0.5 )); //smooth

BS = ParamToggle("smooth","No|Yes",1);
BN = ParamToggle("normal","No|Yes",1);

if (BS) Plot( myArrayS , " smooth ", IIf( myArrayS >=Ref(myArrayS ,-1), colorGreen, colorRed ));
if (BS) Plot ( 1, "", IIf( myArrayS >=Ref(myArrayS ,-1), colorGreen, IIf( myArrayS < Ref(myArrayS ,-1), colorRed, colorLavender )), styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );

if (BN) Plot( myArray , " RSI ", IIf( myArray >=Ref(myArray ,-1), colorGreen, colorRed ));
if (BN) Plot ( 2, "", IIf( myArray >=Ref(myArray ,-1), colorGreen, IIf( myArray < Ref(myArray ,-1), colorRed, colorLavender )), styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );

HistInd=myArray - myArrayS ;

if (BS AND BN) Plot(HistInd, _DEFAULT_NAME(),
IIf(HistInd>=0, ParamColor("Up Color", colorDarkGreen), ParamColor("Down Color", colorRed)),
ParamStyle( "Style", styleHistogram | styleThick, maskHistogram ));
if (BS AND BN) Plot(0,"",colorBlack, styleLine|styleDashed | styleThick);

Plot(80,"RESISTENCE",colorRed, styleLine|styleDashed | styleThick);
Plot(50,"",colorBlack, styleLine|styleDashed | styleThick);
Plot(20,"SUPPORT",colorBlue, styleLine|styleDashed | styleThick); 
_SECTION_END();

_SECTION_BEGIN("Bollinger Bands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorLightGrey );
Style = ParamStyle("Style", styleLine | styleNoLabel ) | styleNoLabel;
Plot( bbt = BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, Style ); 
Plot( bbb = BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, Style ); 
PlotOHLC( bbt, bbt, bbb, bbb, "", ColorBlend( Color, colorWhite, 0.9 ), styleNoLabel | styleCloud | styleNoRescale, Null, Null, Null, -1 );
_SECTION_END();
 
just simple question so many people using so many softwares/paid software like mt4 amibroker did you guys make money/profit consistantly or say atleast stay in profit in a month???
 
Dear Ami experts,

I want to plot previous day MACD's high low automatically(by plotting an horizontal line in MACD pane) and want to create a sound alert when current day MACD touches PDH/PDL of MACD (once per bar) in amibroker. As am a non-techie(non CS employee), dont even know how to proceed with this.

Can you please help? Would be obliged. Thanks in advance :)
 
Last edited:

Similar threads