Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

bharathypivote33 for Amibroker (AFL)

Copy & Paste Friendly

TimeFrameSet(inDaily);
DayHigh = LastValue(H);
DayLow = LastValue(L);
DayOpen = LastValue(O);
DayClose = LastValue(C);
TimeFrameRestore();
//_SECTION_BEGIN("Pivot")
	YH = TimeFrameGetPrice("H", inDaily, -1);	YHI = LastValue (YH,1); 	// yesterdays high
	YL = TimeFrameGetPrice("L", inDaily, -1);	//				low
	YC = TimeFrameGetPrice("C", inDaily, -1);		//				close
	YO = TimeFrameGetPrice("O", inDaily);			// current day open
   WYH = TimeFrameGetPrice("H", inWeekly, -1);		
	WYL = TimeFrameGetPrice("L", inWeekly, -1);		
	WYC = TimeFrameGetPrice("C", inWeekly, -1);		
	WYO = TimeFrameGetPrice("O", inWeekly);	
   MYH = TimeFrameGetPrice("H", inMonthly, -1);		
	MYL = TimeFrameGetPrice("L", inMonthly, -1);		
	MYC = TimeFrameGetPrice("C", inMonthly, -1);		
	MYO = TimeFrameGetPrice("O", inMonthly);
Hclose=HHV(H,11111252);
Lclose= LLV(L,11111252);	

	//Normal Pivot
	PP = (YH + YL + YC) / 3;
	R1 = PP+0.382*(YH-YL); R1I = LastValue (R1,1.2); 
	R2 = PP +0.618* (YH - YL);
	R3 = PP+1*(YH-YL);
	S1 = PP-0.382*(YH-YL);
	S2 = PP -0.681*(YH-YL);
	S3 = PP-1*(YH-YL) ;
   BuyA =(PP+R1)/2;
   SellA = (PP+S1)/2;  
GfxSetOverlayMode( mode = 0 );  
GfxSelectPen( colorDarkRed, 3 );  
GfxSelectSolidBrush( colorWhite  );  
GfxRoundRect( 20, 82, 200, 430, 400, 0 );  
GfxSetBkMode(1);  
GfxSelectFont( "Arial", 10, 900, False ); 
GfxSetTextColor( colorBlue  ); 
GfxSetTextAlign(0);
GfxTextOut( WriteIf(YH, "Pivot.:   "+NumToStr(PP,1.2,True),""), 30, 85);
GfxSelectFont( "Arial", 15, 900, False ); 
GfxSetTextColor( colorWhite  ); 
GfxSetTextAlign(0);



GfxSelectFont( "Arial", 10, 900, False );
GfxSetTextColor( colorDarkGreen  ); 
GfxTextOut(WriteIf(BuyA,"Buy:      "+NumToStr(BuyA,1.2,True),""),30, 112);
GfxSetTextColor( colorGreen  ); 
GfxTextOut( WriteIf(R1, "TGT1:    "+NumToStr(R1,1.2,True),""), 30, 145); 
GfxTextOut( WriteIf(R2, "TGT2:    "+NumToStr(R2,1.2,True),""), 30, 185); 
GfxTextOut( WriteIf(R3, "TGT3:    "+NumToStr(R3,1.2,True),""), 30, 225); 
GfxSetTextColor( colorDarkRed   );  
GfxTextOut(WriteIf(SellA,"Sell:      "+NumToStr(SellA,1.2,True),""),30, 260);
GfxSetTextColor( colorRed   ); 
GfxTextOut( WriteIf(S1, "St1:       "+NumToStr(S1,1.2,True),""), 30, 305); 
GfxTextOut( WriteIf(S2, "St2:       "+NumToStr(S2,1.2,True),""), 30, 345); 
GfxTextOut( WriteIf(S3, "St3:       "+NumToStr(s3,1.2,True),""), 30, 385); 

	WYH = TimeFrameGetPrice("H", inWeekly, -1);		
	WYL = TimeFrameGetPrice("L", inWeekly, -1);		
	WYC = TimeFrameGetPrice("C", inWeekly, -1);		
	WYO = TimeFrameGetPrice("O", inWeekly);			

	//Week Pivot 
   WPP = (WYH + WYL + WYC) / 3;
	WR1 = WPP+0.382*(WYH-WYL);
	WR2 = WPP +0.618* (WYH -WYL);
	WR3 = WPP+1*(WYH-WYL);
	WS1 = WPP-0.382*(WYH-WYL);
	WS2 = WPP -0.681*(WYH-WYL);
	WS3 = WPP-1*(YH-YL) ;
   WBuyA =(WPP+WR1)/2;
   WSellA = (WPP+WS1)/2;  










NDays=Param("Number of Days",30,1,50,1); 
DayC=TimeFrameGetPrice("C",inDaily,-1);
NDaysDHLAvg=0;
for(i=1;i<=NDays;i++)
{
	DayH=TimeFrameGetPrice("H",inDaily,-i);
	DayL=TimeFrameGetPrice("L",inDaily,-i);
	NDaysDHLAvg=NDaysDHLAvg+(DayH-DayL);
}
NDaysDHLAvg=NDaysDHLAvg/NDays;

