Monday, 25 March 2013

Gartley




_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();
_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();
// Gartley 222 Pattern Indicator Plot
//
// Ported by Daniel Ervi from code originally posted for Wealth-Lab by Mark Conway.
// Based on the August 2003 article in Active Trader Magazine.
//
// Usage:  Gartley222(VPFactor, Tolerance, Lookback)
//         VPFactor adjusts swing size percentage (Zig Zag)
//         Tolerance adjusts percentage tolerance from ideal pattern specification
//         Lookback adjusts volatility calculation

procedure Gartley222(VPFactor, Tolerance, Lookback)
{
  F1 = 0.618;
  F2 = 0.786;
  F3 = 1.27;
  F4 = 1.618;

  // Setup volatility adjusted reversal array
  VP = 100 * ATR(Lookback) / Close;
  Reversal = int(VPFactor * VP);

  for(Bar = 50; Bar < BarCount; Bar++) 
  { 
    // Build Peak and Trough arrays
    P1    = Peak(High, Reversal[Bar]);
    P1Bar = Bar - PeakBars(High, Reversal[Bar]);
    P2    = Peak(High, Reversal[Bar], 2);
    P2Bar = Bar - PeakBars(High, Reversal[Bar], 2);
    T1    = Trough(Low, Reversal[Bar]);
    T1Bar = Bar - TroughBars(Low, Reversal[Bar]);
    T2    = Trough(Low, Reversal[Bar], 2);
    T2Bar = Bar - TroughBars(Low, Reversal[Bar], 2);

    // Test for a bullish 222
    // Trough X is T2
    // Peak A is P2
    // Trough B is T1
    // Peak C is P1
    // D is the Buy point
    D = Low[Bar];
    PTValid = (P1Bar[Bar] > T1Bar[Bar]) AND (T1Bar[Bar] > P2Bar[Bar]) AND (P2Bar[Bar] > T2Bar[Bar]);
    HLValid = (P1[Bar] < P2[Bar]) AND (T1[Bar] > T2[Bar]) AND (P1[Bar] > T1[Bar]);
    InZone  = (D < T1[Bar]) AND (D > T2[Bar]);
    if(PTValid AND HLValid AND InZone)
    {
      XA = P2[Bar] - T2[Bar];
      AB = P2[Bar] - T1[Bar];
      BC = P1[Bar] - T1[Bar];
      CD = P1[Bar] - D;
      AD = P2[Bar] - D;
      ABdXA = AB / XA; // AB should be 61.8% of XA
      C1    = (ABdXA > F1 - Tolerance) AND (ABdXA < F1 + Tolerance);
      BCdAB = BC / AB; // BC should be 61.8-78.6% of AB
      C2    = (BCdAB > F1 - Tolerance) AND (BCdAB < F2 + Tolerance);
      CDdBC = CD / BC; // CD should be 127-161.8% of BC}
      C3    = (CDdBC > F3 - Tolerance) AND (CDdBC < F4 + Tolerance);
      ADdXA = AD / XA; // AD should be 78.6% of XA}
      C4    = (ADdXA > F2 - Tolerance) AND (ADdXA < F2 + Tolerance);
      if(C1 AND C2 AND C3 AND C4)
      {
        // Bullish Gartley found.  Draw pattern.
        PlotXA = LineArray(T2Bar[Bar], T2[Bar], P2Bar[Bar], P2[Bar]);
        Plot(PlotXA, "", colorBlue, styleLine + styleThick);
        PlotAB = LineArray(P2Bar[Bar], P2[Bar], T1Bar[Bar], T1[Bar]);
        Plot(PlotAB, "", colorBlue, styleLine + styleThick);
        PlotBC = LineArray(T1Bar[Bar], T1[Bar], P1Bar[Bar], P1[Bar]);
        Plot(PlotBC, "", colorBlue, styleLine + styleThick);
        PlotCD = LineArray(P1Bar[Bar], P1[Bar], Bar, D);
        Plot(PlotCD, "", colorBlue, styleLine + styleThick);
        PlotBD = LineArray(T1Bar[Bar], T1[Bar], Bar, D);
        Plot(PlotBD, "", colorDarkBlue, styleSwingDots );
        PlotXD = LineArray(T2Bar[Bar], T2[Bar], Bar, D);
        Plot(PlotXD, "", colorDarkBlue, styleSwingDots );
        PlotXB = LineArray(T2Bar[Bar], T2[Bar], T1Bar[Bar], T1[Bar]);
        Plot(PlotXB, "", colorDarkBlue, styleSwingDots );
      }
    }

    // Test for a bearish 222
    // Peak X is P2
    // Trough A is T2
    // Peak B is P1
    // Trough C is T1
    // D is the Buy point
    D = High[Bar];
    PTValid = (T1Bar[Bar] > P1Bar[Bar]) AND (P1Bar[Bar] > T2Bar[Bar]) AND (T2Bar[Bar] > P2Bar[Bar]);
    HLValid = (T1[Bar] > T2[Bar]) AND (P1[Bar] < P2[Bar]) AND (T1[Bar] < P1[Bar]);
    InZone  = (D > P1[Bar]) AND (D < P2[Bar]);
    if(PTValid AND HLValid AND InZone)
    {
      XA = P2[Bar] - T2[Bar];
      AB = P1[Bar] - T2[Bar];
      BC = P1[Bar] - T1[Bar];
      CD = D - T1[Bar];
      AD = D - T2[Bar];
      ABdXA = AB / XA; // AB should be 61.8% of XA
      C1    = (ABdXA > F1 - Tolerance) AND (ABdXA < F1 + Tolerance);
      BCdAB = BC / AB; // BC should be 61.8-78.6% of AB
      C2    = (BCdAB > F1 - Tolerance) AND (BCdAB < F2 + Tolerance);
      CDdBC = CD / BC; // CD should be 127-161.8% of BC}
      C3    = (CDdBC > F3 - Tolerance) AND (CDdBC < F4 + Tolerance);
      ADdXA = AD / XA; // AD should be 78.6% of XA}
      C4    = (ADdXA > F2 - Tolerance) AND (ADdXA < F2 + Tolerance);
      if(C1 AND C2 AND C3 AND C4)
      {
        // Bearish Gartley found.  Draw pattern.
        PlotXA = LineArray(P2Bar[Bar], P2[Bar], T2Bar[Bar], T2[Bar]);
        Plot(PlotXA, "", colorRed, styleLine + styleThick);
        PlotAB = LineArray(T2Bar[Bar], T2[Bar], P1Bar[Bar], P1[Bar]);
        Plot(PlotAB, "", colorRed, styleLine + styleThick);
        PlotBC = LineArray(P1Bar[Bar], P1[Bar], T1Bar[Bar], T1[Bar]);
        Plot(PlotBC, "", colorRed, styleLine + styleThick);
        PlotCD = LineArray(T1Bar[Bar], T1[Bar], Bar, D);
        Plot(PlotCD, "", colorRed, styleLine + styleThick);
        PlotBD = LineArray(P1Bar[Bar], P1[Bar], Bar, D);
        Plot(PlotBD, "", colorDarkRed, styleSwingDots );
        PlotXD = LineArray(P2Bar[Bar], P2[Bar], Bar, D);
        Plot(PlotXD, "", colorDarkRed, styleSwingDots );
        PlotXB = LineArray(P2Bar[Bar], P2[Bar], P1Bar[Bar], P1[Bar]);
        Plot(PlotXB, "", colorDarkRed, styleSwingDots );
      }
    }
  }
}

