Share your Amibroker day trading setup

#1
There is no successful chart in the world for day trading, so no secret please share your Amibroker formula file


I am not a successful trader. i am from Tamilnadu.

Have 8000rs in my trading account. more than 20 times i blow my account.

Now i am trading only in crude oil, daily 2 to 3 mini lots. Two months gone my return is 30% to 40%.

Have some knowledge about RSi Divergence and price action trading.

Below is my trade setup.


My support resistance


Code:
_SECTION_BEGIN("jmoney2");
SetChartOptions(0,chartShowArrows|chartShowDates);

GraphXSpace=Param("GraphXSpace",-30,0,100,1);
    dec = (Param("Decimals",2,0,7,1)/10)+1;
SetChartBkColor(ParamColor("Outer Panel", colorBlack));
SetChartBkGradientFill(ParamColor("Upper Chart", colorDarkGrey), ParamColor("Lower Chart", colorDarkGrey));

Title = EncodeColor(55)+  Title = Name() + "     " + EncodeColor(32) + Date() +
"      " + EncodeColor(5) + "{{INTERVAL}}  " +
    EncodeColor(55)+ "     Open = "+ EncodeColor(52)+ WriteVal(O,dec) +
    EncodeColor(55)+ "     High = "+ EncodeColor(5) + WriteVal(H,dec) +
    EncodeColor(55)+ "      Low = "+ EncodeColor(32)+ WriteVal(L,dec) +
    EncodeColor(55)+ "    Close = "+ EncodeColor(7)+ WriteVal(C,dec)+
    EncodeColor(55)+ "    Volume = "+ EncodeColor(11)+ WriteVal(V,1);


////////////////////////////


////////////////////////////


colorHighliter = IIf(C >= O, ColorRGB(0, 128, 0), ColorRGB(128, 0, 0));

//Demand Point
colorDemandPoint = ParamColor("Demand Line", ColorRGB(0, 128, 255));
DemandPoint = (Ref(L, -1) < Ref(L, -2)) & (L < Ref(L, -1)) & (L < Ref(L, 1)) & (Ref(L, 1) < Ref(L, 2));

//Supply Point
colorSupplyPoint = ParamColor("Supply Line", ColorRGB(255, 128, 0));
SupplyPoint = (Ref(H, -1) > Ref(H, -2)) & (H > Ref(H, -1)) & (H > Ref(H, 1)) & (Ref(H, 1) > Ref(H, 2));

CountTrendBars = 0;
CurrentBar = BarCount - 1;
dx0 = dx1 = dy0 = dy1 = 0;
sx0 = sx1 = sy0 = sy1 = 0;
for (i = 0; i < BarCount; i++) {
	CurrentBar = (BarCount - 1) - i;
	if (DemandPoint[CurrentBar]) {
		if (dx1 == 0 & dy1 == 0) {
			dx1 = CurrentBar;
			dy1 = L[CurrentBar];
		} else {
			dx0 = CurrentBar;
			dy0 = L[CurrentBar];
		}
		if (dx0 != 0 & dx1 != 0 & dy0 != 0 & dy1 != 0) {
			if (dy0 < dy1) {
				a = (-dy0 + dy1) / (-dx0 + dx1);
				b = dy0 - dx0 * a;
				for (j = dx1; j < BarCount; j++) {
					if (j != dx1) {
						y2 = a * j + b;
						if (C[j] < y2) {
							dy1 = y2;
							dx1 = j;
							colorHighliter[j] = ColorRGB(128, 0, 128);
							CountTrendBars[j] = dx1 - dx0 - 1;
							break;
						}
					}
				}
				if (dy1 != y2) {
					dy1 = y2;
					dx1 = BarCount - 1;
				}
				//Plot(LineArray(dx0, dy0, dx1, dy1, 0), "", colorDemandPoint, styleLine, Null, Null, 0, 0, 2);
			}
			dx1 = dx0;
			dy1 = dy0;
			dx0 = dy0 = 0;
		}	
	}
	if (SupplyPoint[CurrentBar]) {
		if (sx1 == 0 & sy1 == 0) {
			sx1 = CurrentBar;
			sy1 = H[CurrentBar];
		} else {
			sx0 = CurrentBar;
			sy0 = H[CurrentBar];
		}
		if (sx0 != 0 & sx1 != 0 & sy0 != 0 & sy1 != 0) {
			if (sy0 > sy1) {
				a = (-sy0 + sy1) / (-sx0 + sx1);
				b = sy0 - sx0 * a;
				for (j = sx1; j < BarCount; j++) {
					if (j != sx1) {
						y2 = a * j + b;
						if (C[j] > y2) {
							sy1 = y2;
							sx1 = j;
							colorHighliter[j] = ColorRGB(128, 128, 0);
							CountTrendBars[j] = sx1 - sx0 - 1;
							break;
						}
					}
				}
				if (sy1 != y2) {
					sy1 = y2;
					sx1 = BarCount - 1;
				}
				//Plot(LineArray(sx0, sy0, sx1, sy1, 0), "", colorSupplyPoint, styleLine, Null, Null, 0, 0, 2);
			}
			sx1 = sx0;
			sy1 = sy0;
			sx0 = sy0 = 0;
		}	
	}	
}



