My hindi,, english thread(all is bad)

#11
stock72 ne to maire kismet ke darwaje open kar diye he,,,,,,holygrail.......are me to ab lakhpati banuga re..........I sure win the price :)...........because I m jamesbond0000 :D
 
#14
LETS SEE AUTOMATIC TREND LINER CHANNEL AFL........(ALL IS BAD)


// Automatic Linear Trend Channel
// Trend is defined using an example trend: MA(cp,100)
// Amibroker AFL code by Edward Pottasch, November 2011

_SECTION_BEGIN("parameters");
sdfact=Param("Standard Deviation Factor",2,0.5,5,0.1);
offset=Param("Offset",2,1,50,1);
tc=ParamList("Channel Display",List="No Channel|Channel|ChannelRT|Both
Channels",1);
_SECTION_END();

function getUptrend(cp)
{
return IIf(cp>MA(cp,100),1,0);
}
function getDowntrend(cp)
{
return IIf(cp<=MA(cp,100),-1,0);
}

// trend definition
cp=(H+L)/2;
TrendUp=getUptrend(cp);
TrendDown=getDowntrend(cp);
totalTrend=IIf(TrendUp,TrendUp,TrendDown);
dtotalTrend=totalTrend-Ref(totalTrend,-1);
vtotalTrend=ValueWhen(dtotalTrend,dtotalTrend);

// definition start points up and down trend
cbull=vtotalTrend>0 AND Ref(vtotalTrend,-1)<0;cbull=Ref(cbull,1);
cbear=vtotalTrend<0 AND Ref(vtotalTrend,-1)>0;cbear=Ref(cbear,1);
cbull=vtotalTrend>0 AND
Ref(vtotalTrend,-1)<0;cbull=Ref(cbull,1);cbull[BarCount-1]=1;
cbear=vtotalTrend<0 AND
Ref(vtotalTrend,-1)>0;cbear=Ref(cbear,1);cbear[BarCount-1]=1;

// definition areas up and down trend
nwbull=Ref(Flip(cbull,cbear),-1);nwbear=Ref(Flip(cbear,cbull),-1);

xxbull=BarsSince(cbull);xxbull[BarCount-1]=xxbull[BarCount-2]+1;
aaabull=LinRegIntercept(cp,xxbull);bbbbull=LinRegSlope(cp,xxbull);
daabull=Ref(ValueWhen(cbear,aaabull,0),-1);dbbbull=Ref(ValueWhen(cbear,bbbbull,0),-1);
yybull=daabull+dbbbull*(xxbull-1);yybull=IIf(xxbull>Max(offset,1),yybull,Null);
wdbull=sdfact*StdErr(cp,xxbull);wdbull=Ref(ValueWhen(cbear,wdbull,0),-1);

xxbear=BarsSince(cbear);xxbear[BarCount-1]=xxbear[BarCount-2]+1;
aaabear=LinRegIntercept(cp,xxbear);bbbbear=LinRegSlope(cp,xxbear);
daabear=Ref(ValueWhen(cbull,aaabear,0),-1);dbbbear=Ref(ValueWhen(cbull,bbbbear,0),-1);
yybear=daabear+dbbbear*(xxbear-1);yybear=IIf(xxbear>Max(offset,1),yybear,Null);
wdbear=sdfact*StdErr(cp,xxbear);wdbear=Ref(ValueWhen(cbull,wdbear,0),-1);

llbull=LinearReg(cp,xxbull);llbull=IIf(xxbull>Max(Offset,1),llbull,Null);
llbullp=LinearReg(cp,xxbull)+sdfact*StdErr(cp,xxbull);llbullp=IIf(xxbull>Max(Offset,2),llbullp,Null);
llbullm=LinearReg(cp,xxbull)-sdfact*StdErr(cp,xxbull);llbullm=IIf(xxbull>Max(Offset,2),llbullm,Null);
llbear=LinearReg(cp,xxbear);llbear=IIf(xxbear>Max(Offset,1),llbear,Null);
llbearp=LinearReg(cp,xxbear)+sdfact*StdErr(cp,xxbear);llbearp=IIf(xxbear>Max(Offset,2),llbearp,Null);
llbearm=LinearReg(cp,xxbear)-sdfact*StdErr(cp,xxbear);llbearm=IIf(xxbear>Max(Offset,2),llbearm,Null);

_SECTION_BEGIN("Chart Colors");
SetChartBkColor(ParamColor("Background Color",colorBlack));
SetChartOptions(0,chartShowDates);
SetBarFillColor(IIf(C>O,ParamColor("Candle UP
Color",colorGreen),IIf(C<=O,ParamColor("Candle Down
Color",colorRed),colorLightGrey)));
Plot(C,"Price",IIf(C>O,ParamColor("Wick UP
Color",colorDarkGreen),IIf(C<=O,ParamColor("Wick Down
Color",colorDarkRed),colorLightGrey)),64,0,0,0,0);

switch(tc)
{
case("No Channel"):
break;
case("Channel"):
Plot(IIf(nwbull,yybull,Null),"",bbb=ColorRGB(0,255,0),styleDashed);
Plot(IIf(nwbull,yybull+wdbull,Null),"",bbb,styleThick);
Plot(IIf(nwbull,yybull-wdbull,Null),"",bbb,styleThick);
Plot(IIf(nwbear,yybear,Null),"",sss=ColorRGB(255,0,0),styleDashed);
Plot(IIf(nwbear,yybear+wdbear,Null),"",sss,styleThick);
Plot(IIf(nwbear,yybear-wdbear,Null),"",sss,styleThick);
PlotOHLC(IIf(nwbull,yybull+wdbull,Null),IIf(nwbull,yybull+wdbull,Null),IIf(nwbull,yybull-wdbull,Null),
IIf(nwbull,yybull-wdbull,Null),"",ColorRGB(10,15,10),styleCloud|styleNoLabel,0,0,0,-1);

PlotOHLC(IIf(nwbear,yybear+wdbear,Null),IIf(nwbear,yybear+wdbear,Null),IIf(nwbear,yybear-wdbear,Null),
IIf(nwbear,yybear-wdbear,Null),"",ColorRGB(15,10,10),styleCloud|styleNoLabel,0,0,0,-1);

break;
case("ChannelRT"):
Plot(IIf(nwbull,llbull,Null),"",colorGreen,styleDashed,0,1,0,1);
Plot(IIf(nwbull,llbullp,Null),"",colorGreen,styleDashed,0,1,0,1);
Plot(IIf(nwbull,llbullm,Null),"",colorGreen,styleDashed,0,1,0,1);
Plot(IIf(nwbear,llbear,Null),"",colorRed,styleDashed,0,1,0,1);
Plot(IIf(nwbear,llbearp,Null),"",colorRed,styleDashed,0,1,0,1);
Plot(IIf(nwbear,llbearm,Null),"",colorRed,styleDashed,0,1,0,1);
PlotOHLC(IIf(nwbull,llbullp,Null),IIf(nwbull,llbullp,Null),IIf(nwbull,llbullm,Null),
IIf(nwbull,llbullm,Null),"",ColorRGB(10,15,10),styleCloud|styleNoLabel,0,0,0,-1);

PlotOHLC(IIf(nwbear,llbearp,Null),IIf(nwbear,llbearp,Null),IIf(nwbear,llbearm,Null),
IIf(nwbear,llbearm,Null),"",ColorRGB(15,10,10),styleCloud|styleNoLabel,0,0,0,-1);

break;
case("Both Channels"):
Plot(IIf(nwbull,yybull,Null),"",bbb=ColorRGB(0,255,0),styleLine);
Plot(IIf(nwbull,yybull+wdbull,Null),"",bbb,styleThick);
Plot(IIf(nwbull,yybull-wdbull,Null),"",bbb,styleThick);
Plot(IIf(nwbear,yybear,Null),"",sss=ColorRGB(255,0,0),styleLine);
Plot(IIf(nwbear,yybear+wdbear,Null),"",sss,styleThick);
Plot(IIf(nwbear,yybear-wdbear,Null),"",sss,styleThick);
Plot(IIf(nwbull,llbull,Null),"",colorGreen,styleDashed,0,1,0,1);
Plot(IIf(nwbull,llbullp,Null),"",colorGreen,styleDashed,0,1,0,1);
Plot(IIf(nwbull,llbullm,Null),"",colorGreen,styleDashed,0,1,0,1);
Plot(IIf(nwbear,llbear,Null),"",colorRed,styleDashed,0,1,0,1);
Plot(IIf(nwbear,llbearp,Null),"",colorRed,styleDashed,0,1,0,1);
Plot(IIf(nwbear,llbearm,Null),"",colorRed,styleDashed,0,1,0,1);
break;
}
 
#15
lets see this onather afl.........name ..(jamesbond007..small target with stoploss)..............see only 15min,,,20min,,,,or 30min,,,,,or highertimeframe..................(because allwayes badtime):D:D


_SECTION_BEGIN("Background_Setting");
SetChartBkGradientFill( ParamColor("BgTop", colorBlack),

ParamColor("BgBottom", colorBlack),ParamColor("titleblock",colorBlack ));
_SECTION_END();

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

Title = EncodeColor(colorWhite)+Name()+"--"+ Date() + ", Op=" + Open + ", Hi=" + High + ", Lo=" + Low + ", LTP=" + Close + ", Change= " + SelectedValue( ROC( C, 1 ) ) + "%" + "\n Today`s High=" + DayHigh + ", Today`s Low=" + DayLow ;

prev=AMA2(C,1,0);
d=IIf(C>Ref(Max(Max(H,Ref(H,-20)),Max(Ref(H,-10),Ref(H,-15))),-1),Min(Min(L,Ref(L,-20)),Min(Ref(L,-10),Ref(L,-15))),
IIf(C<Ref(Min(Min(L,Ref(L,-20)),Min(Ref(L,-10),Ref(L,-15))),-1),Max(Max(H,Ref(H,-20)),Max(Ref(H,-10),Ref(H,-15))),PREV));
a=Cross(Close,d);
b=Cross(d,Close);
state=IIf(BarsSince(a)<BarsSince(b),1,0);
s=state>Ref(state,-1);
ss=state<Ref(state,-1);
sss=state==Ref(state,-1);
col=IIf(state == 1 ,51,IIf(state ==0,4,1));
Plot(C,"",Col,64);
Buy = s;
Sell = ss;
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes(shape, IIf(Buy,colorGreen,colorRed), 0, IIf(Buy,Low,High));
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-10);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-20);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-15);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=20);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=30);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-25);


dist = 0.8*ATR(10);
dist1 = 2*ATR(10);
for( i = 0; i < BarCount; i++ )
{
if( Buy )
{
//PlotText( "\nBuy:" + L[ i ] + "\nT= " + (L*1.0033) + "\nSL= " + (L*0.9975), i, L[ i ]-dist, colorGreen, colorWhite );

t1 = (L*1.0025);
frac_t = (frac(t1)*10000);
var_t = round((frac_t % 25));
t1 = (t1 -( var_t / 10000));

t2 = (L*1.0035);
frac_t = (frac(t2)*10000);
var_t = round((frac_t % 20));
t2 = (t2 -( var_t / 10000));

t3 = (L*1.0040);
frac_t = (frac(t3)*10000);
var_t = round((frac_t % 25));
t3 = (t3 -( var_t / 10000));

PlotText( "\nBuy:" + L[ i ] + "\nT1= " + t1 + "\nT2= " + t2 + "\nT3= " + t3, i, L[ i ]-dist, colorGreen, colorWhite );

sl = (L*0.9992);
frac_sl = (frac(sl)*10000);
var_sl = round((frac_sl % 25));
sl = (sl -( var_sl / 10000));

PlotText( "\n\n\n\n\nSL= " + sl, i, L[ i ]-dist, colorYellow, colorBlack );

}
if( Sell )
{
//PlotText( "Sell:" + H[ i ] + "\nT= " + (H*0.995) + "\nSL= " + (H*1.0025), i, H[ i ]+dist1, colorRed, colorWhite );

t1 = (H*0.9975);
frac_t = (frac(t1)*10000);
var_t = round((frac_t % 25));
t1 = (t1 -( var_t / 10000));

t2 = (H*0.9970);
frac_t = (frac(t2)*10000);
var_t = round((frac_t % 25));
t2 = (t2 -( var_t / 10000));

t3 = (H*0.9955);
frac_t = (frac(t3)*10000);
var_t = round((frac_t % 25));
t3 = (t3 -( var_t / 10000));

PlotText( "Sell:" + H[ i ] + "\nT1= " + t1 + "\nT2= " + t2 + "\nT3= " + t3, i, H[ i ]+dist1, colorRed, colorWhite );

sl = (H*1.0008);
frac_sl = (frac(sl)*10000);
var_sl = round((frac_sl % 25));
sl = (sl -( var_sl / 10000));

PlotText( "\n\n\n\nSL= " + sl, i, H[ i ]+dist1, colorYellow, colorBlack );

}
}


Filter = s OR sss OR sss ;
AddColumn(C,"close",1.2);
AddColumn( IIf( s, 66,1 ), "buy", formatChar, 1, bkcolor =IIf (s,colorYellow, colorPink ));
AddColumn( IIf( Ss, 83,1 ), "sell", formatChar, 1, bkcolor =IIf (Ss,colorPink, colorWhite ));
AddColumn( IIf( sss, 87,1 ), "wait", formatChar, 1, bkcolor =IIf (sss,colorYellow, colorRed ));


_SECTION_BEGIN("swing");
no=20;
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;
PlotShapes(a,style, IIf(a,colorGreen,colorRed), 0, IIf(a,Low,High));
Plot(supres,"Swing",colorYellow,styleStaircase);
_SECTION_END();



_SECTION_BEGIN("trend");
uptrend=PDI(20)>MDI(10)AND Signal(29)<MACD(13);
downtrend=MDI(10)>PDI(20)AND Signal(29)>MACD(13);
Plot( 2, /* defines the height of the ribbon in percent of pane width */"ribbon",
IIf( uptrend, colorGreen, IIf( downtrend, colorRed, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
_SECTION_END();

Buy = s AND a AND uptrend ;
Short = ss AND b AND downtrend ;
Sell = ss AND b AND downtrend ;
Cover = s AND a AND uptrend ;

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

Filter=Buy OR Sell;
Filter= Cover OR Short;

AddColumn( Buy, "Buy", 1);
AddColumn(Sell, "Sell", 1);
AddColumn(Close,"Close",1.2);
AddColumn(Volume,"Volume",1.0);


// Plot the Buy and Sell arrows.
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-10);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-20);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-15);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=20);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=30);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-25);




//plot volume graph
_SECTION_BEGIN("Volume");
// Plot( Volume, _DEFAULT_NAME(), ParamColor("Color", colorLightGrey ), styleNoTitle | ParamStyle( "Style", styleHistogram | styleOwnScale | styleNoLabel, maskHistogram ), 2 );
_SECTION_END();

GraphXSpace = 5;
 

Similar threads