Gartley222(1.0, 0.3, 2);

Plot(C,"Close", colorBlueGrey, styleBar);


Volume Weighted ADX




_SECTION_BEGIN("volume adx 1");
TP= Param("Time Periods",14,1,50);
PlusDM= IIf(High>Ref(High,-1) AND
Low>=Ref(Low,-1), High-Ref(High,-1),
IIf(High>Ref(High,-1) AND Low<Ref(Low,-1)
AND High-Ref(High,-1)>Ref(Low,-1)-Low,
High-Ref(High,-1), 0));
DIPlus= 100 * Wilders(PlusDM,TP) /ATR(TP);
Vdiplus = Sum( V * DIPlus,TP) / Sum( V,TP ); 
MinusDM= IIf(Low<Ref(Low,-1) AND
High<=Ref(High,-1), Ref(Low,-1)-Low,
IIf(High>Ref(High,-1) AND Low<Ref(Low,-1)
AND High-Ref(High,-1)<Ref(Low,-1)-Low,
Ref(Low,-1)-Low, 0));
DIMinus = 100 * Wilders(MinusDM,TP) /ATR(TP);
Vdiminus = Sum( V * DIMinus,TP) / Sum( V,TP ); 
Diff= abs(DIPlus - DIMinus);
DISum= DIPlus + DIMinus;
ADXRaw= 100 * Wilders(Diff/DISum, TP);
Vadx = Sum( V * ADXRaw,TP) / Sum( V,TP ); 
Plot (Vadx ,"Volume Weighted ADX",colorWhite,styleThick);
Plot (Vdiplus ,"DI+", colorLime,1);
Plot (Vdiminus ,"DI-",4,1);
GraphXSpace=4;
_SECTION_END();

