My afl collection

Status
Not open for further replies.
shivangi77-thanks 4 the down-loader link. But I just could not figure out as to where the downloaded EOD/IEOD data was getting stored on my PC. Can u pls help me...
Thanks
 

shivangi77

Well-Known Member
Somebody Selling it as Paid Afl






Code:
_SECTION_BEGIN("Trend Lines");
p1 = Param("TL 1 Periods", 20, 5, 50, 1);
p2 = Param("TL 2 Periods", 5, 3, 25, 1);
TL1 = LinearReg(C, p1);
TL2 = EMA(TL1, p2);
Col1 = IIf(TL1 > TL2, ParamColor("TL Up Colour", colorGreen), ParamColor("TL Dn Colour", colorRed));
Plot(TL1, "TriggerLine 1", Col1, styleLine|styleThick|styleNoLabel);
Plot(TL2, "TriggerLine 2", Col1, styleLine|styleThick|styleNoLabel);
_SECTION_END();

_SECTION_BEGIN("Linear Regression Channel");
//CyberMan's Linear Regression Channel.

//Linear Regression Line with 2 Standard Deviation Channels Plotted Above and Below 
//The original was written by Patrick Hargus, with critical hints from Marcin Gorzynski, Amibroker.com Technical Support 
//Wysiwyg coded the angle in degrees part
//I modified the original Linear Regression code so that the line will change color based on the degree of the Linear Regression slope.
//I combine this with my trading system.
//When my system gives an entry signal I look at the Linear Regression Line and I will only take long positions if the Linear Regression line is green and the entry price is below the LR line.
//When my system gives an entry signal I look at the Linear Regression Line and I will only take short positions if the Linear Regression line is red and the entry price is above the LR line.
//It is usefull for filtering out lower probability trades.


//================================================Start Chart Configuration============================================================================

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 )) ));
SetChartBkGradientFill(ParamColor("Top", colorTeal), ParamColor("Bottom", colorLightGrey), ParamColor("Title", colorTeal));
SetChartBkColor(colorTeal);


Plot( C, "Close", colorWhite, styleCandle, Zorder = 1);
SetChartOptions(0,chartShowArrows | chartShowDates);

//================================================End Chart Configuration===============================================================================


//====================================Start of Linear Regression Code==================================================================================

P = ParamField("Price field",-1);

Length = 150;

Daysback = Param("Period for Liner Regression Line",Length,1,240,1);
shift = Param("Look back period",0,0,240,1);

//=============================== Math Formula ========================================================================================================

x = Cum(1);
lastx = LastValue( x ) - shift;
aa = LastValue( Ref(LinRegIntercept( p, Daysback), -shift) );
bb = LastValue( Ref(LinRegSlope( p, Daysback ), -shift) );
y = Aa + bb * ( x - (Lastx - DaysBack +1 ) );

//==================Plot the Linear Regression Line ====================================================================================================

LRColor = ParamColor("LR Color", colorCycle ); 
LRStyle = ParamStyle("LR Style");

LRLine =  IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y, Null );

LRStyle = ParamStyle("LR Style");
Angle = Param("Angle", 0.05, 0, 1.5, 0.01);// A slope higher than 0.05 radians will turn green, less than -0.05 will turn red and anything in between will be white.

LRLine = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y, Null );

Pi = 3.14159265 * atan(1); // Pi
SlopeAngle = atan(bb)*(180/Pi);

LineUp = SlopeAngle > Angle;
LineDn = SlopeAngle < - Angle;

if(LineUp)
{
Plot(LRLine, "Lin. Reg. Line Up", IIf(LineUp, colorBrightGreen, colorWhite), LRStyle);
}
else
{
Plot(LRLine, "Lin. Reg. Line Down", IIf(LineDn, colorDarkRed, colorWhite), LRStyle);
} 

//==========================  Plot 1st SD Channel ======================================================================================================

SDP = Param("Standard Deviation", 1.5, 0, 6, 0.1);
SD = SDP/2;

width = LastValue( Ref(SD*StDev(p, Daysback),-shift) ); //Set width of inside chanels here.
SDU = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y+width , Null ) ;
SDL = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y-width , Null ) ;

SDColor = ParamColor("SD Color", colorCycle );
SDStyle = ParamStyle("SD Style");

Plot( SDU , "Upper Lin Reg", colorWhite,SDStyle ); //Inside Regression Lines
Plot( SDL , "Lower Lin Reg", colorWhite,SDStyle ); //Inside Regression Lines

//==========================  Plot 2d SD Channel ========================================================================================================

SDP2 = Param("2d Standard Deviation", 2.0, 0, 6, 0.1);
SD2 = SDP2/2;

width2 = LastValue( Ref(SD2*StDev(p, Daysback),-shift) ); //Set width of outside chanels here. 
SDU2 = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y+width2 , Null ) ;
SDL2 = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y-width2 , Null ) ;

SDColor2 = ParamColor("2 SD Color", colorCycle );
SDStyle2 = ParamStyle("2 SD Style");

Plot( SDU2 , "Upper Lin Reg", colorWhite,SDStyle2 ); //OutSide Regression Lines
Plot( SDL2 , "Lower Lin Reg", colorWhite,SDStyle2 ); //OutSide Regression Lines

Trend = IIf(LRLine > Ref(LRLine,-1),colorGreen,colorRed);//Changes LR line to green if sloping up and red if sloping down.

Plot( LRLine , "LinReg", Trend, LRSTYLE );

//============================ End Indicator Code =========



_SECTION_BEGIN("MAMA");
SetBarsRequired( 10000, 10000 );
SetChartOptions(0,chartShowArrows|chartShowDates);
prc = ( High + Low ) / 2;
fastlimit = 0.5;
slowlimit = 0.05;
pi=4*atan(1);
    RTD=180/pi;
    DTR=pi/180;

Cyclepart=Param("Alpha",0.5,0.1,1,0.1);
   
Smooth[0] = Period = Detrender[0] = I1[0] = Q1[0] = 0;
phase[0]=deltaphase[0]=MAMA[0]=FAMA[0]=0;
for ( i = 6; i < BarCount; i++ )
{
Smooth[i] = ( 4 * prc[i] + 3 * prc[i-1] + 2 * prc[i-2] + prc[i-3] ) / 10;
AmpCorr[i] = 0.075 * Period[i-1] + 0.54;
Detrender[i] = ( 0.0962 * Smooth[i] + 0.5769 * Smooth[i-2] - 0.5769 * Smooth[i-4] - 0.0962 * Smooth[i-6] ) * AmpCorr[i];
Q1[i] = ( 0.0962 * Detrender[i] + 0.5769 * Detrender[i-2] - 0.5769 * Detrender[i-4] - 0.0962 * Detrender[i-6] ) * AmpCorr[i];
I1[i] = Detrender[i-3];
if (I1[i] != 0) phase[i] = DTR*360/atan(q1[i]/I1[i]);
deltaphase[i]=phase[i-1]-phase[i];
if (deltaphase[i] <1) deltaphase[i]=1;
alpha[i]=fastlimit[i]/deltaphase[i];
if (alpha[i] < slowlimit[i]) alpha[i]=slowlimit[i];
MAMA[i]=alpha[i] * prc [i] +(1-alpha[i])*MAMA[i-1];
FAMA[i]=Cyclepart*alpha[i] * prc [i] +(1-Cyclepart*alpha[i])*FAMA[i-1];
}