//Price
SetBarFillColor(colorHighliter);
Plot(C, "Close", IIf(colorHighliter == ColorRGB(128, 0, 128), ColorRGB(255, 0, 255), IIf(colorHighliter == ColorRGB(128, 128, 0), ColorRGB(255, 255, 0), IIf(C > O, ColorRGB(0, 255, 0), IIf(C < O, ColorRGB(255, 0, 0), ColorRGB(255, 255, 255))))), styleCandle, Null, Null, 0, 0, 1);



////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////

FS=Param("MM Price Font Size",20,11,100,1);
Hor=Param("MM Price Horizontal Position",840,1,1200,1);
Ver=Param("MM price Vertical Position",10,1,830,1); 

  GfxSelectFont("tahoma", FS, 700, True ); 
   GfxSetBkMode( 1 );  
   GfxSetTextColor( colorLime); 
   GfxTextOut(""+C, Hor+29 , Ver);
   YC=TimeFrameGetPrice("C",inDaily,-1);
   DD=Prec(C-YC,2);
   xx=Prec((DD/YC)*100,2);
  GfxSelectFont("tahoma", 11, 700, True ); 
  GfxSetBkMode( 1 );  
  GfxSetTextColor(7); 
   GfxTextOut(""+DD+"  ("+xx+"%)", Hor+29 , Ver+29 );
//////////////////////////////////////////////////////////


sr=ParamToggle("Plot Supp/Res lines","No|Yes" ,1);
Per=Param("Sensitivity",0.65,0.5,5,0.5);
g=Param("No.of Lines",5,1,5,1);
x=Cum(1);
Pk1=PeakBars(H,per,1)== 0;
Tk1=TroughBars(L,per,1)== 0;

px1=LastValue(ValueWhen(pk1,x,1));
px2=LastValue(ValueWhen(Pk1,x,2));
px3=LastValue(ValueWhen(Pk1,x,3));
px4=LastValue(ValueWhen(pk1,x,4));
px5=LastValue(ValueWhen(Pk1,x,5));

tx1=LastValue(ValueWhen(Tk1,x,1));
tx2=LastValue(ValueWhen(Tk1,x,2));
tx3=LastValue(ValueWhen(Tk1,x,3));
tx4=LastValue(ValueWhen(Tk1,x,4));
tx5=LastValue(ValueWhen(Tk1,x,5));