Friday, 15 March 2013

Condolence



MACD - Daily Weekly - Amibroker AFL


AFL for Amibroker

_SECTION_BEGIN("DW MASTER MACD");
 SetChartBkColor( ParamColor("Chart Color", colorBlack));
GraphXSpace = 10;
_SECTION_BEGIN("BACKGROUD LTRS");
SetChartOptions(0,chartShowArrows|chartShowDates);
GfxSetOverlayMode(1);
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( ParamColor("Text Color", ColorHSB( 42, 42, 42 ) ));
GfxSetBkMode(0); // transparent
GfxSelectFont("Tahoma", Status("pxheight")/9 );
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/4.1 );
_SECTION_END();

k = (GetPerformanceCounter()/100)%256; 
printf("GetPerformance Counter %g",k);
GfxSelectFont("Arial Narrow", 10,700 ); 
GfxSetBkMode(1); 
GfxSetTextColor(colorYellow); 
//GfxTextOut("Dedicated to the loving memory of MY FATHER",100+k ,26); 
RequestTimedRefresh(1); 
_SECTION_END();

CellHeight = 19; 
CellWidth =100;
function PrintTrends( string, row, Col) 
{
GfxSetOverlayMode(0);
/* GfxRectangle( Col * CellWidth+100,ROW*CellHeight-55, (Col + 3 ) * CellWidth, 
(row +1 ) * CellHeight  -54); */
GfxDrawText( string, Col * CellWidth+180, 
                    row * CellHeight-54, 
                    (Col +3 ) * CellWidth, (row + 1 ) * CellHeight-54,0); 
}
GfxSetTextColor(ColorRGB(180,105,200));
TimeFrameSet( inWeekly );
StartBar=SelectedValue(BarIndex());
FinishBar = EndValue( BarIndex() );
i = Startbar;
HISTWEEK = MACD(12,26) - Signal(12,26,9);
todayHISTWEEK  = TimeFrameExpand(HISTWEEK  , inWeekly)  ; 
onedaybackHISTWEEK  =TimeFrameExpand( Ref(HISTWEEK ,-1)  , inWeekly) ;
twodaybackHISTWEEK  = TimeFrameExpand( Ref(HISTWEEK ,-2)  , inWeekly) ;
WEEKNEWTRENDUP = (todayHISTWEEK  [i] > onedaybackHISTWEEK  [i])   AND (onedaybackHISTWEEK  [i] <= twodaybackHISTWEEK [i]);
WEEKNEWTRENDDN = (todayHISTWEEK  [i] > onedaybackHISTWEEK [i])   AND (onedaybackHISTWEEK  [i] >= twodaybackHISTWEEK  [i]);
if( (todayHISTWEEK  [i] > onedaybackHISTWEEK  [i])   AND (onedaybackHISTWEEK  [i] <= twodaybackHISTWEEK [i]))
{
GfxSetTextColor(colorLime); 
//PrintTrends("New Trend Up",3,3); 
GfxTextOut("WEEKLY > New Trend Up",400,1.5 );
}
if( (todayHISTWEEK  [i] < onedaybackHISTWEEK [i])   AND (onedaybackHISTWEEK  [i] >= twodaybackHISTWEEK [i]) )
{
GfxSetTextColor(colorOrange); 
//PrintTrends("New Trend Down",3,3); 
GfxTextOut("WEEKLY > New Trend Down",400,1.5 ); 
}
if((todayHISTWEEK  [i] > onedaybackHISTWEEK [i])   AND (onedaybackHISTWEEK  [i] >= twodaybackHISTWEEK  [i])
)
{
GfxSetTextColor(colorLime); 
//PrintTrends("Trend Up",3,3); 
GfxTextOut("WEEKLY > Trend Up",400,1.5 ); 
}
if( (todayHISTWEEK  [i]< onedaybackHISTWEEK [i])   AND (onedaybackHISTWEEK  [i] <= twodaybackHISTWEEK  [i])
 )
{
GfxSetTextColor(colorOrange); 
//PrintTrends("Trend Down",3,3); 
GfxTextOut("WEEKLY > Trend Down",400,1.5 ); 
}
TimeFrameRestore();
Plot(TimeFrameExpand(HISTWEEK , inWeekly), "IFT_5m", colorOrange, styleThick);
TimeFrameSet(inDaily);
DMACD = MACD(12,26) - Signal(12,26,9);
mycolor=IIf(MACD(12,26)<0 AND MACD(12,26)>Signal(12,26,9),ColorRGB(48,170,255),IIf(MACD(12,26)>0 AND MACD(12,26)>Signal(12,26,9),ColorRGB(181,222,251),IIf(MACD(12,26)>0 AND MACD(12,26)<Signal(12,26,9),ColorRGB(255,201,123),ColorRGB(125,84,11))));
Plot(0,"",colorRed,styleThick);
MACD0crossup = Cross(MACD(12,26),Signal(12,26,9));
MACD0crossdw = Cross(Signal(12,26,9),MACD(12,26));
PlotShapes(shapeSmallCircle*MACD0crossup,colorLime,0,0.25,0);
PlotShapes(shapeSmallCircle*MACD0crossdw,colorPink,0,-0.25,0);
Plot(TimeFrameExpand(DMACD, inDaily), "dAILY", mycolor, styleHistogram);
TimeFrameRestore();
HISTDAILY = MACD(12,26) - Signal(12,26,9);
todayHISTDAILY  = HISTDAILY  ;
onedaybackHISTDAILY  = Ref(HISTDAILY ,-1);
twodaybackHISTDAILY  = Ref(HISTDAILY ,-2);
if( (todayHISTDAILY  [i] > onedaybackHISTDAILY  [i])   AND (onedaybackHISTDAILY  [i] <= twodaybackHISTDAILY [i]))
{
GfxSetTextColor(colorLime); 
//PrintTrends("New Trend Up",4,3); 
GfxTextOut("New Trend Up",400,15); 
}
if( (todayHISTDAILY  [i] < onedaybackHISTDAILY [i])   AND (onedaybackHISTDAILY  [i] >= twodaybackHISTDAILY [i]) )
{
GfxSetTextColor(colorOrange); 
//PrintTrends("New Trend Down",4,3); 
GfxTextOut("New Trend Down",400,15); 
}
if((todayHISTDAILY  [i] > onedaybackHISTDAILY [i])   AND (onedaybackHISTDAILY  [i] >= twodaybackHISTDAILY  [i])
)
{
GfxSetTextColor(colorLime); 
//PrintTrends("Trend Up",4,3); 
GfxTextOut("Trend Up",400,15); 
}
if( (todayHISTDAILY  [i]< onedaybackHISTDAILY [i])   AND (onedaybackHISTDAILY  [i] <= twodaybackHISTDAILY  [i])
)
{
GfxSetTextColor(colorOrange); 
//PrintTrends("Trend Down",4,3); 
GfxTextOut("Trend Down",400,15); 
}
GfxSetTextAlign( TA_left = 0);
GfxSelectFont("Tahoma", 11, 700 ); 
GfxSetTextColor(ColorRGB(230,100,200)); 
GfxTextOut("DAILY WEEKLY  MACD",07, 0); 
GfxSetTextAlign( TA_LEFT = 0 );
GfxSelectFont("Tahoma", 11, 700 ); 
GfxSetTextColor(ColorRGB(255,180,61)); 
GfxTextOut(Name()+ "   " + Date(),07,18); 
 Title = " "; 
