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

Yagnesh nifty/banknifty 3mint chart and commodity 7 mint chart for Amibroker (AFL)

Copy & Paste Friendly
_SECTION_BEGIN("yagnesh");

bts=ParamToggle("BrainTrend1 signal","No|Yes" ,0);
//btst=ParamToggle("BrainTrend1 stop","No|Yes" ,0);
//btsl=ParamToggle("BrainTrend1 stop line","No|Yes" ,0);
period=Param("Period",20,6,200,1);
x1=53;
x2=47;
d=2.3;
f=7;
s=1.5;
range=ATR(f);
Range1 = ATR(f)/d; 
Range2 = (ATR(f)*s)/4;
range3=ATR(10);
R = ((HHV(H,period) - C) /(HHV (H,period) -LLV (L,period))) *-100;
EMA1= EMA(R,Period);
EMA2= EMA(EMA1,5);
Difference= EMA1 - EMA2;
ZeroLagEMA= EMA1 + Difference;
value2=abs(ZeroLagEMA);


function PercentR( periods )
{
 return -100 * ( HHV( H, periods ) - C )/( HHV( H, periods ) - LLV( L, periods ) ); 
}


for( i = period+10; i < BarCount; i++ ) 
{
C[0]=0;
Value2[0]=0;
p[0]=0;
Plot1[0]=0;
Plot2[0]=0;
Val1=0;
Val2=0;
temp[0]=0;
Value3[0]=0;
tm[0]=0;
p1[i]=0;
bt1[0]=0;
bt2[0]=0;
r[0]=0;
bt1a[0]=0;
bt2a[0]=0;
istop[0]=Val1[0];
stop[i]=Val1[0];
bstop[0]=0;
sstop[i]=0;

{
if (value2[i] < x2 AND abs(Close[i]-Close[i-2]) > range1[i])
 p[i] = 1 ;
else
{
if (value2[i] > x1 AND abs(Close[i]-Close[i-2]) > Range1[i]) 
 p[i] = 2 ;

else

 p[i]=0;
}
}

if ((value2[i] < x2 AND p[i] == 1) OR (value2[i] < x2 AND p[i] == 0))

{
if (abs(Close[i]-Close[i-2]) > Range1[i])
{
Plot1[i]=H[i];
Plot2[i]=L[i];
}
else
{
Plot1[i]=Plot1[i-1];
Plot2[i]=Plot2[i-1];
}
}
else
{
if ((value2[i] > x1 AND p[i] == 2) OR (value2[i] > x1 AND p[i] == 0))
          
{
Plot1[i]=L[i];
Plot2[i]=H[i];			
}
else
{
Plot1[i]=Plot1[i-1];
Plot2[i]=Plot2[i-1];
}
}

{
if (value2[i] < x2 AND (abs(Close[i]-Close[i-2]) > Range1[i]))
{
if (p[i] == 1 OR p[i] == 0)
Value3[i]=L[i]-range3[i];
val1[i]=Value3[i];
p[i]=1;
temp[i]=1;
}
else
{
temp[i]=temp[i-1];
}
{
if (value2[i] > x1 AND (abs(Close[i]-Close[i-2]) > Range1[i]))
{
if (p[i] == 2 OR p[i] == 0)
Value3[i]=H[i]+range3[i];
val2[i]=Value3[i];
p[i]=2;
temp[i]=2;;	
}

}
}
{

if (temp[i]==1 AND Plot1[i]>0 AND tm[i] != 1)
 tm[i]= 1;

if (temp[i]==2 AND Plot2[i]>0 AND tm[i] != 2) 
 tm[i]=2;

}

{
if (value2[i] < x2 AND (abs(Close[i]-Close[i-2]) > Range1[i])AND p[i] !=2)

   {
     value3[i]=L[i]-range3[i];
     va1[i]=Value3[i];
     p1[i]=2;
     r[i]=Va1[i];
     bstop[i]=Va1[i];
     bt2[i]=bt2[i-1];
     }
      
if (value2[i] > x1 AND (abs(Close[i]-Close[i-2]) > Range1[i])AND p[i] !=1)
   
     {
     Value3[i]=H[i]+range3[i];
     va2[i]=Value3[i];
     p1[i]=1;
       
     r[i]=Va2[i];
     sstop[i]=Value3[i];
     bt1[i]=bt1[i-1];
     }
    
  }



if (val1[i] == 0 AND val2[i] == 0 AND p[i] == 0 )
         {
         bstop[i]=bstop[i-1]; 
         sstop[i]=sstop[i-1];
         }
     

if (bstop[i]<bstop[i-1] AND tm[i]==1 AND tm[i-1]==1) bstop[i]=bstop[i-1];
if (sstop[i]>sstop[i-1] AND tm[i]==2 AND tm[i-1]==2) sstop[i]=sstop[i-1];
  
}