XT1 =LastValue(ValueWhen(pk1,H,1));XT1c =LastValue(ValueWhen(pk1,Max(C,O),1));
XT2 =LastValue(ValueWhen(Pk1,H,2));XT2c =LastValue(ValueWhen(pk1,Max(C,O),2));
XT3 =LastValue(ValueWhen(Pk1,H,3));XT3c =LastValue(ValueWhen(pk1,Max(C,O),3));
XT4 =LastValue(ValueWhen(pk1,H,4));XT4c =LastValue(ValueWhen(pk1,Max(C,O),4));
XT5 =LastValue(ValueWhen(Pk1,H,5));XT5c =LastValue(ValueWhen(pk1,Max(C,O),5));

YT1 =LastValue(ValueWhen(tk1,L,1));YT1c =LastValue(ValueWhen(tk1,Min(O,C),1));
YT2 =LastValue(ValueWhen(tk1,L,2));YT2c =LastValue(ValueWhen(tk1,Min(O,C),2));
YT3 =LastValue(ValueWhen(tk1,L,3));YT3c =LastValue(ValueWhen(tk1,Min(O,C),3));
YT4 =LastValue(ValueWhen(tk1,L,4));YT4c =LastValue(ValueWhen(tk1,Min(O,C),4));
YT5 =LastValue(ValueWhen(tk1,L,5));YT5c =LastValue(ValueWhen(tk1,Min(O,C),5));

pk1=IIf(x>px1 AND g>=1 AND sr,XT1,Null);pk1c=IIf(x>px1 AND g>=1 AND sr,XT1c,Null);
Col1=IIf( LastValue(C)>pk1, ColorRGB(14,14,100), ColorRGB(180,20,20) );
Plot(pk1,"",31,1);PlotOHLC(0,pk1,pk1c,0,"",Col1,styleCloud|styleNoLabel,Null, Null, Null, -1);
pk2=IIf(x>px2 AND g>=2 AND sr,XT2,Null);pk2c=IIf(x>px2 AND g>=2 AND sr,XT2c,Null);
Col2=IIf( LastValue(C)>pk2, ColorRGB(24,24,120), ColorRGB(180,40,40) );
Plot(pk2,"",31,1);PlotOHLC(0,pk2,pk2c,0,"",Col2,styleCloud|styleNoLabel,Null, Null, Null, -2);
pk3=IIf(x>px3 AND g>=3 AND sr,XT3,Null);pk3c=IIf(x>px3 AND g>=3 AND sr,XT3c,Null);
Col3=IIf( LastValue(C)>pk3, ColorRGB(34,34,140),ColorRGB(180,60,60));
Plot(pk3,"",31, 1);PlotOHLC(0,pk3,pk3c,0,"",Col3,styleCloud|styleNoLabel,Null, Null, Null, -3);
pk4=IIf(x>px4 AND g>=4 AND sr,XT4,Null);pk4c=IIf(x>px4 AND g>=4 AND sr,XT4c,Null);
Col4=IIf( LastValue(C)>pk4, ColorRGB(44,44,160), ColorRGB(180,80,80));
Plot(pk4,"",31,1);PlotOHLC(0,pk4,pk4c,0,"",Col4,styleCloud|styleNoLabel,Null, Null, Null, -4);
pk5=IIf(x>px5 AND g>=5 AND sr,XT5,Null);pk5c=IIf(x>px5 AND g>=5 AND sr,XT5c,Null);
Col5=IIf( LastValue(C)>pk5, ColorRGB(54,54,180), ColorRGB(180,100,100));
Plot(pk5,"",31,1);PlotOHLC(0,pk5,pk5c,0,"",Col5,styleCloud|styleNoLabel,Null, Null, Null, -5);
tl1=IIf(x>tx1 AND g>=1 AND sr,YT1,Null);tl1c=IIf(x>tx1 AND g>=1 AND sr,YT1c,Null);
Col1=IIf( LastValue(C)>tl1, ColorRGB(14,14,100), ColorRGB(180,20,20)  );
Plot(tl1,"",1,1);PlotOHLC(0,tl1,tl1c,0,"",Col1,styleCloud|styleNoLabel,Null, Null, Null, -1);
tl2=IIf(x>tx2 AND g>=2 AND sr,YT2,Null);tl2c=IIf(x>tx2 AND g>=2 AND sr,YT2c,Null);
Col2=IIf( LastValue(C)>YT2, ColorRGB(24,24,120), ColorRGB(180,40,40));
Plot(tl2,"",1,1);PlotOHLC(0,tl2,tl2c,0,"",Col2,styleCloud|styleNoLabel,Null, Null, Null, -2);
tl3=IIf(x>tx3 AND g>=3 AND sr,YT3,Null);tl3c=IIf(x>tx3 AND g>=3 AND sr,YT3c,Null);
Col3=IIf( LastValue(C)>YT3, ColorRGB(34,34,140), ColorRGB(180,60,60) );
Plot(tl3,"",1,1);PlotOHLC(0,tl3,tl3c,0,"",Col3,styleCloud|styleNoLabel,Null, Null, Null, -3);
tl4=IIf(x>tx4 AND g>=4 AND sr,YT4,Null);tl4c=IIf(x>tx4 AND g>=4 AND sr,YT4c,Null);
Col4=IIf( LastValue(C)>YT4, ColorRGB(44,44,160), ColorRGB(180,80,80) );
Plot(tl4,"",1,1);PlotOHLC(0,tl4,tl4c,0,"",Col4,styleCloud|styleNoLabel,Null, Null, Null, -4);
tl5=IIf(x>tx5 AND g>=5 AND sr,YT5,Null);tl5c=IIf(x>tx5 AND g>=5 AND sr,YT5c,Null);
Col5=IIf( LastValue(C)>YT5, ColorRGB(54,54,180), ColorRGB(180,100,100));
Plot(tl5,"",1,1);PlotOHLC(0,tl5,tl5c,0,"",Col5,styleCloud|styleNoLabel,Null, Null, Null, -5);