_SECTION_END();


Tuesday, 12 March 2013

Bollinger Bands - Summary



Bollinger Bands was developed by John Bollinger. It allows users to compare volatility and relative price levels over a period of time. Bollinger Bands are envelopes surrounding the price candles on the chart. They are plotted two standard deviations away from simple moving average. Standard Deviation being a measure of volatility the bands adjusts themselves to ongoing market conditions.

They widen during volatile markets and contract during less volatile periods.


Three Primary Uses of Bollinger Bands are

Pattern recognition
Recognize double tops, head and shoulders, double bottoms

Reversal signals
Identify early warning signs of reversals

Trend analysis
Detect trend continuation and conclusion


Concepts of Bollinger Bands

  • Tags of bands are not necessarily buy/sell signals
  • Closes outside BBs can be continuation signals if confirmed by other indicators
  • Contraction (The Squeeze) is followed by Expansion, is followed by Contraction….
  • BBs are based on a simple moving average. Default is 20 period MA with 2 standard deviations.
  • Default contains 95% of price action
  • Works well on most time frames
  • Longer term: 50 periods MA, 2.1 std. deviation.
  • Shorter term: 10 periods MA, 1.9 std. deviation.
  • A Bollinger Band doesn’t give buy/ sell signals. Use Bollinger Bands with other indicators for confirmations

 Remember…your first priority is always to conserve your capital!