Mycolor=IIf(p==1,colorLime,IIf(p==2,colorRed,colorBlue));
//PlotOHLC( Open,  High,  Low,  Close, "", Mycolor, styleBar| styleThick   ); 
PlotShapes( shapeCircle* (bts AND tm==1 AND Ref(tm,-1)==2),colorTurquoise, 0, bstop, 0 );
PlotShapes( shapeCircle* (bts AND tm==2 AND Ref(tm,-1)==1), colorCustom12, 0, sstop, 0 );
//PlotShapes( IIf(btst AND p==1,shapeSmallCircle,Null), colorTurquoise,0,bstop,0);
//Plot(IIf(btsl AND tm==1,bstop,Null),"",colorPaleBlue,1);
//PlotShapes( IIf(btst AND p==2,shapeSmallCircle,Null), colorCustom12,0,sstop,0);
//Plot(IIf(btsl AND tm==2,sstop,Null),"",colorLightYellow,1);
Buy1=Cover1=(bts AND tm==1 AND Ref(tm,-1)==2);
Sell1=Short1=(bts AND tm==2 AND Ref(tm,-1)==1);
SellPrice=ValueWhen(Sell1,C,1);
BuyPrice=ValueWhen(Buy1,C,1);
Long=Flip(Buy1,Sell1);
Shrt=Flip(Sell1,Buy1 );
_SECTION_END();

_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator ) 
(
Title = EncodeColor(colorWhite)+ "Sauda Trading System. " + " - " +  Name() + " - " + EncodeColor(colorRed)+ Interval(2) + 

EncodeColor(colorWhite) +
 "  - " + Date() +" - "+"\n" +EncodeColor(colorBlack) +"Op-"+O+"  "+"Hi-"+H+"  "+"Lo-"+L+"  "+
"Cl-"+C+"  "+ "Vol= "+ WriteVal(V)+"\n"+ 
EncodeColor(colorLime)+
WriteIf (Buy1 , " BUYING INDICATION IS STRONG / Reverse Signal at "+C+"  ","")+
WriteIf (Sell1 , " SELLING INDICATION IS STRONG / Reverse Signal at "+C+"  ","")+"\n"+EncodeColor(colorBlack));
//WriteIf(Sell1 , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
//WriteIf(Buy1  , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"",""));
//WriteIf(Long AND NOT Buy, "Trade : Long - Entry price Rs."+(BuyPrice),"")+
//WriteIf(shrt AND NOT Sell, "Trade : Short - Entry price Rs."+(SellPrice),"")+"\n"+ 
//WriteIf(Long AND NOT Buy, "Current Profit/Loss Rs."+(C-BuyPrice)+"","")+
//WriteIf(shrt AND NOT Sell, "Current Profit/Loss Rs."+(SellPrice-C)+"",""));

_SECTION_END();


_SECTION_BEGIN("swing1");
period=Param("Period",20,6,200,1);
no=period;
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;

Plot(supres,"Swing",colorYellow,styleStaircase);

_SECTION_END();

_SECTION_BEGIN("ORB5min");
breakoutime = 100000;
 afterbreakout0 = Cross(TimeNum(),100000);
 afterbreakout1 = TimeNum()>=100000;
 NewDay = Day()!= Ref(Day(), -1);
 highestoftheday = HighestSince(newday,H,1);
 Lowestoftheday =LowestSince(newday,L,1);
 ORBHigh = ValueWhen(afterbreakout0,highestoftheday,1);
 ORBLow = ValueWhen(afterbreakout0,lowestoftheday,1);
 //Buy=Cover= Cross(C,orbhigh) AND afterbreakout1;
//Short=Cross(ORblow,C) AND afterbreakout1;
 //Sell =Short= Cross(orblow,C) AND afterbreakout1;