ADM= NDaysDHLAvg;   // Average Day Moment





WYH = TimeFrameGetPrice("H", inWeekly, -1);		
	WYL = TimeFrameGetPrice("L", inWeekly, -1);		
	WYC = TimeFrameGetPrice("C", inWeekly, -1);		
	WYO = TimeFrameGetPrice("O", inWeekly);			

	//Week Pivot 
   WPP = (WYH + WYL + WYC) / 3;
	WR1 = WPP+0.382*(WYH-WYL);
	WR2 = WPP +0.618* (WYH -WYL);
	WR3 = WPP+1*(WYH-WYL);
	WS1 = WPP-0.382*(WYH-WYL);
	WS2 = WPP -0.681*(WYH-WYL);
	WS3 = WPP-1*(YH-YL) ;
   WBuyA =(WPP+WR1)/2;
   WSellA = (WPP+WS1)/2;  






GfxSetOverlayMode( mode = 0 );  
GfxSelectPen( colorGreen, 3 );  
GfxSelectSolidBrush( colorWhite  );  
GfxRoundRect( 215, 82, 400, 430, 100, 0 );
GfxSetBkMode(1);  
GfxSelectFont( "Arial", 10, 900, False ); 
GfxSetTextColor( colorBlue); 
GfxSetTextAlign(0); 
 
GfxTextOut( WriteIf(YH, "W.Piv.:  "+NumToStr(WPP,1.2,True),"") , 220, 85);
GfxSetTextColor( colorDarkGreen  ); 
GfxTextOut(WriteIf(WBuyA,"Buy:      "+NumToStr(WBuyA,1.2,True),""),220, 112);
GfxSetTextColor( colorGreen  ); 
GfxTextOut( WriteIf(R1, "BT1:      "+NumToStr(WR1,1.2,True),""), 220, 145); 
GfxTextOut( WriteIf(R2, "BT2:      "+NumToStr(WR2,1.2,True),""), 220, 185); 
GfxTextOut( WriteIf(R3, "BT3:      "+NumToStr(WR3,1.2,True),""), 220, 225); 
GfxSetTextColor( colorDarkRed   ); 
GfxTextOut(WriteIf(WSellA,"Sell:      "+NumToStr(WSellA,1.2,True),""),220, 260);
GfxSetTextColor( colorRed   ); 
GfxTextOut( WriteIf(S1, "ST1:      "+NumToStr(WS1,1.2,True),"") , 220, 305); 
GfxTextOut( WriteIf(S2, "ST2:        "+NumToStr(WS2,1.2,True),""), 220, 345); 
GfxTextOut( WriteIf(S3, "ST3 :       "+NumToStr(WS3,1.2,True),"") , 220, 380);  




	

TimeFrameSet(inDaily);
DayHigh = LastValue(H);
DayLow = LastValue(L);
TimeFrameRestore();

YH = TimeFrameGetPrice("H", inDaily, -1);		// yesterdays high
	YL = TimeFrameGetPrice("L", inDaily, -1);		//				low
	YC = TimeFrameGetPrice("C", inDaily, -1);		//				close
	YO = TimeFrameGetPrice("O", inDaily);			// current day open


_SECTION_BEGIN("Title");

DDayO = TimeFrameGetPrice("O", inDaily);
DHiDay = TimeFrameGetPrice("H", inDaily);
DLoDay = TimeFrameGetPrice("L", inDaily);
gfr = TimeFrameGetPrice("C", inDaily, -1);//close


//Title = EncodeColor(colorYellow)+" * WayToWin Trading System * "+EncodeColor(ColorRGB(220,10,150)) +" "+ Interval(2) + " " + Date() +
//EncodeColor(ColorRGB(200,150,120)) + " \n Open " + O +
//", High : " + H +
//", Low : " + L+ EncodeColor(colorGreen) +
//" * Prevvious Day Close : " + EncodeColor(colorGreen) + gfr +EncodeColor(colorYellow)+
//"\n ToDay Open : " +DDayO + " High : " +DHiDay + " Low : "+ DLoDay;
//_SECTION_END();


pricechange=(C-Ref(C,-1))*100/Ref(C,-1);
changeponit=C-Ref(C,-1);
Vlp=Param("Volume lookback period",15,10,300,10);
Vrg=MA(V,Vlp);
St = StDev(Vrg,Vlp); 
Vp3 = Vrg + 3*st; 
Vp2 = Vrg + 2*st;;
Vp1 = Vrg + 1*st;;
Vn1 = Vrg -1*st; 
Vn2 = Vrg -2*st; 

x=Param("xposn",1,0,1000,1);
y=Param("yposn",1,0,1000,1);

