# AFL of Saint's pivot method and Kolkata indicator

Discussion in 'Technical Analysis' started by mmca2006, Oct 17, 2008.

1. ### mmca2006Active Member

Joined:
Jul 8, 2007
Messages:
290
176
Trophy Points:
43
Location:
Mars
Is there any AFL code of Saint's pivot metod and kolkata indicator ? If so, kindly provide me the link, It will help me lot . Last 2 days I am continuously searching but failed to locate it. Thanks in advance.

2. ### sunbim31Active Member

Joined:
Feb 15, 2006
Messages:
268
200
Trophy Points:
43
Location:
Kolkata
Re: AFL of Saint's pivot menthod and Kolkata indicator

Hello
Try this

_SECTION_BEGIN("Live01");
////////////////////////////////////////////////////////////////////////////////////
// Global variables
GraphXSpace=10;
SetBarsRequired(10000,10000);

lperiod = Param("Long Period", 90,3,200,1);
P = ParamField("Price field",4);

a = Param("Angle",30,15,45,1);
a = (22/7)*(a/180);
Num = sin(1*a) * P + sin(2*a) * Ref(P,-1) + sin(3*a) * Ref(P,-2) + sin(4*a) * Ref(P,-3) + sin(5*a) * Ref(P,-4);
Den = sin(a) + sin(2*a) + sin (3*a) + sin(4*a) + sin(5*a);
kolkata = Num / Den;

movAvg = MA(P,lperiod);

////////////////////////////////////////////////////////////////////////////////////
// Desicion
Buy = kolkata > movAvg AND kolkata < L AND kolkata > movAvg;
Sell = kolkata < movAvg OR H < kolkata;
Short = movAvg > kolkata AND kolkata > H AND kolkata < movAvg;
Cover = kolkata > movAvg OR L > kolkata;

Short = ExRem(Short, Cover);
Cover = ExRem(Cover, Short);

////////////////////////////////////////////////////////////////////////////////////
// Graphics
Plot(kolkata, "Kolkata ", colorBrown, 5);
Plot(movAvg, "MA " + lperiod, colorIndigo, 5);

PlotShapes(IIf(Short,shapeDownArrow,shapeNone),colorRed);
PlotShapes(IIf(Sell,shapeSmallCircle,shapeNone),colorBrightGreen);
PlotShapes(IIf(Cover,shapeSmallCircle,shapeNone),colorRed);

_SECTION_END();
/*

// AFL - formula -- which I use
wvap = WMA(V*P,period)/WMA(V,period);

also,... for camarilla levels... you might have the actual formula... in case you dont have AND still use 1.1 as the factor .. you can change it with ...

factor = sqrt(22/7)... square root of PI.

it works better on nifty also...

regards,
pramod

Here's the camarilla AFL....which I use.. I have an extra level 3.5 on both sides.. this level acts as a resting place...sometimes.*/

_SECTION_BEGIN("Camarilla");

tom = -1 * Param("Day",1,0,100,1);

TimeFrameSet(inDaily);
yyo = Ref(O,tom + 1);
yyh = Ref(H,tom + 1);
yyl = Ref(L,tom + 1);
yyc = Ref(C,tom + 1);
TimeFrameRestore();

tyo = TimeFrameExpand( yyo, inDaily, expandLast);
tyh = TimeFrameExpand( yyh, inDaily, expandLast);
tyl = TimeFrameExpand( yyl, inDaily, expandLast);
tyc = TimeFrameExpand( yyc, inDaily, expandLast);

x = LastValue(Cum(1)) - 1;

yo = tyo[x];
yh = tyh[x];
yl = tyl[x];
yc = tyc[x];

fac = sqrt(22/7);

r4 = ( yh - yl ) * ( fac/2) + yc;
r35 = ( yh - yl ) * ( fac/3) + yc;
r3= ( yh - yl ) * ( fac/4) + yc;
r2 = ( yh - yl ) * ( fac/6) + yc;
r1 = ( yh - yl ) * ( fac/12) + yc;

s1 = yc - ( yh - yl ) * (fac/12);
s2 = yc - ( yh - yl ) * (fac/6);
s3 = yc - ( yh - yl ) * (fac/4);
s35 = yc - ( yh - yl ) * (fac/3);
s4 = yc - ( yh - yl ) * (fac/2);

pivot = (r4 + s4)/2;

Plot(r4,"\nR4",colorYellow,1);
Plot(r35,"R3.5",colorYellow,styleDashed|styleThick );
Plot(r3,"R3",colorYellow,1);
Plot(r2,"R2",colorYellow,1);
Plot(r1,"R1",colorYellow,1);

Plot(pivot," Pivot",colorOrange,5);

Plot(s1," S1",colorDarkBlue,1);
Plot(s2,"S2",colorDarkBlue,1);
Plot(s3,"S3",colorDarkBlue,1);
Plot(s35,"S3.5",colorDarkBlue,styleDashed|styleThick);
Plot(s4,"S4",colorDarkBlue,1);
_SECTION_END();
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, "Close", ParamColor("Color", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
if( ParamToggle("Tooltip shows", "Only Prices|All Values" ) )
{
ToolTip=StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g (%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 )));
}

su = Study("SU", GetChartID() );
re = Study("RE", GetChartID() );
PlotOHLC( re, re, su, su, "", ParamColor("Shade Color", colorPlum),styleCloud );
_SECTION_END();

This is the afl version of Asishda's Kolkata Indicator.
Sunando