Stochastic Oscillator - Amibroker AFL



AFL for Amibroker
===================================================
_SECTION_BEGIN("BACK COLR");
_SECTION_BEGIN("PRASAD SYSTEMS");
Param("DEDICATED TO MY FATHER",5);
_SECTION_END();
GfxSetOverlayMode(1); 
SetChartBkColor( ParamColor("Chart Color", colorBlack));
GfxSetOverlayMode(1);
GfxSelectFont("Tahoma", Status("pxheight")/20 ); /* Up down name*/
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( ParamColor("Text Color", ColorHSB( 42, 42, 42 ) ));
GfxSetBkMode(0); // transparent
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/7);
GfxSelectFont("Tahoma", Status("pxheight")/30 );
GfxTextOut( IndustryID(1), Status("pxwidth")/2, Status("pxheight")/5 );  /* Up Down Sector*/

GfxSelectFont("Tahoma", Status("pxheight")/40 );
GfxTextOut( "Feedback prasad9rao@gmail.com", Status("pxwidth")/2, Status("pxheight")/4);
GfxSelectFont("Tahoma", Status("pxheight")/20 );
GfxTextOut( " BALKRISHNA STOCHASTICS CHARTS ", Status("pxwidth")/2, Status("pxheight")/15 );

_SECTION_END();
  