_SECTION_END();

_SECTION_BEGIN("SYSTEM");
BuySetupValue=ValueWhen(Cross(MAMA,FAMA),H,1);
SellsetupValue=ValueWhen(Cross(FAMA,MAMA),L,1);
Buysetup =Cross(MAMA,FAMA) ;
Sellsetup = Cross(FAMA,MAMA);
Longa = Flip(Buysetup,Sellsetup);
shrta = Flip(Sellsetup,Buysetup);
Buy=Longa AND Cross(C,BuySetupValue);
Sell=shrta AND Cross(SellsetupValue,C);
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
t1= Flip(Buy,Sell);
t2= Flip(Sell,Buy);
BPrice=ValueWhen(t1 AND Ref(t1,-1)==0,C,1);
SPrice=ValueWhen(t2 AND Ref(t2,-1)==0,C,1);
GraphXSpace = 5;
dist = 1.5*ATR(20); 
for( i = 0; i < BarCount; i++ ) 
{ 
if( Buy[i] ) PlotText( "" + C[ i ], i, L[ i ]-dist[i], colorLime ); 
if( Sell[i] ) PlotText( "" + C[ i ], i, H[ i ]+dist[i], colorYellow ); 
} 
_SECTION_END();
//=================TITLE================================================================================================
_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator ) 
(
Title = EncodeColor(colorWhite)+ "MAMA Poistional System" + " - " +  Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
 "  - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+"  "+"Hi-"+H+"  "+"Lo-"+L+"  "+
"Cl-"+C+"  "+ "Vol= "+ WriteVal(V)+"\n"+ 
EncodeColor(colorLime)+
WriteIf (Buy , " GO LONG / Reverse Signal at "+C+"  ","")+
WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+"  ","")+"\n"+EncodeColor(colorWhite)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BPrice)+"","")+
WriteIf(Buy  , "Total Profit/Loss for the Last trade Rs."+(SPrice-C)+"","")+
WriteIf(Longa AND NOT Buy, "Trade : Long - Entry price Rs."+(BPrice),"")+
WriteIf(shrta AND NOT Sell, "Trade : Short - Entry price Rs."+(SPrice),"")+"\n"+ 
WriteIf(Longa AND NOT Buy, "Current Profit/Loss Rs."+(C-BPrice)+"","")+
WriteIf(shrta AND NOT Sell, "Current Profit/Loss Rs."+(SPrice-C)+"",""));
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);                      
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45); 
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);                      
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
_SECTION_END();
WriteVal(BuyPrice);
WriteVal(Longa);
WriteVal(t1);
WriteVal(SellPrice);
WriteVal(shrta);
_SECTION_END();
//=========================== Back ground Text ===================
_SECTION_BEGIN("Background text");
GfxSetOverlayMode(1);
GfxSelectFont("Tahoma", Status("pxheight")/6 );
GfxSetTextAlign( 6 );// center alignment
//GfxSetTextColor( ColorRGB( 60, 45, 80 ) );
GfxSetTextColor( ColorHSB( 42, 42, 42 ) );
//GfxSetTextColor( ColorHSB( 5, 5,242) );
GfxSetBkMode(0); // transparent
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/12 );
GfxSelectFont("Tahoma", Status("pxheight")/12 );
GfxTextOut( "", Status("pxwidth")/2, Status("pxheight")/3 );
GfxSelectFont("Tahoma", Status("pxheight")/20 );
GfxTextOut( "", Status("pxwidth")/2, Status("pxheight")/2 );
GfxSelectFont("Tahoma", Status("pxheight")/40);
GfxTextOut( "", Status("pxwidth")/7, Status("pxheight")/6);

_SECTION_END();
 
For Backfilling Amibroker with IEOD data for past 50 days

Visit Here
Can you please suggest from where I can get RT Data/tick data (NSE NIFTY/MINIFTY and other future scrips) (preferably free). Presently I am doing with Odin tick data and odin back fill but the problem is internet disconnection and other problems etc etc. Once I found that the tickdata for last 15-20 minutes from odin was same.
Thanks
 

kaly422000

Well-Known Member
Actually global's data are tick data . but for manshi, it captures data from trading terminal and the lag is 3 sec and overall it is not tick data. in between the 3 sec lag, if any trade happens it is not captured by manshi, so the differences arises between global and manshi

sr
capturing data from terminal depends on how good is ur net and terminal software. chek any gap in tick list . u may compare with nifty in fno direct. other u can compare with icharts.in after the trading hours.
 

sr114

Well-Known Member
My point is that if you are not taking data feed from NSE authorised Data Vendors, then it is of no point in arguing.
actually tick data is the data for every trade.
now data capturing from terminal - there is certainly lag in the data - be of Manshi, of xyz, abc or the utility developed by some one.

again the utility is good or bad - every utility does the same thing - then why i am going to pay for the data capturing utility.
again worse of them are those who are supplyinh data from yahoo feed and taking money from us.

so either u go with the authorised vendors or u go with the utilities which costs nothing.

and if you are in algo trade/machine trade then the idea of tick data - does not arises - thats a different ball game.

sr
 

shivangi77

Well-Known Member
Can you please suggest from where I can get RT Data/tick data (NSE NIFTY/MINIFTY and other future scrips) (preferably free). Presently I am doing with Odin tick data and odin back fill but the problem is internet disconnection and other problems etc etc. Once I found that the tickdata for last 15-20 minutes from odin was same.
Thanks
Sorry chandra, for future data I subscribed to manshi future data.
 

shivangi77

Well-Known Member
ATR Afl
Somebody also selling this system








Code:
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();
 
/* Fibonacci Internal & External Retracements */
// This is a Modified Version that shows Fibonacci 00% & 100% instead of WRONG Sup & Res
 
_SECTION_BEGIN("Background");
    SetChartOptions(0,chartShowArrows|chartShowDates);
    SetChartBkColor(ParamColor("Outer panel",colorBlack)); // color of outer border 
    SetChartBkGradientFill( ParamColor("Inner panel upper",colorBlack),ParamColor("Inner panel lower",colorBlack));
    tchoice=Param("Title Selection ",2,1,2,1);
_SECTION_BEGIN("Fib Retracements");
    fibs = ParamToggle("Plot Fibs","Off|On",1);
    pctH = Param ("Pivot Hi %", 0.325,0.001,2.0,0.002);
    HiLB = Param ("Hi LookBack",1,1,BarCount-1,1);
    pctL = Param ("Pivot Lo %", 0.325,0.001,2.0,0.002);
    LoLB = Param ("Lo LookBack",1,1,BarCount-1,1);
    Back = Param ("Extend Left = 2",1,1,500,1);
    Fwd  = Param("Plot Forward", 0, 0, 500, 1);
    text = ParamToggle("Plot Text","Off|On",1);
    hts  = Param ("Text Shift", -33.5,-50,50,0.10);
    style =ParamStyle("Line Style",styleLine,styleNoLabel);