//Cover=Cross(C,ORbhigh) AND afterbreakout1;
 //Buy=ExRem(Buy,Sell);

//Sell=ExRem(Sell,Buy);

//PlotText("Major Support : " + ORBLOW,LastValue(BarIndex())+1, 0.05,colorGreen);
//PlotText("Major Resistance : " + ORBHIGH ,LastValue(BarIndex())+1,  0.05, colorRed);




 //Plot(C,"",colorYellow,styleBar);
 //PlotShapes( shapeUpArrow * Buy, colorGreen,0,L,-12);
 //PlotShapes( shapeDownArrow * Sell, colorRed,0,H,-12);
 //Plot(afterbreakout0,"",colorBlue,styleHistogram|styleOwnScale);
 Plot(ORBHigh,"",colorRed,styleDots);
 Plot(ORBLow,"",colorGreen,styleDots);
_SECTION_END();

#include <nbar.afl>
function Pt(text, entry, sl, target, Clr, fil)
{
	PlotText("" + text + fil + " @ : " + entry , BarCount+1, entry, Clr);
	PlotText("SL @ : " + sl , BarCount+1, sl, Clr);
	PlotText("Target @ : " + target , BarCount+1, target, Clr);
}
//GfxSelectFont("Times New Roman", 10, 700, True );
//GfxTextOut("man4urheart.blogspot.com", 10 , 0 );

function Plotbands()
{
slowshift = 0;
fastshift = 0;
slb =55;
flb =7;
HighSlow = Ref(HHV(H,slb),slowshift);
HighFast = Ref(HHV(H,flb),fastshift);
CloseSlow = Ref(HHV(C,slb),slowshift);
CloseFast = Ref(HHV(C,flb),fastshift );
LowSlow = Ref(LLV(L,slb),slowshift);
LowFast = Ref(LLV(L,flb),fastshift);
PlotOHLC(HighSlow,HighSlow,HighFast,HighFast,"",colorPaleTurquoise,styleCloud | styleNoLabel,Null,Null,3);
PlotOHLC(HighFast,HighFast,LowFast,LowFast,"",colorLavender,styleCloud | styleNoLabel,Null,Null,3);
PlotOHLC(LowSlow,LowSlow,LowFast,LowFast,"",colorPink,styleCloud | styleNoLabel,Null,Null,3);
}
function PlotGrids()
{
Lookback = 1;
prevclose = TimeFrameGetPrice("C", inHourly, -Lookback );
prevhigh = TimeFrameGetPrice("H", inHourly, -Lookback );
prevlow = TimeFrameGetPrice("L", inHourly, -Lookback );
grid = (prevhigh - prevlow)/3;

Plot(prevclose-(3*grid),"", colorRed, styleLine|styleThick|styleNoLabel);
Plot(prevclose+(4*grid),"", colorBlue, styleLine|styleThick|styleNoLabel);

PlotOHLC(prevclose-(3*grid),prevclose-(2*grid),prevclose-(3*grid),prevclose-(2*grid), "", colorTan, 

styleArea|styleNoLabel);
PlotOHLC(prevclose-(2*grid),prevclose-grid,prevclose-(2*grid),prevclose-grid, "", colorLightOrange , 

styleArea|styleNoLabel);
PlotOHLC(prevclose-grid,prevclose,prevclose-grid,prevclose, "", colorRose, styleArea|styleNoLabel);
PlotOHLC(prevclose - grid,prevclose + grid,prevclose - grid,prevclose+grid, "", colorLightYellow, 

styleArea|styleNoLabel);
PlotOHLC(prevclose + grid,prevclose + (2*grid),prevclose + grid,prevclose+(2*grid), "", colorLavender, 

styleArea|styleNoLabel);
PlotOHLC(prevclose +(2*grid),prevclose + (3*grid),prevclose + (2*grid),prevclose+(3*grid), "", colorSkyblue, 

styleArea|styleNoLabel);
PlotOHLC(prevclose +(3*grid),prevclose + (4*grid),prevclose + (3*grid),prevclose+(4*grid), "", colorBrightGreen, 

styleArea|styleNoLabel);
}
function Mine () //
{
Line = ParamToggle("Show Targets", "No|Yes", 1);
//Band = Param("Show Bands Type", 2, 0,2,1);
type = Param("Signal Type", 1, 1,2,1);
//Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
x = BarIndex();

//PlotShapes(shapeSmallSquare,colorYellow,0,Graph0,0);
pRp  = PeakBars( H, 0.78, 1) == 0;
yRp0 = SelectedValue(ValueWhen( pRp, H, 1));
xRp0 = SelectedValue(ValueWhen( pRp, x, 1));
pSp  = TroughBars( L, 0.78, 1) == 0;
ySp0 = SelectedValue(ValueWhen( pSp, L, 1));
xSp0 = SelectedValue(ValueWhen( pSp, x, 1));


p00 = IIf(xSp0 > xRp0,ySp0,yRp0);
p100 = IIf(xSp0 < xRp0,ySp0,yRp0); 

tsl = SAR();
zdate = DateNum();
ph = HHV(H, 5);
pl = LLV(L, 5);
s1 = StochD(14,3,3); //fast - red
s2 = StochD(14,3,5); //slow - blue
SetBarsRequired(200,0);
GraphXSpace = 2;
SetChartOptions(0,chartShowArrows|chartShowDates);
at = Param("nbar",25,1,500);
k = Param("K", 5, 1, 5, 0.1);
//Per = Param("ATR", 3, 1, 30, 0.50);
k1 = Optimize("K", 3, 0.1, 5, 0.1);
//Per1 = Optimize("ATR", 3, 1, 30, 0.50);
HACLOSE=(O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose,  -1 ),  0.5 );
HaHigh = Max( H,  Max( HaClose,  HaOpen ) );
HaLow = Min( L,  Min( HaClose,  HaOpen ) );
//PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "" + Name(), colorBlack, styleCandle | styleNoLabel );
j=Haclose;
//=======================================================================================================================
//=========================Indicator==============================================================================================
f= ATR(14);