GfxSetOverlayMode(1);
GfxSetTextColor(10); 
GfxSelectFont("Old English Text MT", 12, 300, False, False, 0); 
GfxTextOut("  we are ", Status("pxwidth")-60 , Status("pxheight")-20 );
_SECTION_END();


_SECTION_BEGIN("ema_crossover");
x = EMA(Close,20);
y = EMA(Close,50);
Plot(EMA(Close,20),"",colorRed,styleLine);
Plot(EMA(Close,50),"",colorBrightGreen,styleLine );

Plot(EMA(Close,100),"",colorWhite,styleLine );

 
Buy=Cross(x,y);
PlotShapes(shapeUpArrow*Buy,colorGreen,0,L, Offset=-50);

 
Sell=Cross(y,x);
PlotShapes(shapeDownArrow*Sell,colorRed,0,H, Offset=-50);
AlertIf( Sell, "SOUND C:\\Windows\\Media\\chord.wav", "Audio alert", 2 );

 
_SECTION_END();

Another formula for price projection with EMA.
HONESTLY I WROTE THIS FORMULA.BUT STRATEGY IS NOT MINE SOME WHERE TAKEN FROM GOOGLE.




Code:
_SECTION_BEGIN("jmoney2");
SetChartOptions(0,chartShowArrows|chartShowDates);



GraphXSpace=Param("GraphXSpace",0,0,100,1);
    dec = (Param("Decimals",2,0,7,1)/10)+1;
SetChartBkColor(ParamColor("Outer Panel", colorBlack));
SetChartBkGradientFill(ParamColor("Upper Chart", colorDarkGrey), ParamColor("Lower Chart", colorDarkGrey));