x = BarIndex();
pRp  = PeakBars( H, pctH, 1) == 0;
yRp0 = SelectedValue(ValueWhen( pRp, H, HiLB));
xRp0 = SelectedValue(ValueWhen( pRp, x, HiLB));
pSp  = TroughBars( L, pctL, 1) == 0;
ySp0 = SelectedValue(ValueWhen( pSp, L, LoLB));
xSp0 = SelectedValue(ValueWhen( pSp, x, LoLB));
Delta = yRp0 - ySp0;
 
function fib(ret)
{
retval = (Delta * ret);
Fibval = IIf(ret < 1.0 
AND xSp0 < xRp0, yRp0 - retval, IIf(ret < 1.0 
AND xSp0 > xRp0, ySp0 + retval,IIf(ret > 1.0 
AND xSp0 < xRp0, yRp0 - retval, IIf(ret > 1.0 
AND xSp0 > xRp0, ySp0 + retval, Null)))); 
return FibVal;
}
 
x0 = Min(xSp0,xRp0)-Back;
x1 = (BarCount -1);
//////////////////////////////////////////////////////////////////
r236 = fib(0.236);  r236I = LastValue (r236,1);
r382 = fib(0.382);  r382I = LastValue (r382,1);
r050 = fib(0.50);       r050I = LastValue (r050,1);
r618 = fib(0.618);  r618I = LastValue (r618,1);
r786 = fib(0.786);  r786I = LastValue (r786,1);
e127 = fib(1.27);       e127I = LastValue (e127,1);
e162 = fib(1.62);       e162I = LastValue (e162,1);
e200 = fib(2.00);       e200I = LastValue (e200,1);
e262 = fib(2.62);       e262I = LastValue (e262,1);
e424 = fib(4.24);       e424I = LastValue (e424,1);
//////////////////////////////////////////////////////////////////
p00 = IIf(xSp0 > xRp0,ySp0,yRp0);    p00I = LastValue (p00,1);
p100 = IIf(xSp0 < xRp0,ySp0,yRp0);   p100I = LastValue (p100,1);
color00 =IIf(xSp0 > xRp0,colorLime,colorRed);
color100 =IIf(xSp0 < xRp0,colorLime,colorRed);
//////////////////////////////////////////////////////////////////
numbars = LastValue(Cum(Status("barvisible")));
fraction= IIf(StrRight(Name(),3) == "", 3.2, 3.2);
//////////////////////////////////////////////////////////////////
if(fibs==1)
{
Plot(LineArray(xRp0-Fwd,yRp0,x1,yRp0,Back),"PR",32,8|styleNoRescale,Null,
Null,Fwd);
Plot(LineArray(xSp0-Fwd,ySp0,x1,ySp0,Back),"PS",27,8|styleNoRescale,Null,
Null,Fwd);
Plot(LineArray(x0-Fwd,r236,x1,r236,Back),"",45,style|styleNoRescale,Null,
Null,Fwd);
Plot(LineArray(x0-Fwd,r382,x1,r382,Back),"",44,style|styleNoRescale,Null,
Null,Fwd);
Plot(LineArray(x0-Fwd,r050,x1,r050,Back),"",41,style|styleNoRescale,Null,
Null,Fwd);
Plot(LineArray(x0-Fwd,r618,x1,r618,Back),"",43,style|styleNoRescale,Null,
Null,Fwd);
Plot(LineArray(x0-Fwd,r786,x1,r786,Back),"",42,style|styleNoRescale,Null,
Null,Fwd);
Plot(LineArray(x0-Fwd,e127,x1,e127,Back),"e127",47,style|styleNoRescale,Null,
Null,Fwd);
Plot(LineArray(x0-Fwd,e162,x1,e162,Back),"e162",47,style|styleNoRescale,Null,
Null,Fwd);
Plot(LineArray(x0-Fwd,e200,x1,e200,Back),"p200",47,style|styleNoRescale,Null,
Null,Fwd);
Plot(LineArray(x0-Fwd,e262,x1,e262,Back),"p262",47,style|styleNoRescale,Null,
Null,Fwd);
Plot(LineArray(x0-Fwd,e424,x1,e424,Back),"p424",25,style|styleNoRescale,Null,
Null,Fwd);
}
//////////////////////////////////////////////////////////////////
if(text==1)
{ 
PlotText(" 0% = " + WriteVal(p00,fraction),
    LastValue(BarIndex())-(numbars/hts), p00I  + 0.05, color00);
PlotText("23% = " + WriteVal(r236,fraction),
LastValue(BarIndex())-(numbars/hts), r236I + 0.05, 45);
PlotText("38% = " + WriteVal(r382,fraction),
LastValue(BarIndex())-(numbars/hts), r382I + 0.05, 44);
PlotText("50% = " + WriteVal(r050,fraction),
LastValue(BarIndex())-(numbars/hts), r050I + 0.05, 41);
PlotText("62% = " + WriteVal(r618,fraction),
LastValue(BarIndex())-(numbars/hts), r618I + 0.05, 43);
PlotText("78% = " + WriteVal(r786,fraction),
LastValue(BarIndex())-(numbars/hts), r786I + 0.05, 42);
PlotText("100% = " + WriteVal(p100,fraction),
LastValue(BarIndex())-(numbars/hts),p100I + 0.05, color100);
PlotText("127% = " + WriteVal(e127,fraction),
LastValue(BarIndex())-(numbars/hts),e127I + 0.05, 47);
PlotText("162% = " + WriteVal(e162,fraction),
LastValue(BarIndex())-(numbars/hts),e162I + 0.05, 47);
PlotText("200% = " + WriteVal(e200,fraction),
LastValue(BarIndex())-(numbars/hts),e200I + 0.05, 47);
PlotText("262% = " + WriteVal(e262,fraction),
LastValue(BarIndex())-(numbars/hts),e262I + 0.05, 47);
PlotText("424% = " + WriteVal(e424,fraction),
LastValue(BarIndex())-(numbars/hts),e424I + 0.05, 25);
}
_SECTION_END();
//////////////////////////////////////////////////////////////////
if (tchoice==1 ) 
{
_N(Title = EncodeColor(colorWhite)+StrFormat(" {{NAME}} -   {{INTERVAL}}     
{{Date}}    Open:  %g,    High:  %g,     Low:  %g,     Close:  %g    
{{VALUES}}",O, H, L, C, SelectedValue( ROC( C, 1   ) ) ));
}
//////////////////////////////////////////////////////////////////
if (tchoice==2 ) 
{
Title = EncodeColor(colorYellow) + "DAY TRADING RANGE DAY TO DAY INCOME call 9864066262 for best chart software  " +  EncodeColor(colorWhite) + Name() + "  " + EncodeColor(colorWhite)+  Date() + "   Tick = " + EncodeColor(5) +
Interval()+
EncodeColor(colorWhite) + "     Open = " + EncodeColor(colorWhite) + O + 
EncodeColor(colorWhite) + "     High = " + EncodeColor(5) + H +
EncodeColor(colorWhite) + "      Low = " + EncodeColor(colorRed) + L + 
EncodeColor(colorWhite) + "     Close = " + EncodeColor(colorWhite) + C + "\n"
+
EncodeColor( colorWhite) +"_______________"+"\n"+
EncodeColor( colorWhite)  + "424%   =  "    +   EncodeColor(25)+ e424 + " " +"\n"+
EncodeColor( colorWhite)  + "262%   =  "    +   EncodeColor(47)+ e262 + " " +"\n"+
EncodeColor( colorWhite)  + "200%   =  "    +   EncodeColor(47)+ e200 + " " +"\n"+
EncodeColor( colorWhite)  + "162%   =  "    +   EncodeColor(47)+ e162 + " " +"\n"+
EncodeColor( colorWhite)  + "127%   =  "    +   EncodeColor(47)+ e127 + " " +"\n"+
EncodeColor( Color100)  + "100%   =  "  + EncodeColor(Color100) + p100 + " "+"\n"+
EncodeColor( colorWhite)  + "78.6%  =  "    +   EncodeColor(42)+ r786 + " " +"\n"+
EncodeColor( colorWhite)  + "61.8%  =  "    +   EncodeColor(43)+ r618 + " "+"\n"+
EncodeColor( colorWhite)  + "50%     =  "   +   EncodeColor(41)+ r050 + " "+"\n"+
EncodeColor( colorWhite)  + "38.2%  =  "    +   EncodeColor(44)+ r382 + " "+"\n"+
EncodeColor( colorWhite)  + "23.6%  =  "    +   EncodeColor(45)+ r236+ " " +"\n"+
EncodeColor( Color00)  + "00%    =  " +     EncodeColor(Color00) + p00 + " " ;
}
GraphXSpace=5;
 
 
 
 
 
 
 
 
TimeFrameSet(inDaily);
DayHigh = LastValue(H);
DayLow = LastValue(L);
TimeFrameRestore();
 
Title = Date() + ", Op=" + Open + ", Hi=" + High + ", Lo=" + Low + ", LTP=" + Close + ", Change= " + SelectedValue( ROC( C, 1 ) ) + "%" + "\n Today`s High=" + DayHigh + ", Today`s Low=" + DayLow + "  DAY TO DAY SYSTEM call 9864066262 for this chart" ;
 
 
prev=AMA2(C,1,0);
d=IIf(C>Ref(Max(Max(H,Ref(H,-20)),Max(Ref(H,-10),Ref(H,-15))),-1),Min(Min(L,Ref(L,-20)),Min(Ref(L,-10),Ref(L,-15))),
IIf(C<Ref(Min(Min(L,Ref(L,-20)),Min(Ref(L,-10),Ref(L,-15))),-1),Max(Max(H,Ref(H,-20)),Max(Ref(H,-10),Ref(H,-15))),PREV));
a=Cross(Close,d);
b=Cross(d,Close);
state=IIf(BarsSince(a)<BarsSince(b),1,0);
s=state>Ref(state,-1);
ss=state<Ref(state,-1);
sss=state==Ref(state,-1);
col=IIf(state == 1 ,51,IIf(state ==0,4,1));
Plot(C,"",Col,64);
Buy = s;
Sell = ss;
 
 
 
 
 
_SECTION_BEGIN("swing");
no=22;
res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
supres=IIf(avn==1,sup,res);
a=Cross(C,supres);
b=Cross(supres,C);
style = a * styleStaircase + b * styleStaircase;
PlotShapes(a,style, IIf(a,colorGreen,colorRed), 0, IIf(a,Low,High));
 Plot(SUPRES,"Stop Loss",colorCustom9,styleDots);
 
 
_SECTION_BEGIN("");
Buy = a;
Sell = b;
 
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-30);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0, L, Offset=-40);                      
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-35); 
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=30);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=40);                      
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-35);
 