rfsctor = WMA(H-L, at);

revers = k * rfsctor;

Trend = 1;  
NW[0] = 0;  


for(i = 1; i < BarCount; i++)
{
 if(Trend[i-1] == 1)                
 {
  if(j[i] < NW[i-1])                 
  {
   Trend[i] = -1;                   
   NW[i] = j[i] + Revers[i];        
  }
  else                              
  {
   Trend[i] = 1;
   if((j[i] - Revers[i]) > NW[i-1])
   {
    NW[i] = j[i] - Revers[i]; 
   }
   else
   {
    NW[i] = NW[i-1];
   }
  } 
 }
 if(Trend[i-1] == -1)               
 {
  if(j[i] > NW[i-1])                
  {
   Trend[i] = 1;                    
   NW[i] = j[i] - Revers[i];        
  }
  else                              
  {
   Trend[i] = -1;
   if((j[i] + Revers[i]) < NW[i-1]) 
   {
    NW[i] = j[i] + Revers[i]; 
   }
   else
   {
    NW[i] = NW[i-1];
   }
  }
 }
}

//===============system 1 ================
if (type == 1) 
{
//Plot(NW, "", IIf(Trend == 1, 27, 4), 4);
p=a;
t=b;

Buy=Cross(j,nw) ;

stop=ValueWhen(Buy,t,1);
Entry=ValueWhen(Buy,1);
//Target=(Entry+(Entry-stop));
//Sell=Cross(stop,C) OR Cross(t,C) OR Cross(C,Target)  ;
Sell=Cross(nw,j) ;
Short=b ;
//Short=Cross(t,C);
stop1=ValueWhen(Short,p,1);
Entry1=ValueWhen(Short,1);
//Target1=(Entry1-(stop1-Entry1));

Cover=Cross(C,stop1) OR Cross(C,p)  ;
Cover1=a;
PlotShapes( shapeUpArrow *stop1 ,5,0,L); 
PlotShapes( shapeDownArrow * Short ,8,0,L); 
state=IIf(BarsSince(Buy)<BarsSince(Sell),1,0);
col=IIf(state == 1 ,51,IIf(state ==0,4,1));
Plot(C,"",Col,64);
//PlotShapes( shapeUpArrow * Buy ,5,0,L); 
//PlotShapes( shapeDownArrow *Sell ,8,0,H);
AlertIf(Buy,"","Buy Signal");
AlertIf(Sell,"","Sell Signal");
dist = 1.5*ATR(1);
for( i = 0; i < BarCount; i++ ) 
{ 
if( Buy[i] ) PlotText( "BUY \n@" + WriteVal(C[i], 8.2) , i, O[ i ]-dist[i], colorWhite,colorDarkBlue ); 
if( Sell[i] ) PlotText( "SELL \n@"  + WriteVal(C[i], 8.2) , i, O[ i ]+dist[i],colorWhite, colorRed); 
//if( Cover1[i] ) PlotText( "ISBP or ILRL \n@"  + WriteVal(C[i], 8.2) , i, O[ i ]+dist[i],colorWhite);
//if( Short[i] ) PlotText( "ILBPP or ISRS \n@"  + WriteVal(C[i], 8.2) , i, O[ i ]+dist[i],colorWhite);
if( stop[i] ) PlotText( "BUY Stop \n@"  + WriteVal(stop[i], 8.2) , i, O[ i ]+dist[i],colorWhite, colorRed);
if( Stop1[i] ) PlotText( "SELL Stop\n@"  + WriteVal(stop1[i], 8.2) , i, O[ i ]+dist[i],colorWhite, colorRed);
} 


shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low-f, High+f)); 