GfxGradientRect( 1, 1, 1400, 40, colorGreen, colorDarkGreen);
GfxSetBkMode(0);
GfxSelectFont( "Georgia", 10, 800, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "WayToWin Trading System ", x+200, y+10 );
GfxSelectFont( "Tahoma", 10, 800, False );
GfxSetTextColor( colorGold );
GfxTextOut( Name(), x+20, y+10 );
GfxSelectFont( "Century Gothic", 10, 800, False );
GfxSetTextColor( colorWhite );
GfxTextOut( Date(), x+500, y+10 );
GfxTextOut("LTP. "+C+" ", x+720, y+10 );

//------------------------------------------------------------ H, L, O, C----------------------
GfxGradientRect( 1, 40, 1400, 65, colorGreen, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 500, False );
GfxSetTextColor( colorGold );
GfxTextOut( "     Success is not about a system, it's about YOU and how YOU trade a System   Mobile 9791010421 ", x+20, y+39 );
GfxGradientRect( 18, 430, 300, 540, colorGreen, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 12, 700, False );
GfxSetTextColor( colorGold );
GfxGradientRect( 18, 550, 300, 665, colorRed, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 12, 700, False );
GfxSetTextColor( colorGold );
GfxGradientRect( 320, 430, 600, 540, colorBlue, colorDarkBlue );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 12, 700, False );
GfxSetTextColor( colorGold );
GfxGradientRect( 320, 540, 600, 655, colorRed, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 500, False );
GfxSetTextColor( colorGold );

GfxTextOut( WriteIf(YH, "TodayLow.       : "+NumToStr(DayLow,1.2,True),"") , 20, 430);
GfxTextOut( WriteIf(YH, "TodayHigh.      : "+NumToStr(DayHigh,1.2,True),"") , 20, 460);
GfxTextOut( WriteIf(YH, "TodayOpen.     : "+NumToStr(DayOpen,1.2,True),""), 20, 490);
GfxTextOut( WriteIf(YH, "TodayClose.     : "+NumToStr(DayClose,1.2,True),"") , 20, 520);
GfxTextOut( WriteIf(YH, "YesDayLow.    : "+NumToStr(YL,1.2,True),""), 20, 550);
GfxTextOut( WriteIf(YH, "YesDayHigh.   : "+NumToStr(YH,1.2,True),"") , 20, 580);
GfxTextOut( WriteIf(YH, "YesDayopen.   : "+NumToStr(YO,1.2,True),""), 20, 610);
GfxTextOut( WriteIf(YH, "YesDayClose.  : "+NumToStr(YC,1.2,True),""), 20, 640);
GfxTextOut( WriteIf(YH, "LWeekLow.      : "+NumToStr(WYL,1.2,True),"") , 340, 430);
GfxTextOut( WriteIf(YH, "LWeekHigh.     : "+NumToStr(WYH,1.2,True),"") , 340, 460);
GfxTextOut( WriteIf(YH, "LWeekOpen.    : "+NumToStr(WYO,1.2,True),""), 340, 490);
GfxTextOut( WriteIf(YH, "LWeekClose.    : "+NumToStr(WYC,1.2,True),""), 340, 520);
GfxTextOut( WriteIf(YH, "LMonthLow.    : "+NumToStr(MYL,1.2,True),""), 340, 550);
GfxTextOut( WriteIf(YH, "LMonthHigh.   : "+NumToStr(MYH,1.2,True),""), 340, 580);
GfxTextOut( WriteIf(YH, "LMonthopen.   : "+NumToStr(MYO,1.2,True),""), 340, 610);
GfxTextOut( WriteIf(YH, "LMonthClose.  : "+NumToStr(MYC,1.2,True),""), 340, 640);
GfxTextOut( WriteIf(YH, "52 WeekHigh.  : "+NumToStr(Hclose,1.2,True),""), 640, 430);
GfxTextOut( WriteIf(YH, "52 WeekLow.  : "+NumToStr(Lclose,1.2,True),""), 640, 460);

//-----------------------------------------------------------Valume-------------------------------

//_SECTION_BEGIN("Pivot")
	YH = TimeFrameGetPrice("H", inDaily, -1);		// yesterdays high
	YL = TimeFrameGetPrice("L", inDaily, -1);		//				low
	YC = TimeFrameGetPrice("C", inDaily, -1);		//				close
	YO = TimeFrameGetPrice("O", inDaily);			// current day open

	//Normal Pivot
	PPP = (YH + YL + YC) / 3;
	RR1 = (2 * PP) - YL;
	RR2 = PP + (YH - YL);
	RR3 = YH + 2*(PP-YL);
	SS1 = (2 * PP) - YH;
	SS2 = PP - (YH - YL);
	SS3 = YL - 2*(YH - PP) ;

	WYH = TimeFrameGetPrice("H", inWeekly, -1);		
	WYL = TimeFrameGetPrice("L", inWeekly, -1);		
	WYC = TimeFrameGetPrice("C", inWeekly, -1);		
	WYO = TimeFrameGetPrice("O", inWeekly);			

	//Week Pivot 
	WPPP = (WYH + WYL + WYC) / 3;
	WRR1 = (2 * WPPP) - WYL;
	WRR2 = WPPP + (WYH - WYL);
	WRR3 = WYH + 2*(WPPP-WYL);
	WSS1 = (2 * WPPP) - WYH;
	WSS2 = WPPP - (WYH - WYL);
	WSS3 = WYL - 2*(WYH - WPPP) ;
 