//WriteIf(s,"EXIT all Short positions\nif trading long positions, enter long Now-\nOR at the market price on tomorrow's Open with stop="+EncodeColor(4)+WriteVal(L+.75*ATR(5),1.4)+" ,","");
//WriteIf(ss,"exit all long positions today with a Market On Close (MOC) order\nOR at the market price on tomorrow's Open with stop="+EncodeColor(4)+WriteVal(Ref(H+.75*ATR(5), -1),1.4)+",","");
//WriteIf( sss ,"No trading signals today.","") ;
dist = ATR(21);
for (i=0; i<BarCount; i++) { 
  if ( Buy[i] )
    PlotText("Buy:" + O[ i ], i, L[ i ]-3*dist[i], colorGreen);
  if ( Sell[i] )
    PlotText("Sell:" + O[ i ], i, H[ i ]+3*dist[i], colorRed); 
 
 
 
  
  
}
 
 
Filter = s OR sss OR sss ;
AddColumn(C,"close",1.2);
AddColumn( IIf( s, 66,1 ), "buy", formatChar, 1, bkcolor =IIf (s,colorYellow, colorPink ));
AddColumn( IIf( Ss, 83,1 ), "sell", formatChar, 1, bkcolor =IIf (Ss,colorPink, colorWhite ));
AddColumn( IIf( sss, 87,1 ), "wait", formatChar, 1, bkcolor =IIf (sss,colorYellow, colorRed ));
 
 
_SECTION_BEGIN("swing1");
no=21;
res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
supres=IIf(avn==1,sup,res);
a=Cross(C,supres);
b=Cross(supres,C);
style = a * styleStaircase + b * styleStaircase;
PlotShapes(a,style, IIf(a,colorGreen,colorRed), 0, IIf(a,Low,High));
Plot(supres,"Swing",colorYellow,styleStaircase);
_SECTION_END();
 
 
 
_SECTION_BEGIN("trend");
uptrend=PDI(20)>MDI(10)AND Signal(29)<MACD(13);
downtrend=MDI(10)>PDI(20)AND Signal(29)>MACD(13);
Plot( 2, /* defines the height of the ribbon in percent of pane width */"ribbon",
IIf( uptrend, colorGreen, IIf( downtrend, colorRed, 0 )), /* choose color */
 
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
_SECTION_END();
 
Buy = s AND a AND uptrend ;
Short = ss AND b AND downtrend ;
Sell = ss AND b AND downtrend ;
Cover = s AND a AND uptrend ;
 
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Cover=ExRem(Cover,Short);
Short=ExRem(Short,Cover);
 
Filter=Buy OR Sell;
Filter= Cover OR Short;
 
AddColumn( Buy, "buy", 1);
AddColumn(Sell, "Sell", 1);
AddColumn(Close,"Close",1.2);
AddColumn(Volume,"Volume",1.0);
 
 
// Plot the Buy and Sell arrows.
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-10);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-20);                      
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-15); 
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=20);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=30);                      
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-25);
 
 
 
 
 
 
// set background gradient colours
SetChartBkGradientFill( ParamColor("BgTop", ColorRGB( 172,172,172 )),ParamColor("BgBottom", ColorRGB( 102,136,187 )),ParamColor("titleblock",ColorRGB( 255,255,255 ))); 
 
GraphXSpace = 5; 
 
 
 
 
 
/* -------------------------------------------------------------------------------------- */
 
////////////////////////////////////////////////////////////////////////////////////////////////
intraday = ParamToggle("Message Board","Show|Hide",0);
showsl = ParamToggle("Stop Loss Line", "Show|Hide", 0);
  
 
 
style = a * styleStaircase + b * styleStaircase;
 