//Buy = Cross(EMA(C, 10), EMA(C, 20));
//Sell = Cross(EMA(C, 20), EMA(C, 10)) ;

Colorsl = colorYellow;
Colort1 = colorBlue;
Colort2 = 13;
Colort3 = 15;
Colort4 = 17;
Colort5 = 19;

	for(i = BarCount-1; i > 1 ; i--)
	{
		if(Buy[i] == 1)
		{
			Colorentry = colorLime;
			Buyvalue = C[i];
			sl = buyvalue - C[i] * 1.05 / 100;

			diff = Buyvalue - pl[i];
			t1 = buyvalue + diff * .62;
			t2 = Buyvalue + diff * 1.62;
			t3 = Buyvalue + diff * 2.3;
			t4 = Buyvalue + diff * 4.2;
			t5 =  Buyvalue + diff * 7.8;
			if(Line == 1)
			{
				Plot(LineArray(i-(BarCount-i+10),Buyvalue,i,Buyvalue,0),"", Colorentry, styleLine, 

Null, Null, BarCount-i+15);
				Plot(LineArray(i-(BarCount-i+10),sl,i,sl,0),"", Colorsl, styleLine, Null, Null, 

BarCount-i+15);
				Plot(LineArray(i-(BarCount-i+10),t1,i,t1,0),"", Colort1, styleLine, Null, Null, 

BarCount-i+15);
				Plot(LineArray(i-(BarCount-i+10),t2,i,t2,0),"", Colort2, styleLine, Null, Null, 

BarCount-i+15);
				Plot(LineArray(i-(BarCount-i+10),t3,i,t3,0),"", Colort3, styleLine, Null, Null, 

BarCount-i+15);
				Plot(LineArray(i-(BarCount-i+10),t4,i,t4,0),"", Colort4, styleLine, Null, Null, 

BarCount-i+15);
				Plot(LineArray(i-(BarCount-i+10),t5,i,t5,0),"", Colort5, styleLine, Null, Null, 

BarCount-i+15);
			PlotText("Buy @" + WriteVal(Buyvalue, 8.2), i+(BarCount-i+3), Buyvalue, Colorentry, Null);
				PlotText("Stop Loss @" + WriteVal(sl, 8.2), i+(BarCount-i+3), sl, Colorsl, Null);	

		
				PlotText("T 1 @" + WriteVal(t1, 8.2), i+(BarCount-i+3), t1, Colort1, Null);
				PlotText("T 2 @" + WriteVal(t2, 8.2), i+(BarCount-i+3), t2, Colort2, Null);
				PlotText("T 3 @" + WriteVal(t3, 8.2), i+(BarCount-i+3), t3, Colort3, Null);
				PlotText("T 4 @" + WriteVal(t4, 8.2), i+(BarCount-i+3), t4, Colort4, Null);
				PlotText("T 5 @" + WriteVal(t5, 8.2), i+(BarCount-i+3), t5, Colort5, Null);
		
//dist = 1.5*ATR(1);
//for( i = 0; i < BarCount; i++ ) 
//{ 
//if( t1[i] ) PlotText( "T1 \n@"  + WriteVal(t1, 1.2) , i, O[ i ]+dist[i],colorWhite); 
//if( t2[i] ) PlotText( "T2 \n@"  + WriteVal(t2, 2.2) , i, O[ i ]+dist[i],colorWhite); 
//if( t3[i] ) PlotText( "T3 \n@"  + WriteVal(t3, 3.2) , i, O[ i ]+dist[i],colorWhite);
//if( t4[i] ) PlotText( "T4 \n@ "  + WriteVal(t4, 4.2) , i, O[ i ]+dist[i],colorWhite);
//if( t5[i] ) PlotText( "T5 \n@"  + WriteVal(t5, 5.2) , i, O[ i ]+dist[i],colorWhite);
//if( Stop1[i] ) PlotText( "SELL Stop\n@"  + WriteVal(stop1[i], 8.2) , i, O[ i ]+dist[i],colorWhite, colorRed);
//} 
 }
}
		if(Sell[i] == 1)
		{
			Colorentry = colorRed;
			Buyvalue = C[i];
			sl = L[i-1] + (C[BarCount-2] * 1.05) / 100;//buyvalue + (ph[i]-Buyvalue) * .3;
			
			diff = -Buyvalue + ph[i];
			t1 = buyvalue - diff * .62;
			t2 = Buyvalue - diff * 1.62;
			t3 = Buyvalue - diff * 2.3;
			t4 = Buyvalue - diff * 4.2;
			t5 =  Buyvalue - diff * 7.8;

			if(Line == 1)
			{
				Plot(LineArray(i-(BarCount-i+10),Buyvalue,i,Buyvalue,0),"", Colorentry, styleLine, 

Null, Null, BarCount-i+15);
				Plot(LineArray(i-(BarCount-i+10),sl,i,sl,0),"", Colorsl, styleLine, Null, Null, 

BarCount-i+15);
				Plot(LineArray(i-(BarCount-i+10),t1,i,t1,0),"", Colort1, styleLine, Null, Null, 

BarCount-i+15);
				Plot(LineArray(i-(BarCount-i+10),t2,i,t2,0),"", Colort2, styleLine, Null, Null, 

BarCount-i+15);
				Plot(LineArray(i-(BarCount-i+10),t3,i,t3,0),"", Colort3, styleLine, Null, Null, 

BarCount-i+15);
              Plot(LineArray(i-(BarCount-i+10),t4,i,t4,0),"", Colort4, styleLine, Null, Null, BarCount-i+15);
				Plot(LineArray(i-(BarCount-i+10),t5,i,t5,0),"", Colort5, styleLine, Null, Null, 

BarCount-i+15);
				PlotText("Sell @" + WriteVal(Buyvalue, 8.2), i+(BarCount-i+3), Buyvalue, Colorentry, 

Null);			
				PlotText("Stop Loss @" + WriteVal(sl, 8.2), i+(BarCount-i+3), sl, Colorsl, Null);
				PlotText("T 1 @" + WriteVal(t1, 8.2), i+(BarCount-i+2), t1, Colort1, Null);
				PlotText("T 2 @" + WriteVal(t2, 8.2), i+(BarCount-i+2), t2, Colort2, Null);
				PlotText("T 3 @" + WriteVal(t3, 8.2), i+(BarCount-i+2), t3, Colort3, Null);
				PlotText("T 4 @" + WriteVal(t4, 8.2), i+(BarCount-i+2), t4, Colort4, Null);	
				PlotText("T 5 @" + WriteVal(t5, 8.2), i+(BarCount-i+2), t5, Colort5, Null);


//dist = 1.5*ATR(1);
//for( i = 0; i < BarCount; i++ ) 
//{ 
//if( t1[i] ) PlotText( "T1 \n@"  + WriteVal(t1, 1.2) , i, O[ i ]+dist[i],colorWhite); 
//if( t2[i] ) PlotText( "T2 \n@"  + WriteVal(t2, 2.2) , i, O[ i ]+dist[i],colorWhite); 
//if( t3[i] ) PlotText( "T3 \n@"  + WriteVal(t3, 3.2) , i, O[ i ]+dist[i],colorWhite);
//if( t4[i] ) PlotText( "T4 \n@ "  + WriteVal(t4, 4.2) , i, O[ i ]+dist[i],colorWhite);
//if( t5[i] ) PlotText( "T5 \n@"  + WriteVal(t5, 5.2) , i, O[ i ]+dist[i],colorWhite);
//if( Stop1[i] ) PlotText( "SELL Stop\n@"  + WriteVal(stop1[i], 8.2) , i, O[ i ]+dist[i],colorWhite, colorRed);
//}
			}
		}

		if(Buy[i] == 1 OR Sell[i] == 1) i = 0;
	} //end for
	//if(Band==1) {Plotbands();}
	//else { if(Band==2) PlotGrids();}
	tcolor = IIf(EMA(C,9)>EMA(C,20),colorBlue,colorRed);
	pcolor = IIf(C > SAR(), colorTurquoise, colorOrange);}
	//Plot(3,"",tcolor,styleArea|styleOwnScale|styleNoRescale);}