//GfxTextOut( WriteIf(YH, "Pivot.:   "+NumToStr(PPP,1.2,True),""), 660, 85);
GfxSelectFont( "Arial", 10, 900, False ); 
GfxSetTextColor( colorWhite  ); 
GfxSetTextAlign(0);
GfxGradientRect( 410, 85, 600, 220, colorRed, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 12, 700, False );
GfxSetTextColor( colorGold );
GfxGradientRect( 410, 220, 600, 300, colorGreen, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 12, 700, False );
GfxSetTextColor( colorGold );
GfxGradientRect( 410, 300, 600, 420, colorBlue, colorDarkBlue );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 12, 700, False );
GfxSetTextColor( colorGold );
GfxGradientRect( 610, 550, 900, 665, colorRed, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 12, 700, False );
GfxSetTextColor( colorGold );


GfxSelectFont( "Arial", 10, 900, False );

GfxSetTextColor( colorWhite  ); 
GfxTextOut( WriteIf(R1, "RES3:    "+NumToStr(RR3,1.2,True),""), 420, 85); 
GfxTextOut( WriteIf(R2, "RES2:    "+NumToStr(RR2,1.2,True),""), 420, 125); 
GfxTextOut( WriteIf(R3, "RES1:    "+NumToStr(RR1,1.2,True),""), 420, 165); 
GfxSetTextColor( colorWhite   );  
GfxTextOut(WriteIf(SellA,"PIVOT:      "+NumToStr(PPP,1.2,True),""),420, 240);
GfxSetTextColor( colorWhite   ); 
GfxTextOut( WriteIf(S1, "SUP1:       "+NumToStr(SS1,1.2,True),""), 420, 305); 
GfxTextOut( WriteIf(S2, "SUP2:       "+NumToStr(SS2,1.2,True),""), 420, 345); 
GfxTextOut( WriteIf(S3, "SUP3:       "+NumToStr(SS3,1.2,True),""), 420, 385); 

//GfxTextOut( WriteIf(YH, "Pivot.:   "+NumToStr(WPPP,1.2,True),""), 960, 85);
GfxSelectFont( "Arial", 15, 900, False ); 
GfxSetTextColor( colorWhite  ); 
GfxSetTextAlign(0);
GfxGradientRect( 610, 85, 800, 220, colorRed, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 12, 700, False );
GfxSetTextColor( colorGold );
GfxGradientRect( 610, 220, 800, 300, colorGreen, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 12, 700, False );
GfxSetTextColor( colorGold );
GfxGradientRect( 610, 300, 800, 420, colorBlue, colorDarkBlue );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 12, 700, False );
GfxSetTextColor( colorGold );
GfxGradientRect( 910, 500, 800, 600, colorRed, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 12, 700, False );
GfxSetTextColor( colorGold );


GfxSelectFont( "Arial", 10, 900, False );

GfxSetTextColor( colorWhite  ); 
GfxTextOut( WriteIf(R1, "RES3:    "+NumToStr(WRR3,1.2,True),""), 620, 85); 
GfxTextOut( WriteIf(R2, "RES2:    "+NumToStr(WRR2,1.2,True),""), 620, 125); 
GfxTextOut( WriteIf(R3, "RES1:    "+NumToStr(WRR1,1.2,True),""), 620, 165); 
GfxSetTextColor( colorWhite   );  
GfxTextOut(WriteIf(SellA,"WPIVOT:      "+NumToStr(WPPP,1.2,True),""),620, 240);
GfxSetTextColor( colorWhite   ); 
GfxTextOut( WriteIf(S1, "SUP1:       "+NumToStr(WSS1,1.2,True),""), 620, 305); 
GfxTextOut( WriteIf(S2, "SUP2:       "+NumToStr(WSS2,1.2,True),""), 620, 345); 
GfxTextOut( WriteIf(S3, "SUP3:       "+NumToStr(WSS3,1.2,True),""), 620, 385); 







//_SECTION_BEGIN("Pivot")
	YH = TimeFrameGetPrice("H", inDaily, -1);		// yesterdays high
	YL = TimeFrameGetPrice("L", inDaily, -1);		//				low
	YC = TimeFrameGetPrice("C", inDaily, -1);		//				close
	YO = TimeFrameGetPrice("O", inDaily);			// current day open

	//Normal Pivot
	PP = (YH + YL + YC) / 3;
	R1 = (2 * PP) - YL;
	R2 = PP + (YH - YL);
	R3 = YH + 2*(PP-YL);
	S1 = (2 * PP) - YH;
	S2 = PP - (YH - YL);
	S3 = YL - 2*(YH - PP) ;

rg = (YH - YL);