PlotShapes(a,style, IIf(a,colorGreen,colorRed), 0, IIf(a,Low,High));
if (showsl == 0) Plot(supres,"Stop Loss",colorCustom14,styleDots);
exitlong = Cross(supres, H);
PlotShapes(exitlong * shapeNone, colorBlack,0,H,-10);
exitshort = Cross(L, supres);
PlotShapes(exitshort * shapeNone, colorBlack,0,L,-15);
 
Buy = exitshort;
Sell = exitlong;
//Short = Sell;
//Cover = Buy;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
//Short = ExRem(Short, Cover);
//Cover = ExRem(Cover, Short);
AlertIf( Buy, "", "BUY @ " + C, 1 );
AlertIf( Sell, "", "SELL @ " + C, 2 );
 
for (i=BarCount-1; i>1; i--) {
  if (Buy[i] == 1) {
    entry  = O[i];
    sig = " INTRADAY BUY ";
    sl = supres[1];
    tar1 = entry + (entry * .0040);
    tar2 = entry + (entry * .0080);
    tar3 = entry + (entry * .0120);
    tar4 = entry + (entry * .0160);
    tar5 = entry + (entry * .0200);
    tar6 = entry + (entry * .0240);
    tar7= entry + (entry * .0280);
    tar8 = entry + (entry * .0320);
 tar9 = entry + (entry * .0360);
tar10 = entry + (entry * .0400);
    tar11 = entry + (entry * .0440);
    tar12 = entry + (entry * .0480);
    tar13= entry + (entry * .0520);
    tar14= entry + (entry * .0560);
    tar15= entry + (entry * .0600);
 
    tar16= entry + (entry * .0640);
 
 
 
 
    bars = i;
    i = 0;
  }
  if (Sell[i] == 1) {
    sig = " INTRADAY SELL";
    entry = O[i];
    sl = supres[i];
    tar1 = entry - (entry * .0040);
    tar2 = entry - (entry * .0080);
    tar3 = entry - (entry * .0120);
    tar4 = entry - (entry * .0160);
    tar5 = entry - (entry * .0200);
    tar6 = entry - (entry * .0240);
    tar7= entry - (entry * .0280);
    tar8= entry - (entry * .0320);
    tar9= entry - (entry * .0360);
    tar10 = entry - (entry * .0400);
    tar11 = entry - (entry * .0440);
    tar12 = entry - (entry * .0480);
    tar13= entry - (entry * .0520);
    tar14= entry - (entry * .0560);
    tar15= entry - (entry * .0600);
 
    tar16= entry - (entry * .0640);
 
 
 
 
 
 
 
 
 
    
    bars = i;
    i = 0;
  }
}
 
Offset = 20;
Clr = IIf(sig == "BUY", colorLime, colorRed);
ssl = IIf(bars == BarCount-1, supres[BarCount-1], Ref(supres, -1));
sl = ssl[BarCount-1];
 