santoshkj, hitesh, whyLately and 5 others like this.
3. ### mmca2006Active Member

Joined:
Jul 8, 2007
Messages:
290
176
Trophy Points:
43
Location:
Mars
Re: AFL of Saint's pivot menthod and Kolkata indicator

Thanks lot Sunando for your effort , I have gone through this forum and found several post submitted by you which are really useful for a layman like me. I have also a request to you--here you have given a code of Kolkata indicator with Camarilla levels ,however is it possible to merge kolkata indicator with saints pivot. Probably my question is substandard but I could not resist my self from asking it to you. If at all it is possible , can you provide us an AFL.
From this forum I found one metastock expert code of Saints pivot method ,wriitten by Karthik but found no AFL of the same code, if kolkata indicator can be merged with Saints pivot , it may strengthen the buy /sell decision of a layman like me. If I am wrong in any aspect please rectify me. Just 2 paras of the metastock code written by Karthik is giving here (I do not have the link of karthiks post ) for your ready reference----

HTML:
```Symbol 1

Name: Higher High
Graphic: Dot  Size : Medium
Color : Green
Label : HH
Symbol Position : above
Label Position: above

Condition:

Z:=  Zig(C ,2 ,% )  ;
HH:=((Z<Ref(Z,-1) AND Ref(Z,-1) > Ref(Z,-2)) AND (Peak(1,Z,2 ) >Peak(2,Z,2)));HH;

Symbol 2

Name : Lower High
Graphic : Dot  Size : Medium
Color : Red
Label : LH
Symbol Position : above
Label Position : above

Condition :

Z:=  Zig(C ,2 ,% ) ;
LH:=((Z<Ref(Z,-1) AND Ref(Z,-1) > Ref(Z,-2)) AND (Peak(1,Z,2 ) <Peak(2,Z,2)));LH;
```

mmca

pkamalesh likes this.
4. ### xyteMember

Joined:
Nov 5, 2004
Messages:
19
39
Trophy Points:
13
Re: AFL of Saint's pivot menthod and Kolkata indicator

Here is the metastock explorer I have from the forum. Don't exactly remember the thread I got it in. Credits to Karthik and the person who made this expert.

Import it into Meta 9 and higher and apply the expert PIVOT-ANALYSIS

Cheers,
xyte

5. ### mmca2006Active Member

Joined:
Jul 8, 2007
Messages:
290
176
Trophy Points:
43
Location:
Mars
Re: AFL of Saint's pivot menthod and Kolkata indicator

Thanks lot for providing this metastock expert. However I actually need AFL of this pivot expert along with Kolkata indicator.Requesting senior members/AFL experts , if possible, please provide a link of AFL of this pivot expert .

6. ### mmca2006Active Member

Joined:
Jul 8, 2007
Messages:
290
176
Trophy Points:
43
Location:
Mars
Requesting the AFL experts to assist me to write an AFL , the first two conditions for which I require a guidance is given below--
Please guide me to write an AFL for the 2 conditions given below(these are in MS format), I will try to write for the rest.

Code:
```Name: Higher High
Symbol : Dot
Color : Green
Label : HH
Symbol Position : above

[B][U]Condition: [/U][/B]

Z:=  Zig(C ,2 ,% )  ;
HH:=((Z<Ref(Z,-1) AND Ref(Z,-1) > Ref(Z,-2)) AND (Peak(1,Z,2 ) >Peak(2,Z,2)));HH;```

Code:
```Name : Lower High
Symbol : Dot
Color : Red
Label : LH
Symbol Position : above

[B][U]Condition : [/U][/B]

Z:=  Zig(C ,2 ,% ) ;
LH:=((Z<Ref(Z,-1) AND Ref(Z,-1) > Ref(Z,-2)) AND (Peak(1,Z,2 ) <Peak(2,Z,2)));LH;```

7. ### uasishGuest

Any indicator/Osc/Expert coded based on Zig funtion is not advisable.On past charts it LOOKS excellent/Gr8 as if we have just received an ATM card with pin ,accessing enormous money.Many a times this signal (on which we have taken entry) will simply VANISH from charts after addittion of upcoming right side's Future datas,landing us in a mess.
There are some use of this ,which anyone will understand after delaing for some time in code building process.

8. ### mmca2006Active Member

Joined:
Jul 8, 2007
Messages:
290
176
Trophy Points:
43
Location:
Mars
Thanks lot for your valuable suggestion, however I seek one more suggestion from you -ie. I want to establish pivot first with HH/LL method AND after establishing the pivot my trade will be excuted on the basis of RSI/Trix/Your kolkata meet indicator or A Combination of these indicators .I do not want to execute my trade (swing trade) on the basis of pivot solely.Actually i want to establish my own trading style, which must be very simple .
Buy= Pivot +Confirmation from Rsi /Trix /macd /kolkata meet etc..
Sell= once pivot established(donot want to wait for any confirmation from other indicators because of conservative approach.)however in such case trailing stoploss may also be used.

Will be obliged if you kindly guide me.

9. ### anshuman.chaudhuriNew Member

Joined:
Oct 5, 2008
Messages:
25
8
Trophy Points:
3
Location:
London,UK
Re: AFL of Saint's pivot menthod and Kolkata indicator

Hi Sunando,
thanks to you that I could insert the AFL into AMI.
I do not have any idea on the AFL..I found the Camarilla levels very interesting once I
studied the same..Is is possible to have some sort of an exploration based on the levels??
I am using Ami 4.80..
Thanks
Anshuman

Joined:
May 20, 2007
Messages:
117