H5=YC+1.1*rg;     H5I = LastValue (H5,1);
H4=YC+1.1*rg/2;   H4I = LastValue (H4,1);
H3=YC+1.1*rg/4;   H3I = LastValue (H3,1);
H2=YC+1.1*rg/6;   H2I = LastValue (H2,1);
H1=YC+1.1*rg/12;  H1I = LastValue (H1,1);
L1=YC-1.1*rg/12;  L1I = LastValue (L1,1);
L2=YC-1.1*rg/6;   L2I = LastValue (L2,1);
L3=YC-1.1*rg/4;   L3I = LastValue (L3,1);
L4=YC-1.1*rg/2;   L4I = LastValue (L4,1);
L5=YC-1.1*rg;     L5I = LastValue (L5,1);

//GfxTextOut( WriteIf(YH, "Pivot.:   "+NumToStr(PP,1.2,True),""), 660, 85);
GfxSelectFont( "Arial", 10, 1200, False ); 
GfxSetTextColor( colorWhite  ); 
GfxSetTextAlign(0);
GfxGradientRect( 810, 85, 1100, 220, colorRed, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 700, False );
GfxSetTextColor( colorGold );
GfxGradientRect( 810, 220, 1100, 300, colorGreen, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 700, False );
GfxSetTextColor( colorGold );
GfxGradientRect( 810, 270, 1100, 420, colorBlue, colorDarkBlue );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 700, False );
GfxSetTextColor( colorGold );

GfxSelectFont( "Tahoma", 10, 700, False );
GfxSetTextColor( colorGold );


GfxSelectFont( "Arial", 10, 900, False );

GfxSetTextColor( colorWhite  ); 
GfxTextOut( WriteIf(R1, "H5  Target 1:           "+NumToStr(H5I,1.2,True),""), 820, 85); 
GfxTextOut( WriteIf(R2, "H4  Long Break:    "+NumToStr(H4I,1.2,True),""), 820, 115); 
GfxTextOut( WriteIf(R3, "H3  Go Short:         "+NumToStr(H3I,1.2,True),""), 820, 145); 
GfxTextOut( WriteIf(R3, "H2:                             "+NumToStr(H2I,1.2,True),""), 820, 175);
GfxTextOut( WriteIf(R3, "H1:                             "+NumToStr(H1I,1.2,True),""), 820, 205);
GfxSetTextColor( colorWhite   );  
GfxTextOut(WriteIf(SellA,"PIVOT:                      "+NumToStr(PP,1.2,True),""),820, 235);
GfxSetTextColor( colorWhite   ); 
GfxTextOut( WriteIf(S1, "L1:                             "+NumToStr(L1I,1.2,True),""), 820, 275); 
GfxTextOut( WriteIf(S2, "L2:                             "+NumToStr(L2I,1.2,True),""), 820, 305); 
GfxTextOut( WriteIf(S3, "L3   Go Long:          "+NumToStr(L3I,1.2,True),""), 820, 335); 
GfxTextOut( WriteIf(S3, "L4   Short Break   :  "+NumToStr(L4I,1.2,True),""), 820, 365);
GfxTextOut( WriteIf(S3, "L5   Target 1  :          "+NumToStr(L5I,1.2,True),""), 820, 395);

/* Done      by    WayToWin */
/* Author of www.WayToWin2014.in  */

_SECTION_BEGIN("WayToWin Trend 5min");




TimeFrameSet(in5Minute);
SetBarsRequired(100000,0);
GraphXSpace = 15;
SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0, 0)));
GfxSetBkMode(0); 
GfxSetOverlayMode(1);
SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color", colorGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey)));
//Plot(C,"\nPrice",IIf(C>O,ParamColor("Wick UP Color", colorDarkGreen),IIf(C<=O,ParamColor("Wick Down Color", colorDarkRed),colorLightGrey)),64,0,0,0,0);

SetTradeDelays(1,1,1,1);
PositionSize=100000;


symbol = Name();
Factor=Optimize("Factor",4,2,10,1);
Pd=Optimize("ATR Period",10,3,20,1);

Up=(H+L)/2+(Factor*ATR(Pd));
Dn=(H+L)/2-(Factor*ATR(Pd));
iATR=ATR(Pd);
TrendUp=TrendDown=Null;
trend[0]=1;
changeOfTrend=0;
flag=flagh=0;

for (i = 1; i <BarCount; i++) {
      TrendUp[i] = Null;
      TrendDown[i] = Null;
     
      trend[i]=1;
   
      
      if (Close[i]>Up[i-1]) {
         trend[i]=1;
         if (trend[i-1] == -1) changeOfTrend = 1;
         
      }
      else if (Close[i]<Dn[i-1]) {
         trend[i]=-1;
         if (trend[i-1] == 1) changeOfTrend = 1;
      }
      else if (trend[i-1]==1) {
         trend[i]=1;
         changeOfTrend = 0;       
      }
      else if (trend[i-1]==-1) {
         trend[i]=-1;
         changeOfTrend = 0;
      }

      if (trend[i]<0 && trend[i-1]>0) {
         flag=1;
      }
      else {
         flag=0;
      }
      
      if (trend[i]>0 && trend[i-1]<0) {
         flagh=1;
      }
      else {
         flagh=0;
      }
      
      if (trend[i]>0 && Dn[i]<Dn[i-1]){
         Dn[i]=Dn[i-1];
		}
      
      if (trend[i]<0 && Up[i]>Up[i-1])
        { Up[i]=Up[i-1];
		}
      
      if (flag==1)
       {  Up[i]=(H[i]+L[i])/2+(Factor*iATR[i]);;
        } 
      if (flagh==1)
        { Dn[i]=(H[i]+L[i])/2-(Factor*iATR[i]);;
         }
      if (trend[i]==1) {
         TrendUp[i]=Dn[i];
         if (changeOfTrend == 1) {
            TrendUp[i-1] = TrendDown[i-1];
            changeOfTrend = 0;
         }
      }
      else if (trend[i]==-1) {
         TrendDown[i]=Up[i];
         if (changeOfTrend == 1) {
            TrendDown[i-1] = TrendUp[i-1];
            changeOfTrend = 0;
         }
      }
   } 