Title = EncodeColor(55)+  Title = Name() + "     " + EncodeColor(32) + Date() +
"      " + EncodeColor(5) + "{{INTERVAL}}  " +
    EncodeColor(55)+ "     Open = "+ EncodeColor(52)+ WriteVal(O,dec) +
    EncodeColor(55)+ "     High = "+ EncodeColor(5) + WriteVal(H,dec) +
    EncodeColor(55)+ "      Low = "+ EncodeColor(32)+ WriteVal(L,dec) +
    EncodeColor(55)+ "    Close = "+ EncodeColor(7)+ WriteVal(C,dec)+
    EncodeColor(55)+ "    Volume = "+ EncodeColor(11)+ WriteVal(V,1);
///////////////////////


////////////////////////////

colorHighliter = IIf(C >= O, ColorRGB(0, 128, 0), ColorRGB(128, 0, 0));



CountTrendBars = 0;
CurrentBar = BarCount - 1;
dx0 = dx1 = dy0 = dy1 = 0;
sx0 = sx1 = sy0 = sy1 = 0;
//Price
SetBarFillColor(colorHighliter);
Plot(C, "Close", IIf(colorHighliter == ColorRGB(128, 0, 128), ColorRGB(255, 0, 255), IIf(colorHighliter == ColorRGB(128, 128, 0), ColorRGB(255, 255, 0), IIf(C > O, ColorRGB(0, 255, 0), IIf(C < O, ColorRGB(255, 0, 0), ColorRGB(255, 255, 255))))), styleCandle, Null, Null, 0, 0, 1);

///////////////////////////////////////////

FS=Param("MM Price Font Size",20,11,100,1);
Hor=Param("MM Price Horizontal Position",840,1,1200,1);
Ver=Param("MM price Vertical Position",10,1,830,1); 

  GfxSelectFont("tahoma", FS, 700, True ); 
   GfxSetBkMode( 1 );  
   GfxSetTextColor( colorLime); 
   GfxTextOut(""+C, Hor+29 , Ver);
   YC=TimeFrameGetPrice("C",inDaily,-1);
   DD=Prec(C-YC,2);
   xx=Prec((DD/YC)*100,2);
  GfxSelectFont("tahoma", 11, 700, True ); 
  GfxSetBkMode( 1 );  
  GfxSetTextColor(7); 
   GfxTextOut(""+DD+"  ("+xx+"%)", Hor+29 , Ver+29 );
//////////////////////////////////////////////////////////


DayH = TimeFrameGetPrice("H", inDaily, -1); 

DayL = TimeFrameGetPrice("L", inDaily, -1); 

DayC = TimeFrameGetPrice("C", inDaily, -1); 

DayO = TimeFrameGetPrice("O", inDaily);// current day open

///for High1////
N1=(DayC+DayH)/2;
N3=(N1/3)*2;
N5=DayO/3;
H1=N3+N5;H1I = LastValue (H1,1); // Resistance 1

///for LOW1////

O1 = (DayC+DayL)/2 ;
O3=(O1/3)*2;
L1=O3+N5; L1I = LastValue (L1,1); // Resistance 1

///FOR LOW2 & HIGH2///

H2=H1+(H1-L1)/0.6; H2I = LastValue (H2,1); // Resistance 1
L2=L1-(H1-L1)/1.6; L2I = LastValue (L2,1); // Resistance 1


Plot(H1,"",colorRed,styleLine|styleDots|styleNoRescale);
Plot(H2,"",colorRed,styleLine|styleDots|styleNoRescale);
Plot(L1,"",colorGreen,styleLine|styleDots|styleNoRescale);
Plot(L2,"",colorGreen,styleLine|styleDots|styleNoRescale);

numbars = LastValue(Cum(Status("barvisible")));
fraction= IIf(StrRight(Name(),3) == "", 3.2, 3.2);
hts = -33.5;

