Simple Coding Help - No Promise.

asnavale

Well-Known Member
Pls Make Current VWAP + Yestvwap + 2 days vwap Amibroker AFL
thnks in advance
You need this in intraday chart, right ? What is the smallest interval of your database ?

-Anant
 
Here is the modified code with Buy Sell added.

_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 );
Plot( ml = MACD(r1, r2), StrFormat(_SECTION_NAME()+"(%g,%g)", r1, r2),
ParamColor("MACD color", colorAqua ), ParamStyle("MACD style",
styleThick) );
Plot( sl = Signal(r1,r2,r3), "Signal" + _PARAM_VALUES(),
ParamColor("Signal color", colorRed ), ParamStyle("Signal style",
styleThick) );
//Plot( ml-sl, "MACD Histogram", ParamColor("Histogram color", colorBlack ), styleNoTitle | ParamStyle("Histogram style",styleHistogram | styleNoLabel, maskHistogram ) );

m1=MACD(r1,r2);
s1=Signal(r1,r2,r3);
Hist= m1-s1;
Histprev=Ref(Hist,-1);

Color = IIf(Hist>Histprev,ParamColor("MACD-H Up Color", colorGreen),
IIf(hist<histprev,ParamColor("MACD-H Down
Color",colorCustom16),colorRed));

Plot(m1-s1,"MACD Histogram",Color,styleHistogram|styleNoTitle|styleThick);

SetChartBkGradientFill( ParamColor("Backgroud Top Color",
colorRed),ParamColor("Background Bottom Color", colorDarkGrey));

//This indicator shows the value of tomorrow's Closing Price
//in order for the slope of the MACD Histogram to change Direction.
//(ie. changing from a positive slope to a negative slope OR changing
//from a negative slope to a positive slope)
GraphXSpace = 8;

f1 = ((r3+1)*M1-2*S1)/(r3-1);
f2 = EMA(C,r1)*(r1-1)/(r1+1);
f3 = EMA(C,r2)*(r2-1)/(r2+1);
f4 = 2/(r1+1) - 2/(r2+1);

dcv = (f1-f2+f3)/ f4;

Title = Name() + " - " + FullName() + " - " + Date() + " - Close
= " +
WriteVal(C,0.3) + " - DCV = " + WriteVal(dcv,0.3);

Up = Cross(ml, sl);
Dn = Cross(sl, ml);
Buy = Cross(ml, sl);
Sell = Cross(sl, ml);
Short = Sell;
Cover = Buy;
PlotShapes(Up*shapeUpArrow,colorGreen);
PlotShapes(Dn*shapeDownArrow,colorRed);

Plot(C,"",colorYellow,64 | styleOwnScale);
_SECTION_END();
thanks friend. Is it possible to add EMA OFFSET parameter in the afl code. Here i need to add MACD as 50 EMA with 50 offset parameter
 

asnavale

Well-Known Member
My Smallest Interval is 1min database
Hi, AK78,

Received ypur PM but unable to reply to it. So, posting here. I have the AFL you need. I had coded it about 2 years back. I have to serch for it. Unfortunately, I am out of India at present. I will be back by 20th Sep. After I return I will give you the AFL. Please bear with the delay for two weeks.

-Anant
 
no problem Anant sir ji
@AK78 : Although, would appreciate to see Anant Sir's afl; here is another code for your 3 VWAP's. Refer the following https://www.wisestocktrader.com/indicators/2791-vwap-bands-v2-for-amibroker-afl to get the VWAPs and add the code given below to the above afl at the end.
Code:
_SECTION_BEGIN("VWAP DBY");

NoofBars = ceil((375)/(int(Interval()/60)))+1;
PPC2 = ValueWhen( newPeriod == True, Ref(VWAP, -NoofBars), 1);
Plot ( PPC2, "PPC2", colorBlue, styledashed|styleNoRescale );

_SECTION_END();
This will give you the following:
continuous blue line = Today's VWAP
dotted blue line = Yesterday's VWAP (last value)
dashed blue line = DBY VWAP (last value)
Hope it helps. Thnx.
 
Bhanushali ji my ami ver is : 5.71 (your code not working in my ami )
Either upgrade or at the very least tell what the exact error message is. Not many are likely to have same older version as yours..
 

Similar threads