else
{
	Lb = 1;
	TimeFrameSet(inHourly);
//	Evalue = (((H[BarCount-Lb-1]+L[BarCount-Lb-1])/2) + C[BarCount-Lb-1] + O[BarCount-Lb])/3;
	Evalue = O[BarCount-Lb];
	if (V[BarCount-Lb] > V[BarCount-Lb-1]) {fil = "+";}
	else {fil = "";}
	dh = H[BarCount-Lb];
	dl = L[BarCount-Lb];
	TimeFrameRestore();
	V1 = Evalue -(Evalue *0.8/100);
	V2 = V1 + (V1*.5/100);
	V3 = V1 -(Evalue * 0.00866);
	if(dl <= V2) 
	{
		//Plot(V1,"",colorRed, styleLine|styleNoRescale|styleNoLabel);
		//Plot(V2,"",colorRed, styleLine|styleNoRescale|styleNoLabel|styleDashed);
		//Plot(V3,"",colorRed, styleLine|4+8+2048|styleNoLabel);
		AlertIf(Cross(V1, C), "", "Sell @ " + V1, 2);
		AlertIf(Cross(Ref(C, -1), V2), "", "SL Triggered @ " + V2, 0);
		AlertIf(Cross(V3, C), "", "Target Achieved @ " + V3, 0);
		Pt("Sell", V1, V2,V3,colorRed, fil );
	}
	V4= V3 - (V3 *0.8/100);
	V5 = V4 + (V4 *.5/100);	
	V6 = V4 -(V3 * 0.00866);
	if(dl <= V5) 	
	{
		//Plot(V4,"",colorCustom16, styleLine|styleNoRescale|styleNoLabel);
		//Plot(V5,"",colorCustom16, styleLine|styleNoRescale|styleNoLabel|styleDashed);
		//Plot(V6,"",colorCustom16, styleLine|4+8+2048|styleNoLabel);
		AlertIf(Cross(C, V4), "", "Sell @ " + V4, 2);
		AlertIf(Cross(Ref(C, -1), V5), "", "SL Triggered @ " + V5, 0);
		AlertIf(Cross(V6, C), "", "Target Achieved @ " + V6, 0);
		Pt("Sell", V4, V5,V6,colorCustom16, fil );	
	}
	V24= V6 - (V6 *0.8/100);
	V25 = V24 + (V24 *.5/100);	
	V26 = V24 -(V6 * 0.00866);
	if(dl <= V25) 	
	{
		//Plot(V24,"",colorBrown, styleLine|styleNoRescale|styleNoLabel);
		//Plot(V25,"",colorBrown, styleLine|styleNoRescale|styleNoLabel|styleDashed);
		//Plot(V26,"",colorBrown, styleLine|4+8+2048|styleNoLabel);
		AlertIf(Cross(C, V24), "", "Sell @ " + V24, 2);
		AlertIf(Cross(Ref(C, -1), V25), "", "SL Triggered @ " + V25, 0);
		AlertIf(Cross(V26, C), "", "Target Achieved @ " + V26, 0);
		Pt("Sell", V24, V25,V26,colorBrown, fil );	
	}
	V7 = Evalue + (Evalue *0.8/100);
	V8 = V7 - (V7*.5/100);
	V9 = V7 + (Evalue * 0.00866);
	if(dh >= V8) 
	{
		//Plot(V7,"",colorBlue, styleLine|styleNoRescale|styleNoLabel);
		//Plot(V8,"",colorBlue, styleLine|styleNoRescale|styleNoLabel|styleDashed);
		//Plot(V9,"",colorBlue, styleLine|4+8+2048|styleNoLabel);
		AlertIf(Cross(C, V7), "", "Buy @ " + V7, 1);
		AlertIf(Cross(V8, Ref(C, -1)), "", "SL Triggered @ " + V8, 0);
		AlertIf(Cross(C, V9), "", "Target Achieved @ " + V9, 0);
		Pt("Buy", V7, V8,V9,colorBlue, fil );
	}
	V10 = V9 + (V9 *0.8/100);
	V11 = V10 - (V10 *.5/100);
	V12 = V10 + (V9 * 0.00866);
	if(dh >= V11)
	{
		//Plot(V10,"",colorLime, styleLine|styleNoRescale|styleNoLabel);
		//Plot(V11,"",colorLime, styleLine|styleNoRescale|styleNoLabel|styleDashed);
		//Plot(V12,"",colorLime, styleLine|4+8+2048|styleNoLabel);
		AlertIf(Cross(C, V10), "", "Buy @ " + V10, 1);
		AlertIf(Cross(V11, Ref(C, -1)), "", "SL Triggered @ " + V11, 0);
		AlertIf(Cross(C, V12), "", "Target Achieved @ " + V12, 0);
		Pt("Buy", V10, V11,V12,colorLime, fil );
	}
	V210 = V12 + (V12 *0.8/100);
	V211 = V210 - (V210 *.5/100);
	V212 = V210 + (V12 * 0.00866);
	if(dh >= V11)
	{
		//Plot(V210,"",colorAqua, styleLine|styleNoRescale|styleNoLabel);
		//Plot(V211,"",colorAqua, styleLine|styleNoRescale|styleNoLabel|styleDashed);
		//Plot(V212,"",colorAqua, styleLine|4+8+2048|styleNoLabel);
		AlertIf(Cross(C, V210), "", "Buy @ " + V210, 1);
		AlertIf(Cross(V211, Ref(C, -1)), "", "SL Triggered @ " + V211, 0);
		AlertIf(Cross(C, V212), "", "Target Achieved @ " + V212, 0);
		Pt("Buy", V210, V211,V212,colorAqua, fil );
	}
}

	;;//Plot(LineArray(xSp0-10,p00,BarCount-1,p00,5),"",IIf(p00>p100, colorRed, 