PlotText(" RESISTANCE 1 = " + WriteVal(H1,fraction), LastValue(BarIndex())-(numbars/Hts),H1I , colorRed);
PlotText(" RESISTANCE 2 = " + WriteVal(H2,fraction), LastValue(BarIndex())-(numbars/Hts),H2I, colorRed);
PlotText(" SUPPORT 1 = " + WriteVal(L1,fraction), LastValue(BarIndex())-(numbars/Hts),L1I, colorGreen);
PlotText(" SUPPORT 2 = " + WriteVal(L2,fraction), LastValue(BarIndex())-(numbars/Hts),L2I, colorGreen);


_SECTION_BEGIN("ema_crossover");
x = EMA(Close,20);
y = EMA(Close,48.50);
Plot(EMA(Close,20),"",colorRed,styleLine);
Plot(EMA(Close,48.50),"",colorBrightGreen,styleLine );
 Plot(EMA(Close,100),"",colorWhite,styleLine );

Buy=Cross(x,y);
PlotShapes(shapeUpArrow*Buy,colorGreen,0,L, Offset=-50);

 
Sell=Cross(y,x);
PlotShapes(shapeDownArrow*Sell,colorRed,0,H, Offset=-50);
AlertIf( Sell, "SOUND C:\\Windows\\Media\\chord.wav", "Audio alert", 2 );

 
_SECTION_END();

RSI Formula


Code:
_SECTION_BEGIN("MODIFIED RSI ");
SetChartBkColor(ParamColor("Panel color ",colorBlack));
RP = Param("RSI",14,2,20,1);
UL= Param("Upper Limit",70,0,100,1);
LL= Param("Lower Limit",30,0,100,1);
PlotGrid(UL,colorBlue);    
PlotGrid(LL,colorBlue); 
R= RSIa(C, RP);
Plot(R, "MODIFIED RSI",  colorLime, styleThick);
 
Overbought=70;
Oversold=30;
Plot(Overbought,"Overbought Zone",colorBlue);
Plot(Oversold,"Oversold Zone",colorGreen);
 
Overbought=70;
Oversold=30;
Buy = Cross(R, Oversold) AND R > Oversold;
Sell = Cross(Overbought, R) AND R < Overbought;
 
//PlotShapes(IIf(Sell, shapeDownArrow , shapeNone), colorRed);
//PlotShapes(IIf(Buy, shapeUpArrow , shapeNone), colorGreen); 
 
_SECTION_END();
 
MaxGraph=10;
Period1=Param("Period 1", 10, 5, 50, 1);
Period2=Param("Period 2", 10, 5, 50, 1);
EMA1= EMA(R,Period1);
EMA2= EMA(EMA1,Period2);
Difference= EMA1 - EMA2;
ZeroLagEMA= EMA1 + Difference;
PR=abs(ZeroLagEMA); 
 
Graph0=PR;
 
MoveAvg=MA(PR,5);  
 
// Graph1=MoveAvg;          Remove the // if you want a Crossover MA to plot
// Graph1Color=colorTan;
 
Graph0Style=4;
upbar= PR>= MoveAvg AND PR>= Ref(PR,-1) ;
downbar=(PR < MoveAvg) OR PR>= MoveAvg AND PR< Ref(PR,-1) ;
barcolor = IIf( downbar,colorRed, IIf( upbar, colorBrightGreen, 7));
Graph0BarColor = ValueWhen( barcolor != 0, barcolor );
Graph2=30;
Graph3=70;
 
Graph2Style=Graph3Style=Graph4Style=1;
Graph4Color=2;
Graph2Color=5;
Graph3Color=4;


Happy to share with every one. please share your AFL



:clapping::clapping::clapping::clapping::clapping::clapping::clapping:
 
Last edited:

manus

New Member
#6
can anyone tell me how get live data feed for nifty futures from yahoo and google finance for amibroker? it is showing nifty spot price.
 

mastermind007

Well-Known Member
#10
Not possible , like cow give only milk and it don't give curd
Cow gives you nothing. Humans pay humans to tie cow's legs; muzzle her mouth, separate her calf or inject her with lactation hormones and then use their rough hands to drench last drop of milk out of her udders.
 

Similar threads