/*************** remove all above lines for Amibroker 5.00 or less than 5
  
/**************************************************
                Stochastics
***************************************************/

SP = Param( "Periods", 10, 1, 200, 1 );
Ksmooth = Param( "%K avg", 5, 1, 200, 1 );
Dsmooth = Param( "%D avg", 5, 1, 200, 1 );
StochDval = StochD( SP , Ksmooth, DSmooth );
StochKval = StochK( SP , Ksmooth);

Overbought = 80;
Oversold = 20;
  
mycolorst =IIf(Stochkval- Stochdval<0,ColorRGB(248,18,25),IIf(Stochkval- Stochdval>0,ColorRGB(51,122,51),ColorRGB(125,84,11)));
  
Plot(Stochkval- Stochdval ,"",mycolorst ,styleHistogram);
Plot( Stochkval- Stochdval, "Premier", colorWhite, styleThick );

StochBuy = Cross(StochK(SP,Ksmooth), StochD(SP,Ksmooth, DSmooth)) AND
(StochD(SP,Ksmooth, DSmooth) > 20) AND (StochK(SP,Ksmooth) > 20) AND
(StochD(SP,Ksmooth, DSmooth) < 80) AND (StochK(SP,Ksmooth) < 80);
StochSell = Cross (StochD(SP,Ksmooth, DSmooth), StochK(SP,Ksmooth)) AND
(StochD(SP,Ksmooth, DSmooth) > 20) AND (StochK(SP,Ksmooth) > 20) AND
(StochD(SP,Ksmooth, DSmooth) < 80) AND (StochK(SP,Ksmooth) < 80);
StochStrongBuy = Cross(StochK(SP,Ksmooth),StochD(SP,Ksmooth, DSmooth)) AND
(StochD(SP,Ksmooth, DSmooth) < 20) AND (StochK(SP,Ksmooth) < 20) ;
StochStrongSell = Cross (StochD(SP,Ksmooth,DSmooth), StochK(SP , Ksmooth));
(StochD(SP,Ksmooth, DSmooth) > 80) AND (StochK(SP,Ksmooth) > 80);

//****************** BULLISH / BEARISH *******************/
StochBull = StochK(SP , Ksmooth)>StochD(SP , Ksmooth, DSmooth) AND
(StochD(SP,Ksmooth, DSmooth) > 20) AND (StochK(SP,Ksmooth) > 20) AND
(StochD(SP,Ksmooth, DSmooth) < 80) AND (StochK(SP,Ksmooth) < 80);
StochBear = StochK(SP , Ksmooth)<StochD(SP , Ksmooth, DSmooth)AND
(StochD(SP,Ksmooth, DSmooth) > 20) AND (StochK(SP,Ksmooth) > 20) AND
(StochD(SP,Ksmooth, DSmooth) < 80) AND (StochK(SP,Ksmooth) < 80);
StochOB = (StochD(SP,Ksmooth, DSmooth) > 80) AND (StochK(SP,Ksmooth) > 80);
StochOS = (StochD(SP,Ksmooth, DSmooth) < 20) AND (StochK(SP,Ksmooth) < 20) ;
Title = EncodeColor(colorYellow)+  Title = Name() + "    " + EncodeColor(2) + Date()  + "    "
  
/********************STOChASTICS*********************/

+EncodeColor(colorWhite)+"Signal(Stochastics) "+EncodeColor(colorWhite)+"Period = "+"["+SP+"]"+"      %K = "+"["+Ksmooth+"]"+ "      %D = "+"["+Dsmooth+"]"+"   ::::   "
 + WriteIf(StochBuy,EncodeColor(colorBrightGreen)+"Buy",WriteIf(StochSell,EncodeColor(colorRed)+"Sell",
WriteIf(StochStrongBuy,EncodeColor(colorBrightGreen)+"Strong Buy",WriteIf(StochStrongSell,EncodeColor(colorRed)+"Strong Sell","Neutral"))))
+EncodeColor(colorWhite)+ "    " + "Stochastics Trend  = "
+WriteIf(StochBull,EncodeColor(colorBrightGreen)+"Bullish",WriteIf(StochBear,EncodeColor(colorRed)+"Bearish",
WriteIf(StochOS,EncodeColor(colorBrightGreen)+"OverSold",WriteIf(StochOB,EncodeColor(colorRed)+"OverBrought","Neutral"))));