Buy = trend==1;
Sell=trend==-1;

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


BuyPrice=ValueWhen(Buy,C);
SellPrice=ValueWhen(Sell,C);
ShortPrice=ValueWhen(Short,C);
CoverPrice=ValueWhen(Cover,C);




TrendSL=IIf(trend==1,TrendUp,TrendDown);

for(i=BarCount-1;i>1;i--)
{
if(Buy[i] == 1)
{
entry = C[i];
sig = "BUY";
sl = TrendSL[i];
tar1 = entry + (entry * .0050);
tar2 = entry + (entry * .0092);
tar3 = entry + (entry * .0179);
 
bars = i;
i = 0;
}
if(Sell[i] == 1)
{
sig = "SELL";
entry = C[i];
sl = TrendSL[i];
tar1 = entry - (entry * .0050);
tar2 = entry - (entry * .0112);
tar3 = entry - (entry * .0212);
 
 
bars = i;
i = 0;
}
}
Offset = 20;
Clr = IIf(sig == "BUY", colorLime, colorRed);
ssl = IIf(bars == BarCount-1, TrendSL[BarCount-1], Ref(TrendSL, -1));
sl = ssl[BarCount-1];
 
 
messageboard = ParamToggle("Message Board","Show|Hide",1);
if (messageboard == 1 )
{
GfxSelectFont( "Tahoma", 10, 500 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );
 
if ( sig =="BUY")
{
GfxSelectSolidBrush( colorBlue ); // this is the box background color
}
else
{
GfxSelectSolidBrush( colorRed ); // this is the box background color
}
pxHeight = Status( "pxchartheight" ) ;
xx = Status( "pxchartwidth");
Left = 1100;
width = 310;
x = 5;
x2 = 290;
 
y = pxHeight;
 
GfxSelectPen( colorGreen, 1); // broader color
GfxRoundRect( x, y - 98, x2, y , 7, 7 ) ;
GfxTextOut( ( "WayToWin Trend 5min"),13,y-100);
GfxTextOut( (" "),27,y-100);
GfxTextOut( ("Last " + sig + " Signal came " + (BarCount-bars-1) * Interval()/60 + " mins ago"), 13, y-80) ; // The text format location
GfxTextOut( ("" + WriteIf(sig =="BUY",sig + " @ ",sig + " @") + " : " + entry), 13, y-60);
GfxTextOut( ("Trailing SL : " + Ref(TrendSL,-1) + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"), 13, y-40);
/*GfxTextOut( ("TGT:1 : " + tar1), 13, y -80);
GfxTextOut( ("TGT:2 : " + tar2), 13,y-60);
GfxTextOut( ("TGT:3 : " + tar3), 13,y-40);*/
GfxTextOut( ("Current P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2)), 13, y-22);;

}

TimeFrameRestore();

_SECTION_END();


_SECTION_BEGIN("WayToWin Trend 15min");

TimeFrameSet(in5Minute*3);
SetBarsRequired(100000,0);
GraphXSpace = 15;
SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0, 0)));
GfxSetBkMode(0); 
GfxSetOverlayMode(1);
SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color", colorGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey)));
//Plot(C,"\nPrice",IIf(C>O,ParamColor("Wick UP Color", colorDarkGreen),IIf(C<=O,ParamColor("Wick Down Color", colorDarkRed),colorLightGrey)),64,0,0,0,0);

SetTradeDelays(1,1,1,1);
PositionSize=100000;


symbol = Name();
Factor=Optimize("Factor",4,2,10,1);
Pd=Optimize("ATR Period",10,3,20,1);


Up=(H+L)/2+(Factor*ATR(Pd));
Dn=(H+L)/2-(Factor*ATR(Pd));
iATR=ATR(Pd);
TrendUp=TrendDown=Null;
trend[0]=1;
changeOfTrend=0;
flag=flagh=0;

for (i = 1; i <BarCount; i++) {
      TrendUp[i] = Null;
      TrendDown[i] = Null;
     
      trend[i]=1;
   
      
      if (Close[i]>Up[i-1]) {
         trend[i]=1;
         if (trend[i-1] == -1) changeOfTrend = 1;
         
      }
      else if (Close[i]<Dn[i-1]) {
         trend[i]=-1;
         if (trend[i-1] == 1) changeOfTrend = 1;
      }
      else if (trend[i-1]==1) {
         trend[i]=1;
         changeOfTrend = 0;       
      }
      else if (trend[i-1]==-1) {
         trend[i]=-1;
         changeOfTrend = 0;
      }

      if (trend[i]<0 && trend[i-1]>0) {
         flag=1;
      }
      else {
         flag=0;
      }
      
      if (trend[i]>0 && trend[i-1]<0) {
         flagh=1;
      }
      else {
         flagh=0;
      }
      
      if (trend[i]>0 && Dn[i]<Dn[i-1]){
         Dn[i]=Dn[i-1];
		}
      
      if (trend[i]<0 && Up[i]>Up[i-1])
        { Up[i]=Up[i-1];
		}
      
      if (flag==1)
       {  Up[i]=(H[i]+L[i])/2+(Factor*iATR[i]);;
        } 
      if (flagh==1)
        { Dn[i]=(H[i]+L[i])/2-(Factor*iATR[i]);;
         }
      if (trend[i]==1) {
         TrendUp[i]=Dn[i];
         if (changeOfTrend == 1) {
            TrendUp[i-1] = TrendDown[i-1];
            changeOfTrend = 0;
         }
      }
      else if (trend[i]==-1) {
         TrendDown[i]=Up[i];
         if (changeOfTrend == 1) {
            TrendDown[i-1] = TrendUp[i-1];
            changeOfTrend = 0;
         }
      }
   } 

Buy = trend==1;
Sell=trend==-1;

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


BuyPrice=ValueWhen(Buy,C);
SellPrice=ValueWhen(Sell,C);
ShortPrice=ValueWhen(Short,C);
CoverPrice=ValueWhen(Cover,C);




TrendSL=IIf(trend==1,TrendUp,TrendDown);

for(i=BarCount-1;i>1;i--)
{
if(Buy[i] == 1)
{
entry = C[i];
sig = "BUY";
sl = TrendSL[i];
tar1 = entry + (entry * .0050);
tar2 = entry + (entry * .0092);
tar3 = entry + (entry * .0179);
 
bars = i;
i = 0;
}
if(Sell[i] == 1)
{
sig = "SELL";
entry = C[i];
sl = TrendSL[i];
tar1 = entry - (entry * .0050);
tar2 = entry - (entry * .0112);
tar3 = entry - (entry * .0212);
 
 
bars = i;
i = 0;
}
}
Offset = 20;
Clr = IIf(sig == "BUY", colorLime, colorRed);
ssl = IIf(bars == BarCount-1, TrendSL[BarCount-1], Ref(TrendSL, -1));
sl = ssl[BarCount-1];
 
 
messageboard = ParamToggle("Message Board","Show|Hide",1);
if (messageboard == 1 )
{
GfxSelectFont( "Tahoma", 10, 400 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );
 
if ( sig =="BUY")
{
GfxSelectSolidBrush( colorBlue ); // this is the box background color
}
else
{
GfxSelectSolidBrush( colorRed ); // this is the box background color
}
pxHeight = Status( "pxchartheight" ) ;
xx = Status( "pxchartwidth");
Left = 1100;
width = 310;
x = 305;
x2 = 590;
 
y = pxHeight;
 
GfxSelectPen( colorGreen, 1); // broader color
GfxRoundRect( x, y - 98, x2, y , 7, 7 ) ;
GfxTextOut( ( "WayToWin Trend 15min"),313,y-100);
GfxTextOut( (" "),327,y-100);
GfxTextOut( ("Last " + sig + " Signal came " + (BarCount-bars-1) * Interval()/60 + " mins ago"), 313, y-80) ; // The text format location
GfxTextOut( ("" + WriteIf(sig =="BUY",sig + " @ ",sig + " @") + " : " + entry), 313, y-60);
GfxTextOut( ("Trailing SL : " + Ref(TrendSL,-1) + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"), 313, y-40);
/*GfxTextOut( ("TGT:1 : " + tar1), 13, y -80);
GfxTextOut( ("TGT:2 : " + tar2), 13,y-60);
GfxTextOut( ("TGT:3 : " + tar3), 13,y-40);*/
GfxTextOut( ("Current P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2)), 313, y-22);;

}
TimeFrameRestore();

_SECTION_END();



_SECTION_BEGIN("WayToWinTrend Hourly");

TimeFrameSet(inHourly);
SetBarsRequired(100000,0);
GraphXSpace = 15;
SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0, 0)));
GfxSetBkMode(0); 
GfxSetOverlayMode(1);
SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color", colorGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey)));
//Plot(C,"\nPrice",IIf(C>O,ParamColor("Wick UP Color", colorDarkGreen),IIf(C<=O,ParamColor("Wick Down Color", colorDarkRed),colorLightGrey)),64,0,0,0,0);

SetTradeDelays(1,1,1,1);
PositionSize=100000;


symbol = Name();
Factor=Optimize("Factor",4,2,10,1);
Pd=Optimize("ATR Period",10,3,20,1);

Up=(H+L)/2+(Factor*ATR(Pd));
Dn=(H+L)/2-(Factor*ATR(Pd));
iATR=ATR(Pd);
TrendUp=TrendDown=Null;
trend[0]=1;
changeOfTrend=0;
flag=flagh=0;

for (i = 1; i <BarCount; i++) {
      TrendUp[i] = Null;
      TrendDown[i] = Null;
     
      trend[i]=1;
   
      
      if (Close[i]>Up[i-1]) {
         trend[i]=1;
         if (trend[i-1] == -1) changeOfTrend = 1;
         
      }
      else if (Close[i]<Dn[i-1]) {
         trend[i]=-1;
         if (trend[i-1] == 1) changeOfTrend = 1;
      }
      else if (trend[i-1]==1) {
         trend[i]=1;
         changeOfTrend = 0;       
      }
      else if (trend[i-1]==-1) {
         trend[i]=-1;
         changeOfTrend = 0;
      }

      if (trend[i]<0 && trend[i-1]>0) {
         flag=1;
      }
      else {
         flag=0;
      }
      
      if (trend[i]>0 && trend[i-1]<0) {
         flagh=1;
      }
      else {
         flagh=0;
      }
      
      if (trend[i]>0 && Dn[i]<Dn[i-1]){
         Dn[i]=Dn[i-1];
		}
      
      if (trend[i]<0 && Up[i]>Up[i-1])
        { Up[i]=Up[i-1];
		}
      
      if (flag==1)
       {  Up[i]=(H[i]+L[i])/2+(Factor*iATR[i]);;
        } 
      if (flagh==1)
        { Dn[i]=(H[i]+L[i])/2-(Factor*iATR[i]);;
         }
      if (trend[i]==1) {
         TrendUp[i]=Dn[i];
         if (changeOfTrend == 1) {
            TrendUp[i-1] = TrendDown[i-1];
            changeOfTrend = 0;
         }
      }
      else if (trend[i]==-1) {
         TrendDown[i]=Up[i];
         if (changeOfTrend == 1) {
            TrendDown[i-1] = TrendUp[i-1];
            changeOfTrend = 0;
         }
      }
   } 

Buy = trend==1;
Sell=trend==-1;

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


BuyPrice=ValueWhen(Buy,C);
SellPrice=ValueWhen(Sell,C);
ShortPrice=ValueWhen(Short,C);
CoverPrice=ValueWhen(Cover,C);




TrendSL=IIf(trend==1,TrendUp,TrendDown);

for(i=BarCount-1;i>1;i--)
{
if(Buy[i] == 1)
{
entry = C[i];
sig = "BUY";
sl = TrendSL[i];
tar1 = entry + (entry * .0050);
tar2 = entry + (entry * .0092);
tar3 = entry + (entry * .0179);
 
bars = i;
i = 0;
}
if(Sell[i] == 1)
{
sig = "SELL";
entry = C[i];
sl = TrendSL[i];
tar1 = entry - (entry * .0050);
tar2 = entry - (entry * .0112);
tar3 = entry - (entry * .0212);
 
 
bars = i;
i = 0;
}
}
Offset = 20;
Clr = IIf(sig == "BUY", colorLime, colorRed);
ssl = IIf(bars == BarCount-1, TrendSL[BarCount-1], Ref(TrendSL, -1));
sl = ssl[BarCount-1];
 
 
messageboard = ParamToggle("Message Board","Show|Hide",1);
if (messageboard == 1 )
{
GfxSelectFont( "Tahoma", 10, 300 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );
 
if ( sig =="BUY")
{
GfxSelectSolidBrush( colorBlue ); // this is the box background color
}
else
{
GfxSelectSolidBrush( colorRed ); // this is the box background color
}
pxHeight = Status( "pxchartheight" ) ;
xx = Status( "pxchartwidth");
Left = 1100;
width = 310;
x = 605;
x2 = 890;
 
y = pxHeight;
 
GfxSelectPen( colorGreen, 1); // broader color
GfxRoundRect( x, y - 98, x2, y , 7, 7 ) ;
GfxTextOut( ( "WayToWin Trend Hourly"),613,y-100);
GfxTextOut( (" "),327,y-100);
GfxTextOut( ("Last " + sig + " Signal came " + (BarCount-bars-1) * Interval()/60 + " mins ago"), 613, y-80) ; // The text format location
GfxTextOut( ("" + WriteIf(sig =="BUY",sig + " @ ",sig + " @") + " : " + entry), 613, y-60);
GfxTextOut( ("Trailing SL : " + Ref(TrendSL,-1) + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"), 613, y-40);
/*GfxTextOut( ("TGT:1 : " + tar1), 13, y -80);
GfxTextOut( ("TGT:2 : " + tar2), 13,y-60);
GfxTextOut( ("TGT:3 : " + tar3), 13,y-40);*/
GfxTextOut( ("Current P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2)), 613, y-22);;

}
TimeFrameRestore();

_SECTION_END();


	
Back