//colorGreen),8|styleNoRescale|styleNoLabel,Null, Null,10);
	//Plot(LineArray(xSp0-10,p100,BarCount-1,p100,5),"",IIf(p00<p100, colorRed, 

//colorGreen),8|styleNoRescale|styleNoLabel,Null, Null,16);
	//PlotText("         Major Support : " + IIf(p00 < p100, p00, p100), LastValue(BarIndex())+1, IIf(p00 < p100, 

//p00, p100) + 0.05, colorGreen);
	//PlotText("Major Resistance : " + IIf(p00 > p100, p00, p100), LastValue(BarIndex())+1, IIf(p00 > p100, p00, 

//p100) + 0.05, colorRed);



//z=Param("zig",0.4,0.1,3,0.1);
//Plot(C,"",colorLightGrey,styleBar);
//Plot( Zig(C, z), _DEFAULT_NAME(), colorYellow, styleLine );





//Buy=Cross(C,p)AND TimeNum()>100000 ;


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

//PlotShapes(shapeUpArrow*Buy,colorGreen,0, L,-5 );
//PlotShapes(shapeDownArrow*Sell,colorRed,0, H,-5 );


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

//PlotShapes(shapeSmallUpTriangle*Cover,colorRed,0,L,-30 );
//PlotShapes(shapeSmallDownTriangle*Short,colorGreen,0,H,-30 );

//finalb = Flip( Buy, Sell );
//finals = Flip( Short, Cover );

//Plot(IIf(finalb==1,Ref(Entry,1),IIf(finals==1,Entry1,Null)),"",colorGreen,styleDashed);
//Plot(IIf(finalb==1,stop,IIf(finals==1,stop1,Null)),"",colorRed,styleDashed);
//Plot(IIf(finalb==1,Target,IIf(finals==1,Target1,Null)),"",colorBlue,styleDashed);

} //end function
Mine();

SetChartBkGradientFill( ParamColor("BgTop", ColorRGB( 172,172,172 )),

ParamColor("BgBottom", ColorRGB( 172,172,172 )),ParamColor("titleblock",ColorRGB( 172,172,172 ))); 


GraphXSpace = 5;
Back