Volume Weighted MACD - Amibroker AFL


AFL for Amibroker
===========================================

_SECTION_BEGIN("BACKGROUD LTRS");
SetChartOptions(0,chartShowArrows|chartShowDates);
GfxSetOverlayMode(1);
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( ParamColor("Text Color", ColorHSB( 42, 42, 42 ) ));
GfxSetBkMode(0); // transparent
GfxSelectFont("Tahoma", Status("pxheight")/12);
GfxTextOut( "PRASAD ANALYTICS ©", Status("pxwidth")/2, Status("pxheight")/14);
GfxSelectFont("Tahoma", Status("pxheight")/9 );
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/4.1 );
GfxSelectFont("Arial Narrow", Status("pxheight")/28 );
GfxTextOut( "prasad9rao@gmail.com", Status("pxwidth")/2, Status("pxheight")/1.5);
GfxSelectFont("arial narrow", Status("pxheight")/27 );
GfxTextOut( "Dedicated to MY FATHER : BALKRISHNA RAO", Status("pxwidth")/2, Status("pxheight")/1.15);
_SECTION_END();

k = (GetPerformanceCounter()/100)%256;
printf("GetPerformance Counter %g",k);
GfxSelectFont("Arial Narrow", 10,700 );
GfxSetBkMode(1);
GfxSetTextColor(colorYellow);
//GfxTextOut("Dedicated to the loving memory of MY FATHER",100+k ,26);
RequestTimedRefresh(1);
_SECTION_END();

PeriodS = Param("Short period", 12, 1, 500 );
PeriodL = Param("Long period", 26, 2, 501 );
PeriodSig = Param("Smoothing period", 9, 1, 200 );
LongMA = EMA( V * C, PeriodL ) / EMA( V, PeriodL );
ShortMA = EMA( V * C, PeriodS ) / EMA( V, PeriodS );
VMACD = ShortMA - LongMA;
SignalLine = EMA( VMACD, PeriodSig );
HIST = VMACD-SignalLine;
//Uncomment two lines below to see also MACD and signal line
Plot( VMACD, "Vol-weighted MACD", colorDarkRed );
Plot( SignalLine, "Vol-weighted Signal", colorWhite);
Plot( VMACD-SignalLine, "VMACD Histogram", colorGold, styleHistogram );
RATEADOFMACDCHANGE = (HIST - Ref(HIST,-1)) ;

GfxSetTextAlign( TA_left = 0);
GfxSelectFont("Tahoma", 11, 700 );
GfxSetTextColor(ColorRGB(209,191,255));
GfxTextOut("PRASAD ANALYTICS - VWMACD",07, 0);

GfxSetTextAlign( TA_LEFT = 0 );
GfxSelectFont("Tahoma", 11, 700 );
GfxSetTextColor(ColorRGB(255,180,61));
GfxTextOut(Name()+ "   " + Date(),07,30);
GfxSetTextColor(ColorRGB(109,101,255));
GfxTextOut("VWMACD["+PeriodS+" ]"+"["+PeriodL+"]" + "["+PeriodSig+"]",07, 14);
GfxSetTextColor(ColorRGB(251,194,255));
GfxTextOut("Signal =" + NumToStr(SignalLine,1.2),255, 0);
GfxSetTextColor(ColorRGB(251,194,255));
GfxTextOut("VMACD =" + NumToStr(VMACD,1.2),375, 0);
GfxSetTextColor(ColorRGB(251,194,255));
GfxTextOut("Hist =" + NumToStr(VMACD-SignalLine,1.2),500, 0);
GfxSetTextColor(ColorRGB(251,194,255));
GfxTextOut("rATE OF cHANGE =" + NumToStr(RATEADOFMACDCHANGE,1.2),650, 0); 


