1/1/16

Code Amibroker: EWO and EW Oscillator Breaking Bands


EWO CODE
===========================
_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( "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")/27 );
GfxTextOut( "Dedicated to MY FATHER : BALKRISHNA RAO", Status("pxwidth")/2, Status("pxheight")/1.15);
_SECTION_END();
  



_SECTION_BEGIN("MACD Plotter ver 3");

/**********************************************************
 /MACD Cross
***********************************************************/



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




EWODAILY =  EMA(C,5) - EMA(C,34);

SIG =  EMA(EWODAILY,5);

GfxSelectFont("Tahoma", 11, 700 ); 

todayEWODAILY    = EWODAILY  ; 
onedaybackEWODAILY    =Ref(EWODAILY  ,-1);
twodaybackEWODAILY   =  Ref(EWODAILY  ,-2)  ;

if( (todayEWODAILY   [i] > onedaybackEWODAILY   [i])   AND (onedaybackEWODAILY   [i] <= twodaybackEWODAILY  [i]))
{
GfxSetTextColor(ColorRGB(186,236,94)); 
GfxTextOut("New Trend Up",400,1);
}
if( (todayEWODAILY   [i] < onedaybackEWODAILY  [i])   AND (onedaybackEWODAILY   [i] >= twodaybackEWODAILY  [i]) )
{
GfxSetTextColor(colorBlack); 
GfxTextOut("New Trend Dn",400,1);
}

if((todayEWODAILY   [i] > onedaybackEWODAILY  [i])   AND (onedaybackEWODAILY   [i] >= twodaybackEWODAILY   [i])
)
{
GfxSetTextColor(ColorRGB(221,248,112)); 
GfxTextOut("Trend Up",400,1);
}

if( (todayEWODAILY   [i]< onedaybackEWODAILY  [i])   AND (onedaybackEWODAILY   [i] <= twodaybackEWODAILY   [i])
                       )
{
GfxSetTextColor(ColorRGB(248,113,113)); 
GfxTextOut("Trend Dn",400,1);
}



EWODAILY_ZEROCRUP = Cross(EWODAILY ,0);
EWODAILY_ZEROCRDN = Cross(0,EWODAILY );


if(EWODAILY_ZEROCRUP[I])
{
GfxSetTextColor(ColorRGB(221,248,112)); 
GfxTextOut("Zero Cross Up",550,1);
}


if(EWODAILY_ZEROCRDN[I])
{
GfxSetTextColor(ColorRGB(248,113,113)); 
GfxTextOut("Zero Cross Dn",550,1);
}



mycolor=IIf(EWODAILY <0 f="" olorrgb="">0 ,ColorRGB(151,220,150),colorWhite));

Plot(EWODAILY , "EWODAILY ", mycolor, styleHistogram | styleThick| styleNoLabel, styleOwnScale);



  
Plot(SIG ,"",colorBlack,styleLine|styleThick);





/****************************************************
                   CHART TITLES
****************************************************/

  
/****************************************************
                   CHART TITLES
****************************************************/


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





GfxSetTextAlign( TA_LEFT = 0 );
GfxSelectFont("Tahoma", 11, 700 ); 
GfxSetTextColor(ColorRGB(255,180,61)); 
GfxTextOut(Name()+ "   " + Date(),07,20); 





  


Title =

"\n";
  
  
  
   


_SECTION_END();
============================
EW Oscillator Breaking Bands
============================
_SECTION_BEGIN("EW Oscillator Breaking Bands");

/***
Reference to Picture in:
http://www.traderslaboratory.com/forums/trading-indicators/7319-ew-oscillator-breaking-bands.html

--Converted by Kelvinhand --

***/

K=1;
K2=0.0555;
Len=5;


//-- 
MP = (H+L)/2;
Price1 =MA(MP,5) - MA(MP,35) ;
AvgP = EMA(Price1,Len);


clr = IIf(AvgP > 0, ColorRGB(183,179,142), IIf(AvgP < 0, ColorRGB(110,136,177), colorGrey50));
Plot(AvgP, "AvgP", clr, styleNoLabel|styleHistogram|styleThick);


clr = IIf(Price1 > 0, colorYellow, IIf(Price1 < 0, colorBlue, colorGrey50));
Plot(Price1, "Osc535", clr, styleNoLabel|styleHistogram|styleThick);



for(i=0; i<40 i="" span="">
UpperBand[i] =LowerBand[i]= Price1[i];



for(i=40; i
{

  if (Price1[i]>0)
  {
     UpperBand[i] = UpperBand[i-1]+ K2*(K*Price1[i] - UpperBand[i-1]);
     LowerBand[i] = LowerBand[i-1];
  }
  else
  {

     UpperBand[i] = UpperBand[i-1];
     LowerBand[i] = LowerBand[i-1]+ K2*(K*Price1[i] - LowerBand[i-1]);
  }


}


Plot(UpperBand, "upper", colorWhite, styleNoLabel);
Plot(LowerBand, "lower", colorWhite, styleNoLabel);
PlotGrid(0, colorWhite );


_SECTION_END();

0 Nhận xét :

Đăng nhận xét