printf("Last " + sig + " Signal came " + (BarCount-bars) + " bars ago");
printf("\n" + sig + " @ : " + entry + "\nStop Loss : " + sl + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"+ "\nTarget_1 : " + tar1 + "\nTarget_2 : " + tar2 + "\nTarget_3 : " + tar3);
printf("\nCurrent P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2));
 
if (intraday == 0) {
  GfxSelectFont( "Tahoma", 13, 500 );
  GfxSetBkMode( 1 );
  GfxSetTextColor( colorWhite );
 
  if (sig =="BUY")
    GfxSelectSolidBrush( colorGreen ); // this is the box background color
  else
    GfxSelectSolidBrush( colorOrange ); // this is the box background color
 
  pxHeight = Status( "pxchartheight" ) ;
  xx = Status( "pxchartwidth");
  Left = 800;
  width =310;
  x = 10;
  x2 = 160;
 
  y = Status( "pxchartheight" );
 
  GfxSelectPen( colorDarkRed, 1); // broader color
  GfxRoundRect( x, y - 600, x2, y , 5, 5 ) ;
  
   
  GfxTextOut( ("" + WriteIf(sig =="Buy",sig + " @ ",sig + " @") + " : " + entry) ,13, y-460);
  GfxTextOut( ("Trailing SL : " + sl + " "), 13, y-440);
  GfxTextOut( ("TGT:1 : " + tar1), 13, y -420);
  GfxTextOut( ("TGT:2 : " + tar2), 13,y-400);
GfxTextOut( ("TGT:3 : " + tar3), 13,y-380);
GfxTextOut( ("TGT:4 : " + tar4), 13,y-340);
GfxTextOut( ("TGT:5: " + tar5), 13,y-320);
GfxTextOut( ("TGT:6 : " + tar6), 13,y-300);
GfxTextOut( ("TGT:7 : " + tar7), 13,y-280);
GfxTextOut( ("TGT:8: " + tar8), 13,y-260);
GfxTextOut( ("TGT:9 : " + tar9), 13,y-240);
GfxTextOut( ("TGT:10 : " + tar10), 13,y-200);
GfxTextOut( ("TGT:11 : " + tar11), 13,y-180);
GfxTextOut( ("TGT:12: " + tar12), 13,y-160);
GfxTextOut( ("TGT:13 : " + tar13), 13,y-140);
GfxTextOut( ("TGT:14 : " + tar14), 13,y-120);
GfxTextOut( ("TGT:15: " + tar15), 13,y-100);
GfxTextOut( ("TGT:16: " + tar16), 13,y-80);
 
 
 
 
}
 
 
 
 
 
 
 
/* -------------------------------------------------------------------------------------- */
 
////////////////////////////////////////////////////////////////////////////////////////////////
 
 
 
m=IIf(ParamList("select type","Message Board|Message Board1")=="Message Board",-1,0);
 
 
messageboard = ParamToggle("Message Board1","Show|Hide",0);
showsl = ParamToggle("Stop Loss Line", "Show|Hide", 0);
m1 = ParamToggle("Message Board1","Show|Hide",0);
 
style = a * styleStaircase + b * styleStaircase;
 
PlotShapes(a,style, IIf(a,colorGreen,colorRed), 0, IIf(a,Low,High));
if (showsl == 0) Plot(supres,"Stop Loss",colorCustom14,styleDots);
exitlong = Cross(supres, H);
PlotShapes(exitlong * shapeNone, colorBlack,0,H,-10);
exitshort = Cross(L, supres);
PlotShapes(exitshort * shapeNone, colorBlack,0,L,-15);
 
Buy = exitshort;
Sell = exitlong;
//Short = Sell;
//Cover = Buy;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
//Short = ExRem(Short, Cover);
//Cover = ExRem(Cover, Short);
AlertIf( Buy, "", "BUY @ " + C, 1 );
AlertIf( Sell, "", "SELL @ " + C, 2 );
 
for (i=BarCount-1; i>1; i--) {
  if (Buy[i] == 1) {
    entry = O[i];
    sig = "BUY";
    sl = supres[1];
    tar1 = entry + (entry * .0090);
    tar2 = entry + (entry * .0150);
    tar3 = entry + (entry * .0250);
    tar4 = entry + (entry * .0350);
    tar5 = entry + (entry * .0450);
    tar6 = entry + (entry * .0550);
tar7 = entry + (entry * .0650);
    tar8 = entry + (entry * .0750);
 tar9 = entry + (entry * .1000);
 
    bars = i;
    i = 0;
  }
  if (Sell[i] == 1) {
    sig = "SELL";
    entry = O[i];
    sl = supres[i];
    tar1 = entry - (entry * .0090);
    tar2 = entry - (entry * .0150);
    tar3 = entry - (entry * .0250);
 
 tar4 = entry - (entry * .0325);
    tar5 = entry - (entry * .0500);
    tar6 = entry - (entry * .0750);
tar7 = entry - (entry * .0850);
    tar8 = entry - (entry * .0950);
    tar9 = entry - (entry * .1000);
 
 
 
    bars = i;
    i = 0;
  }
}
 
Offset = 20;
Clr = IIf(sig == "BUY", colorLime, colorRed);
ssl = IIf(bars == BarCount-1, supres[BarCount-1], Ref(supres, -1));
sl = ssl[BarCount-1];
 
printf("Last " + sig + " Signal came " + (BarCount-bars) + " bars ago");
printf("\n" + sig + " @ : " + entry + "\nStop Loss : " + sl + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"+ "\nTarget_1 : " + tar1 + "\nTarget_2 : " + tar2 + "\nTarget_3 : " + tar3);
printf("\nCurrent P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2));
 
if (messageboard == 0) {
  GfxSelectFont( "Tahoma", 13, 100 );
  GfxSetBkMode( 1 );
  GfxSetTextColor( colorWhite );
 
  if (sig =="BUY")
    GfxSelectSolidBrush( colorDarkRed ); // this is the box background color
  else
    GfxSelectSolidBrush( colorRed ); // this is the box background color
 
  pxHeight = Status( "pxchartheight" ) ;
  xx = Status( "pxchartwidth");
  CENTER = 20;
  width =31;
  x = 2;
  x20 = 180;
 
  y = Status( "pxchartheight" );
 
  GfxSelectPen( colorDarkRed, 1); // broader color
  GfxRoundRect( x, y - 400, x20, y , 7, 7 ) ;
   
  GfxTextOut( Name(),13,y-398);
 
  GfxTextOut( ("" + WriteIf(sig =="BUY",sig + " @ ",sig + " @") + " : " + entry), 13, y-380);
  GfxTextOut( ("Trailing SL : " + sl + " "), 13, y-360);
 
  GfxTextOut( ("TGT:1 : " + tar1), 13, y -340);
  GfxTextOut( ("TGT:2 : " + tar2), 13,y-320);
 
GfxTextOut( ("TGT:3 : " + tar3), 13, y -300);
  GfxTextOut( ("TGT:4 : " + tar4), 13,y-280);
GfxTextOut( ("TGT:5 : " + tar5), 13, y -260);
  GfxTextOut( ("TGT:6 : " + tar6), 13,y-240);
 
 
 GfxTextOut( ("TGT:7 : " + tar7), 13,y-220);
GfxTextOut( ("TGT:8 : " + tar8), 13, y -200);
  GfxTextOut( ("TGT:9: " + tar9), 13,y-180);
 
  GfxTextOut( ("Current P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2)), 13, y-0);;
}
/* -------------------------------------------------------------------------------------- */
 
////////////////////////////////////////////////////////////////////////////////////////////////
 
 
 
m=IIf(ParamList("select type","Message Board|Message Board1|Message Board2")=="Message Board",-1,0);
 
 
messageboard = ParamToggle("Message Board2","Show|Hide",0);
showsl = ParamToggle("Stop Loss Line", "Show|Hide", 0);
m2 = ParamToggle("Message Board2","Show|Hide",0);
 
style = a * styleStaircase + b * styleStaircase;
 
PlotShapes(a,style, IIf(a,colorGreen,colorRed), 0, IIf(a,Low,High));
if (showsl == 0) Plot(supres,"Stop Loss",colorCustom14,styleDots);
exitlong = Cross(supres, H);
PlotShapes(exitlong * shapeNone, colorBlack,0,H,-10);
exitshort = Cross(L, supres);
PlotShapes(exitshort * shapeNone, colorBlack,0,L,-15);
 
Buy = exitshort;
Sell = exitlong;
//Short = Sell;
//Cover = Buy;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
//Short = ExRem(Short, Cover);
//Cover = ExRem(Cover, Short);
AlertIf( Buy, "", "BUY @ " + C, 1 );
AlertIf( Sell, "", "SELL @ " + C, 2 );
 
for (i=BarCount-1; i>1; i--) {
  if (Buy[i] == 1) {
    entry = O[i];
    sig = "BUY LONG TERM";
    sl = supres[1];
    tar1 = entry + (entry * .0125);
    tar2 = entry + (entry * .0250);
    tar3 = entry + (entry * .0375);
    tar4 = entry + (entry * .0500);
    tar5 = entry + (entry * .0625);
    tar6 = entry + (entry * .0800);
tar7 = entry + (entry * .0925);
    tar8 = entry + (entry * .1050);
 tar9 = entry + (entry * .1175);
 
    bars = i;
    i = 0;
  }
  if (Sell[i] == 1) {
    sig = "SELL LONG TERM";
    entry = O[i];
    sl = supres[i];
     
    tar1 = entry - (entry * .0125);
    tar2 = entry - (entry * .0250);
    tar3 = entry -(entry * .0375);
    tar4 = entry - (entry * .0500);
    tar5 = entry - (entry * .0625);
    tar6 = entry - (entry * .0800);
tar7 = entry - (entry * .0925);
    tar8 = entry - (entry * .1050);
 tar9 = entry - (entry * .1175);
 
 
 
    bars = i;
    i = 0;
  }
}
 
Offset = 20;
Clr = IIf(sig == "BUY", colorLime, colorRed);
ssl = IIf(bars == BarCount-1, supres[BarCount-1], Ref(supres, -1));
sl = ssl[BarCount-1];
 
printf("Last " + sig + " Signal came " + (BarCount-bars) + " bars ago");
printf("\n" + sig + " @ : " + entry + "\nStop Loss : " + sl + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"+ "\nTarget_1 : " + tar1 + "\nTarget_2 : " + tar2 + "\nTarget_3 : " + tar3);
printf("\nCurrent P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2));
 
if (messageboard == 0) {
  GfxSelectFont( "Tahoma", 13, 100 );
  GfxSetBkMode( 1 );
  GfxSetTextColor( colorWhite );
 
  if (sig =="BUY ")
    GfxSelectSolidBrush( colorBlue ); // this is the box background color
  else
    GfxSelectSolidBrush( colorBlack ); // this is the box background color
 
  pxHeight = Status( "pxchartheight" ) ;
  xx = Status( "pxchartwidth");
  CENTER = 20;
  width =31;
  x = 2;
  x20 = 180;
 
  y = Status( "pxchartheight" );
 
  GfxSelectPen( colorDarkRed, 1); // broader color
  GfxRoundRect( x, y - 300, x20, y , 7, 7 ) ;
   
  GfxTextOut( Name(),13,y-298);
 
  GfxTextOut( ("" + WriteIf(sig =="BUY",sig + " @ ",sig + " @") + " : " + entry), 13, y-280);
  GfxTextOut( ("Trailing SL : " + sl + " "), 13, y-260);
 
  GfxTextOut( ("TGT:1 : " + tar1), 13, y -240);
  GfxTextOut( ("TGT:2 : " + tar2), 13,y-220);
 
GfxTextOut( ("TGT:3 : " + tar3), 13, y -200);
  GfxTextOut( ("TGT:4 : " + tar4), 13,y-180);
GfxTextOut( ("TGT:5 : " + tar5), 13, y -160);
  GfxTextOut( ("TGT:6 : " + tar6), 13,y-140);
 
 
 GfxTextOut( ("TGT:7 : " + tar7), 13,y-120);
GfxTextOut( ("TGT:8 : " + tar8), 13, y -100);
  GfxTextOut( ("TGT:9: " + tar9), 13,y-80);
 
  GfxTextOut( ("Current P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2)), 13, y-0);;
}
 
 
 
 
 
_SECTION_BEGIN("pivots mw");
/***************************************/
/*SUPER PIVOT POINTS ver 1.3 day week month
by Avi b a
/***************************************/
/*
SUPER PIVOT POINTS can by used in 2 ways:
if you choose daily, the pivots are calculated from the previous day,
this can be used for daily charts.
the second option is next day for EOD charts.
for all the options available right click on the chart parameters.
to utilize all the program features you need amibroker from version 4.80.1 and
above.
enjoy!
*/
/*-----------------data------------------*/
SetChartBkColor(16 ) ;
k=IIf(ParamList("select type","daily|next day")=="daily",-1,0);
k1=-1;
TimeFrameSet(inDaily);
day_h= LastValue(Ref(H,K));
day_l= LastValue(Ref(L,K));
day_c= LastValue(Ref(C,K));
TimeFrameRestore();
 
TimeFrameSet(inWeekly);
Week_h= LastValue(Ref(H,K1));
Week_l= LastValue(Ref(L,K1));;
Week_c= LastValue(Ref(C,K1));;
TimeFrameRestore();
 
TimeFrameSet(inMonthly);
month_h= LastValue(Ref(H,K1));
month_l= LastValue(Ref(L,K1));
month_c= LastValue(Ref(C,K1));
TimeFrameRestore();
 
/*--------------------------------------*/
// day
DH=Day_h;
DL=Day_L;
DC=Day_C;
 
// DAY PIVOT Calculation
pd = ( DH+ DL + DC )/3;
sd1 = (2*pd)-DH;
sd2 = pd -(DH - DL);
sd3 = Sd1 - (DH-DL); 
rd1 = (2*pd)-DL;
rd2 = pd +(DH -DL);
rd3 = rd1 +(DH-DL);
 
// week
WH=Week_h;
WL=Week_l;
WC=Week_c;
 
// WEEK PIVOT Calculation
pw = ( WH+ WL + WC )/3;
sw1 = (2*pw)-WH;
sw2 = pw -(WH - WL);
sw3 = Sw1 - (WH-WL); 
rw1 = (2*pw)-WL;
rw2 = pw +(WH -WL);
rw3 = rw1 +(WH-WL);
 
// month
MH=month_h;
ML=month_l;
MC=month_c;
 
// MONTH PIVOT Calculation
pm = ( MH+ ML + MC )/3;
sm1 = (2*pm)-MH;
sm2 = pm -(MH - ML);
sm3 = Sm1 - (MH-ML); 
rm1 = (2*pm)-ML;
rm2 = pm +(MH -ML);
rm3 = rm1 +(MH-ML);
 
/*--------------------------------------*/
 
 
 
 
 
 
// PARAMETERS
slide =  Param("slide all",33,-1000,1000,1);
slide1 = Param("slide_day",50,0,1000,1);
slide2 = Param("slide_week",70,0,1000,1);
slide3 = Param("slide_month",90,0,1000,1);
slide_Hight =  Param("slide_Hight",0,-1000,1000,1);
 
 
SHALD = ParamList("daily Pivots", "all|selected only|hide" );
SHALW = ParamList("weekly Pivots", "selected only|all|hide" );
SHALM = ParamList("monthly Pivots", "selected only|all|hide" ); 
 
//day
PDP = ParamList("DP",   "SHOW|HIDE" ); 
PDR1 = ParamList("DR1", "SHOW|HIDE" ); 
PDR2 = ParamList("DR2", "HIDE|SHOW"  ); 
PDR3 = ParamList("DR3", "HIDE|SHOW" ); 
 
PDS1 = ParamList("DS1", "SHOW|HIDE" ); 
PDS2 = ParamList("DS2", "HIDE|SHOW" ); 
PDS3 = ParamList("DS3", "HIDE|SHOW" ); 
 
 
//week
PWP = ParamList("WP", "SHOW|HIDE" ); 
PWR1 = ParamList("WR1", "SHOW|HIDE" ); 
PWR2 = ParamList("WR2", "HIDE|SHOW" ); 
PWR3 = ParamList("WR3", "HIDE|SHOW" ); 
 
PWS1 = ParamList("WS1", "SHOW|HIDE" ); 
PWS2 = ParamList("WS2", "HIDE|SHOW" ); 
PWS3 = ParamList("WS3", "HIDE|SHOW" ); 
 
//month
PMP = ParamList("MP",   "SHOW|HIDE" ); 
PMR1 = ParamList("MR1", "SHOW|HIDE" ); 
PMR2 = ParamList("MR2", "HIDE|SHOW"  ); 
PMR3 = ParamList("MR3", "HIDE|SHOW" ); 
 
PMS1 = ParamList("MS1", "SHOW|HIDE" ); 
PMS2 = ParamList("MS2", "HIDE|SHOW" ); 
PMS3 = ParamList("MS3", "HIDE|SHOW" ); 
 
DayCOLOR = 34;
weekCOLOR =10; 
monthCOLOR =42;
/*--------------------------------------*/
// LABELS
for( i = 0; i < BarCount; i++ ) 
{
 //day
 if(i+slide1== BarCount && (PDP=="SHOW" OR SHALD=="all") && SHALD!="hide")
PlotText( "daily Pivot  "+pd ,i+slide,pd+slide_Hight ,DayCOLOR);
 if(i+slide1== BarCount && (PDR1=="SHOW" OR SHALD=="all")&& SHALD!="hide")
PlotText( "daily R1  "+rd1 ,i+slide,rd1+slide_Hight ,DayCOLOR  ); 
 if(i+slide1== BarCount && (PDR2=="SHOW" OR SHALD=="all")&& SHALD!="hide")
PlotText( "daily R2 "+rd2 ,i+slide,rd2+slide_Hight ,DayCOLOR  );
 if(i+slide1== BarCount && (PDR3=="SHOW" OR SHALD=="all")&& SHALD!="hide")
PlotText( "daily R3 "+rd3 ,i+slide,rd3+slide_Hight ,DayCOLOR  );
 
 if(i+slide1== BarCount && (PDS1=="SHOW" OR SHALD=="all")&& SHALD!="hide")
PlotText( "daily  S1 "+sd1 ,i+slide,sd1+slide_Hight ,DayCOLOR  );
 if(i+slide1== BarCount && (PDS2=="SHOW" OR SHALD=="all")&& SHALD!="hide")
PlotText( "daily  S2 "+sd2 ,i+slide,sd2+slide_Hight ,DayCOLOR  );
 if(i+slide1== BarCount && (PDS3=="SHOW" OR SHALD=="all")&& SHALD!="hide")
PlotText( "daily  S3 "+sd3 ,i+slide,sd3+slide_Hight ,DayCOLOR  );
 
 //week
 if(i+slide2== BarCount && (PWP=="SHOW"  OR SHALW=="all")&& SHALW!="hide")
PlotText( "weekly Pivot  "+pw ,i+slide,pw+slide_Hight ,weekCOLOR );
 if(i+slide2== BarCount && (PWR1=="SHOW" OR SHALW=="all")&& SHALW!="hide")
PlotText( "weekly R1  "+rw1 ,i+slide,rw1+slide_Hight ,weekCOLOR ); 
 if(i+slide2== BarCount && (PWR2=="SHOW" OR SHALW=="all")&& SHALW!="hide")
PlotText( "weekly R2 "+rw2 ,i+slide,rw2+slide_Hight ,weekCOLOR );
 if(i+slide2== BarCount && (PWR3=="SHOW" OR SHALW=="all")&& SHALW!="hide")
PlotText( "weekly R3 "+rw3 ,i+slide,rw3+slide_Hight ,weekCOLOR );
 
 if(i+slide2== BarCount && (PWS1=="SHOW" OR SHALW=="all")&& SHALW!="hide")
PlotText( "weekly S1 "+sw1 ,i+slide,sw1+slide_Hight ,weekCOLOR );
 if(i+slide2== BarCount && (PWS2=="SHOW" OR SHALW=="all")&& SHALW!="hide")
PlotText( "weekly S2 "+sw2 ,i+slide,sw2+slide_Hight ,weekCOLOR );
 if(i+slide2== BarCount && (PWS3=="SHOW" OR SHALW=="all")&& SHALW!="hide")
PlotText( "weekly S3 "+sw3 ,i+slide,sw3+slide_Hight ,weekCOLOR );
 //month 
 if(i+slide3== BarCount && (PMP=="SHOW"  OR SHALM=="all")&& SHALM!="hide")
PlotText( "monthly Pivot  "+pm ,i+slide,Pm+slide_Hight ,monthCOLOR );
 if(i+slide3== BarCount && (PMR1=="SHOW" OR SHALM=="all")&& SHALM!="hide")
PlotText( "monthly R1 "+rm1 ,i+slide,rm1+slide_Hight ,monthCOLOR );
 if(i+slide3== BarCount && (PMR2=="SHOW" OR SHALM=="all")&& SHALM!="hide")
PlotText( "monthly R2 "+rm2 ,i+slide,rm2+slide_Hight ,monthCOLOR );
 if(i+slide3== BarCount && (PMR3=="SHOW" OR SHALM=="all")&& SHALM!="hide")
PlotText( "monthly R3 "+rm3 ,i+slide,rm3+slide_Hight ,monthCOLOR );
 
 if(i+slide3== BarCount && (PMS1=="SHOW" OR SHALM=="all")&&
SHALM!="hide")PlotText( "monthly S1 "+sm1 ,i+slide,sm1+slide_Hight
,monthCOLOR);
 if(i+slide3== BarCount && (PMS2=="SHOW" OR SHALM=="all")&& SHALM!="hide")
PlotText( "monthly S2 "+sm2 ,i+slide,sm2+slide_Hight ,monthCOLOR );
 if(i+slide3== BarCount && (PMS3=="SHOW" OR SHALM=="all")&& SHALM!="hide")
PlotText( "monthly S3 "+sm3 ,i+slide,sm3+slide_Hight ,monthCOLOR );
}
/*--------------------------------------*/
// PLOTS
 style = IIf(ParamList("Chart style",
"styleCandle|styleBar")=="styleCandle",64,128);
 Plot (C,Date ()+" close",11,style);
 //day
 if ((PDP=="SHOW" OR SHALD=="all")  && SHALD!="hide") Plot (pd,"daily Pivot
",DayCOLOR,1);
 if ((PDR1=="SHOW" OR SHALD=="all") && SHALD!="hide") Plot (rd1,"daily R1
",DayCOLOR,32);
 if ((PDR2=="SHOW" OR SHALD=="all") && SHALD!="hide") Plot (rd2,"daily R2
",DayCOLOR,32);
 if ((PDR3=="SHOW" OR SHALD=="all") && SHALD!="hide") Plot (rd3,"daily R3
",DayCOLOR,32);
 
 if ((PDS1=="SHOW" OR SHALD=="all") && SHALD!="hide") Plot (sd1,"daily S1
",DayCOLOR,32);
 if ((PDS2=="SHOW" OR SHALD=="all") && SHALD!="hide") Plot (Sd2,"daily S2
",DayCOLOR,32);
 if ((PDS3=="SHOW" OR SHALD=="all") && SHALD!="hide") Plot (Sd3,"daily S3
",DayCOLOR,32);
 
//week
 if ((PWP=="SHOW"  OR SHALW=="all") && SHALW!="hide") Plot (pW,"weekly Pivot
",weekCOLOR,1);
 if ((PWR1=="SHOW" OR SHALW=="all") && SHALW!="hide") Plot (rw1,"weekly R1
",weekCOLOR,32);
 if ((PWR2=="SHOW" OR SHALW=="all") && SHALW!="hide") Plot (rw2,"weekly R2
",weekCOLOR,32);
 if ((PWR3=="SHOW" OR SHALW=="all") && SHALW!="hide") Plot (rw3,"weekly R3
",weekCOLOR,32);
 
 if ((PWS1=="SHOW" OR SHALW=="all") && SHALW!="hide") Plot (sw1,"weekly S1
",weekCOLOR,32);
 if ((PWS2=="SHOW" OR SHALW=="all") && SHALW!="hide") Plot (Sw2,"weekly S2
",weekCOLOR,32);
 if ((PWS3=="SHOW" OR SHALW=="all") && SHALW!="hide") Plot (Sw3,"weekly S3
",weekCOLOR,32);
 
 //month
 if ((PMP=="SHOW"  OR SHALM=="all") && SHALM!="hide") Plot (pm,"monthly
Pivot",monthCOLOR ,1);
 if ((PMR1=="SHOW" OR SHALM=="all") && SHALM!="hide") Plot (rm1,"monthly
R1",monthCOLOR ,32);
 if ((PMR2=="SHOW" OR SHALM=="all") && SHALM!="hide") Plot (rm2,"monthly
R2",monthCOLOR ,32);
 if ((PMR3=="SHOW" OR SHALM=="all") && SHALM!="hide") Plot (rm3,"monthly
R3",monthCOLOR ,32);
 
 if ((PMS1=="SHOW" OR SHALM=="all") && SHALM!="hide") Plot (sm1,"monthly
S1",monthCOLOR ,32);
 if ((PMS2=="SHOW" OR SHALM=="all") && SHALM!="hide") Plot (sm2,"monthly
S2",monthCOLOR ,32);
 if ((PMS3=="SHOW" OR SHALM=="all") && SHALM!="hide") Plot (sm3,"monthly
S3",monthCOLOR ,32);
 
Status
Not open for further replies.

Similar threads