Title = " ";

Chaikin Money Flow + ADX - Amibroker AFL

Combining Indicators Helps in Selecting Perfect Stocks at the Right Time


AFL for Amibroker
==============================================================
/// PROGRAMME MODIFIED BY PRASAD RAO FOR MASTER PLOTTER ///

_SECTION_BEGIN("BACK COLR");
_SECTION_BEGIN("PRASAD SYSTEMS");
Param("DEDICATED TO MY FATHER",5);
_SECTION_END();
SetChartBkColor( ParamColor("Chart Color", colorBlack));

_SECTION_BEGIN("BACKGROUD LTRS");
SetChartOptions(0,chartShowArrows|chartShowDates);
GfxSetOverlayMode(1);
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( ParamColor("Text Color", ColorHSB( 42, 42, 42 ) ));
GfxSetBkMode(0); // transparent
GfxSelectFont("Tahoma", Status("pxheight")/12);
GfxTextOut( "HOLY GRAIL ©", Status("pxwidth")/2, Status("pxheight")/14);
GfxSelectFont("Tahoma", Status("pxheight")/9 );
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/4.1 );
GfxSelectFont("arial narrow", Status("pxheight")/27 );
GfxTextOut( "Dedicated to MY FATHER : BALKRISHNA RAO", Status("pxwidth")/2, Status("pxheight")/1.15);
_SECTION_END();
MACDKOL1 = ParamColor("m1",ColorRGB(20,47,200));
MACDKOL2= ParamColor("m2",ColorRGB(128,2,250));
ADKOL = ParamColor("ADX",colorWhite);
PDXKOL = ParamColor("PDX",ColorRGB(147,255,0));
NDXKOL = ParamColor("NDX",colorRed);

_SECTION_BEGIN("ADX TEST");
range = Param("Range",14,3,60,1);
px = PDI(14);
nx = MDI(14);
ax = ADX(14);
ax = Prec(ax,2);
Line_Control = 20;
ADXSlope = ADX(range) - Ref(ADX(Range),-1); 
/// Plots
Plot(Line_Control,"",colorWhite,styleDashed|styleLeftAxisScale );
Plot(px,"+DI",PDXKOL,styleDots|styleThick| styleLeftAxisScale );
Plot(nx,"-DI",NDXKOL,styleDots|styleThick|styleLeftAxisScale );
Plot(ax,"ADX",ADKOL,styleDots|styleThick|styleLeftAxisScale );

StartBar=SelectedValue(BarIndex());
FinishBar = EndValue( BarIndex() );
i = Startbar;

CMF= Sum(((( C-L )-( H-C )) / ( H-L ))*V, 21 ) / Sum(V,21);
mycolor=IIf(CMF<0,MACDKOL2,IIf(CMF>0,MACDKOL1,ColorRGB(125,84,11)));
Plot(CMF, "MACD Histogram", mycolor, styleHistogram | styleThick| styleNoLabel, styleOwnScale);
GfxSetTextAlign( TA_left = 0);
GfxSelectFont("Tahoma", 11, 700 );
GfxSetTextColor(ColorRGB(209,191,255));
GfxTextOut("HOLY GRAIL - ADX-CMF -ADX 14",07, 0);
GfxSetTextAlign( TA_LEFT = 0 );
GfxSelectFont("Tahoma", 11, 700 );
GfxSetTextColor(ColorRGB(255,180,61));
GfxTextOut(Name()+ "   " + Date(),07,20);

Title ="";
_SECTION_END();

Hindustan Unilever Ltd. - Looking Good


Hindustan Lever looking good from here

/* begin page number */