Simple Coding Help - No Promise.

mechtrader

Well-Known Member
Hi Amit,

I also have been searching alot on how to find the angle of the mov avg or the slope.
Although mathematically its quite a easy concept but I would require help from the coders here.
eq. if you want to calculate the slope of ma(c,10). u need to know the value of ma at the current bar and value of ma 10 bars before that.
Now draw a straight line between both the values. The slope of this line is what we require.

If you get some help related to this, plz let me also know.

Thanks,
MT
 

casoni

Well-Known Member
Hello ,

i had these formulas since long [ Angel / Slope ]

//----1-----
EMA34 = EMA(C,34);
PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
x1_EMA34 = 0;
x2_EMA34 = 2;
y1_EMA34 = 0;
y2_EMA34 = (Ref(EMA34, -2) - EMA34) / Avg * range;
c_EMA34 = sqrt((x2_EMA34 - x1_EMA34)*(x2_EMA34 - x1_EMA34) + (y2_EMA34 - y1_EMA34)*(y2_EMA34 - y1_EMA34));
angle_EMA34 = round(180 * acos((x2_EMA34 - x1_EMA34)/c_EMA34) / PI);
TitleAngleEMA34 = EncodeColor(colorWhite) + "\nEMA34 angle = ";
angle_EMA34 = IIf(y2_EMA34 > 0, - angle_EMA34, angle_EMA34);
if(abs(SelectedValue(angle_EMA34)) >= 25)
{
TitleAngleEMA34 = TitleAngleEMA34 + EncodeColor(colorLime);
}
else if(abs(SelectedValue(angle_EMA34)) >= 15)
{
TitleAngleEMA34 = TitleAngleEMA34 + EncodeColor(colorYellow);
}
else
{
TitleAngleEMA34 = TitleAngleEMA34 + EncodeColor(colorRed);
}
TitleAngleEMA34 = TitleAngleEMA34 + angle_EMA34;

Color_ema_eangle= IIf(angle_ema34>=5,ParamColor("EMA34 trending up",colorTurquoise),IIf(angle_ema34<=-5,ParamColor("EMA34 trending down",colorRed),ParamColor("EMA34 not trending",colorYellow)));
Plot(EMA34,"EMA ",Color_ema_eangle, styleDashed| styleThick );
Title=TitleAngleEMA34;

//============================

//this is coded By T.J

Var = MA(C,14);
Plot( Var,"",9, 128);

START=34; // can use param and define Lookback periods
END= 1;
ARRAY= Var ;
L1=LastValue( Cum(1));
X0=L1-START;
X1=L1-END;
Y0=ARRAY[X0] ;
Y1=ARRAY[X1] ;
PixelFactor = Status("pxheight" )/Status( "pxwidth" );
XYFactor =
(Status("axismaxy" )-Status( "axisminy" ))/(Status( "lastvisiblebarindex")-Status("firstvisiblebarindex"));
FACTOR = PixelFactor / XYFactor;
ANGLE=atan(FACTOR* (Y1-Y0)/( X1-X0));
Color = IIf(Y1 > Y0,5,4); // Green = Positive Red = Negative
Title1="ANGLE= "+WriteVal( ANGLE)+" RADS"+",
["+WriteVal( 45*ANGLE/ atan(1),1.0)+" DEGS]";
Plot(ARRAY," ",12,1);
Plot(LineArray( X0,Y0,X1, Y1),Title1 + "\nLine to Last Value of End Point
Value",Color ,1);
Plot(LineArray( X0,Y0,X1, Y0),"Horizontal" ,2,1);
Plot(LastValue( Y0),"\nBegin at This point in the Array",10,1);

Hope you will find useful
Thank you
 
dear all
can any one correct this afl pls



_SECTION_BEGIN("ooa");

GfxSetBkMode(1);
jmot=SS_jmot();
Graph0=jmot;
Graph0BarColor=IIf(jmot>0,5,4);


_SECTION_BEGIN("hmw");

GfxSelectFont("tohomabold", Status("pxheight")/16);
GfxSetTextAlign( 6 );
GfxSetTextColor( ColorHSB( 220, 290, 250) );
GfxSetBkMode(0);
GfxTextOut( Name(), Status("pxwidth")/1.8, Status("pxheight")/45 );
SS_hrd();
cx=Param("cxposn",1085,0,1200,1);
cy=Param("cyposn",16,0,1000,1);
GfxSetBkColor(ColorRGB(200,50,100));
GfxSelectFont( "Bodoni MT",25,98, False);
GfxSetTextColor( colorYellow);
GfxSetTextColor( ColorHSB( 100, 10, 400) );
GfxTextOut("LTP. "+C+" ", cx, cy );
SS_hrd();
_SECTION_END();


_SECTION_END();

_SECTION_BEGIN("Title");

DDayO = TimeFrameGetPrice("O", inDaily);
DHiDay = TimeFrameGetPrice("H", inDaily);
DLoDay = TimeFrameGetPrice("L", inDaily);
prvC = TimeFrameGetPrice("C", inDaily, -1);//close
DayH = TimeFrameGetPrice("H", 60*105, -1);// yesterdays high
DayL = TimeFrameGetPrice("L", 60*105, -1);//low
DayC = TimeFrameGetPrice("C", 60*105, -1);//close
DayO = TimeFrameGetPrice("O", 60*105);// current day open
HiDay = TimeFrameGetPrice("H", 60*105);
LoDay = TimeFrameGetPrice("L", 60*105);

Title = EncodeColor(ColorRGB(10,190,300))+" * www.stockxray.in * "+EncodeColor(colorWhite) +" "+ Interval(2) + " " + Date() +
EncodeColor(colorBrightGreen) + " \n O " + EncodeColor(colorBrightGreen) + O +
" H : " + H +
" L : " + L+ EncodeColor(colorOrange) +
" ~ Prev D - Close : " + EncodeColor(colorPink) + prvC +EncodeColor(colorGold)+
"\n Day Open : " +DDayO + " High : " +DHiDay + " Low : " + DLoDay ;
_SECTION_END();



_SECTION_BEGIN("950");

SS_xlq();
kep=SS_C1();
gorn=SS_C2();
SS_hrd();
url = SS_A1();
klo = SS_B1();

pos = 4.9*ATR(5);
for( i = 0; i < BarCount; i++ ) {
if( kep ) PlotText( "Buy * S-xray @\n" +url, i, Low - pos, colorAqua, Offset=-10 );

if( gorn ) PlotText( "Sell * S-xray @\n" + klo, i, Low + pos, colorRose, Offset=-10 );
}

_SECTION_END();

_SECTION_BEGIN("750");
range = Param("ADX Periods", 7, 2, 200, 1 );
Col_adx = IIf(ADX(range) > Ref(ADX(range),-1) AND ADX(range) > 20,colorBlue, colorGrey40);
em = Param("EMA Of ADX",3,1,20,1);
p = EMA(PDI(range),em);
m = EMA(MDI(range),em);
SS_ntk();
//Plot( ADX(range), _DEFAULT_NAME(), Col_adx , ParamStyle("ADX style", styleThick ) );
btp = BBandTop( P, 5, 0.4 );
bbp = BBandBot( P, 5, 0.4 );
btm = BBandTop( m, 5, 0.4 );
bbm = BBandBot( m, 5, 0.4 );
//Plot(btp , "" , colorDarkGreen, styleDashed );
//Plot(bbp , "" , colorDarkGreen, styleDashed );
//Plot( btm, "" , colorDarkRed, styleDashed );
//Plot( bbm, "" , colorDarkRed, styleDashed );
Col_p = IIf(p > btp, colorBrightGreen,colorDarkGreen);
Col_m = IIf(m > btm,colorRed,colorDarkRed);
//Plot( p, "+DI", Col_p, styleDots );
//Plot( M, "-DI", Col_m, styleDots );

Buy = ADX(range) > MDI(range) AND PDI(range) > MDI(range);
Sell = ADX(range) > PDI(range) AND MDI(range) > PDI(range);
Buy_sell = IIf(Buy,colorGreen,IIf(Sell,colorRed,colorBlack));
trend = IIf(col_p==colorBrightGreen,colorBrightGreen,IIf(col_m==colorRed,colorRed,IIf(PDI(range) > MDI(range),colorDarkGreen,colorDarkRed)));
//Plot(6, "", op, styleOwnScale| styleArea|styleNoLabel,-0.5,100);
Buy_p = p > btp OR m < bbm;
Buy_p1 =p > btp AND m < bbm;
Sell_m = m > btm OR p < bbp;
Sell_m1 = m > btm AND p < bbp;
//SetChartBkGradientFill( ParamColor("BgTop", colorBrightGreen),ParamColor("BgBottom", colorSeaGreen));
//Plot(5, "", Buy_sell, styleOwnScale| styleArea|styleNoLabel,-0.5,100);
//Plot(Close,"close",bs,styleCandle|styleNoLabel,styleThick);
Loy = IIf(O>klo,colorBrightGreen,IIf(O<url,colorRed,IIf(Buy_p AND Sell_m,colorWhite,IIf(Buy_p,colorBlue,IIf(Sell_m,colorPink,colorBlack)))));

//Plot(5, "", Bop, styleOwnScale| styleArea|styleNoLabel,-0.5,100);

SS_hrd();
HaClose =EMA((O+H+L+L+C)/5,3);
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose,"" , Loy, styleCandle| styleNoLabel );
//PlotOHLC( HaOpen, HaHigh, HaLow, HaClose,"" , Loy, styleBar| styleNoLabel );
//Plot(C,"",Loy,styleCandle+styleThick| styleNoLabel);
_SECTION_END();

SetChartBkColor(ColorHSB(140,190,135));


Col_cci = IIf(CCI(8) > 5, colorBrightGreen,IIf(CCI(8) <-5,colorRed,IIf(CCI(8) > Ref(CCI(8),-1),colorBlue,colorDarkRed)));
//Plot(Close,"Price",Col_cci, styleCandle+styleThick| styleNoLabel);
//Plot(Close,"Price",colorWhite, styleCandle| styleNoLabel);



_SECTION_END();

_SECTION_BEGIN("y450");

SS_hrd();

umkro = SS_E1();
jldop = SS_E2();
pot=(gorn+(umkro*0.0038));
sot=( kep-(umkro*0.0038));
yoi=(gorn+(umkro*0.0055));
iok=( kep-(umkro*0.0055));
SS_hrd();
kep=SS_C1();
gorn=SS_C2();
messageboard = ParamToggle("","",0);
exitlong = gorn;

exitshort = kep;



BT1 = SS_BT1();
BT2 = SS_BT2();
BT3 = SS_BT3();
BT4 = SS_BT4();

ST1 = SS_ST1();
ST2 = SS_ST2();
ST3 = SS_ST3();
ST4 = SS_ST4();


for(i=BarCount-1;i>1;i--)
{
if( kep == 1)
{
BT11 = BT1;
BT22 = BT2;
BT33 = BT3;
BT44 = BT4;
entry = url;
sig = "kep";

tar1 = BT11;
tar2 = BT22;
tar3 = BT33;
tar4 = BT44;

bars = i;
i = 0;
}
if(gorn == 1)
{
sig = "gorn";


ST11 = ST1;
ST22 = ST2;
ST33 = ST3;
ST44 = ST4;
entry = klo;

tar1 = ST11;
tar2 = ST22;
tar3 = ST33;
tar4 = ST44;

bars = i;
i = 0;
}
}
Offset = 20;
Clr = IIf(sig == "kep",colorDarkBlue,colorDarkRed);


Plot(LineArray(bars-Offset, tar1, BarCount, tar1,1), "", Clr, styleLine, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar2, BarCount, tar2,1), "", Clr, styleLine, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar3, BarCount, tar3,1), "", Clr, styleLine, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar4, BarCount, tar4,1), "", Clr, styleLine, Null, Null, Offset);

for (i=bars; i <BarCount;i++)
{
//PlotText("REC"+" "+entry, BarCount+1,entry,Null,colorBlue);
PlotText("T 1 ",BarCount+4,tar1,Null,Clr);
PlotText("T 2 ",BarCount+4,tar2,Null,Clr);
PlotText("LT1 ",BarCount+4,tar3,Null,Clr);
PlotText("LT2 ",BarCount+4,tar4,Null,Clr);

}



printf("Last " + sig + " Signal came " + (BarCount-bars) + " bars ago");
printf("\n" + sig + " @ : " + entry + "\nStop Loss : " + " (" + WriteVal(IIf(sig == "gorn",entry-C,C-entry), 2.2) + ")"+ "\nTarget_1 : " + tar1 + "\nTarget_2 : " + tar2 + "\nTarget_3 : " + tar3);
printf("\nCurrent P/L : " + WriteVal(IIf(sig == " kep",(C-entry),(entry-C)),2.2));




_SECTION_BEGIN("380");
breakout = ParamToggle(" ","no|yes ",1);

SS_lot();
SS_lot1();
SS_blt();
SS_blt1();

Asd=IIf(breakout,SS_lot1(),SS_blt1());
Lkj=IIf(breakout,SS_lot(),SS_blt());




_SECTION_END();
_SECTION_BEGIN("550");

TimeFrameSet(60*in1Minute);
//SS_Z1

ul = SS_Z1();

TimeFrameRestore(); // restore time frame to original

jml=TimeFrameExpand(ul , 60*in1Minute);

//downtrendf=TimeFrameExpand( downtrend, 15*in1Minute);

Colorf=TimeFrameExpand (colorGold, 60*in1Minute);

Plot( 2, "zone",IIf(O>jml,colorBlue,colorRed),styleOwnScale|styleArea|styleNoLabel,1, 100,1);








//Plot( Volume, _DEFAULT_NAME(), ParamColor("Color", colorPaleBlue ), ParamStyle( "Style",styleArea | styleNoLabel , styleOwnScale ), 30);








_SECTION_BEGIN("oip");
TimeFrameSet( inDaily ); // switch now to dayily

Oo=SS_BB1();
so=SS_BB2();
Ok=SS_BB3();
TimeFrameRestore(); // restore time frame to original


OIp=(Oo+so+Ok)/3;

Plot( TimeFrameExpand( OIp, inDaily),"powerline", colorYellow,1+55+1| styleNoLabel);



_SECTION_BEGIN("Volume");

cx = Param("cxposn",1065,0,1600,1);
cy = Param("cyposn", 10,0,1600,10 );

GfxSelectFont( " Arial ", 10, 98, False );
GfxSetTextColor( colorBrightGreen );

GfxTextOut("Volume : " +Volume+ "", cx +20,cy +50);


Plot( SS_mo3(), "megic 1 ", colorWhite, styleStaircase |styleThick|styleNoLabel);


_SECTION_END( );









_SECTION_BEGIN("pdi");
kmir = SS_Z2();
kdir = SS_Z3();

yy=Cross(jldop,kmir);
tt=Cross(kdir,jldop);

shape = (yy * shapeHollowSmallSquare + tt * shapeHollowSmallSquare);

dist = 2.5*ATR(10);

for( i = 0; i < BarCount; i++ )
{

if( yy ) PlotText("J\n" , i, L[ i ]-dist, colorWhite,colorGreen );
if( tt ) PlotText( "J\n" , i, H[ i ]+dist, colorWhite, colorDarkRed );
}



Ol = SS_Z4();
Ol1 = SS_Z5();

bomr=Cross(jldop,Ol);
fymo=Cross(Ol1,jldop);

PlotShapes(shapeStar*bomr,colorWhite,0,O,-20);
PlotShapes(shapeStar*fymo,colorBlack,0,O,20);

ejo=Cross(jldop,tar2);
Osj=Cross(tar2,jldop);

PlotShapes(shapeHollowStar*ejo,colorDarkBlue,0,L,-20);
PlotShapes(shapeHollowStar*Osj,colorViolet,0,H,20);

dist = 2.3*ATR(20);

for( i = 0; i < BarCount; i++ )
{

if( ejo ) PlotText("p\n" , i, L[ i ]-dist,colorLightYellow, colorBlue );
if( Osj ) PlotText( "p\n" , i, H[ i ]+dist, colorLightYellow,colorViolet );
}

_SECTION_END();
_SECTION_BEGIN("15");
see=(O+H+L)/3;
nhop= SS_SW1();

Impulse_UP= Cross( see,nhop ) AND Cross( see,nhop ) ;
Impulse_Down=Cross( nhop , see ) AND Cross( nhop,see );


shapeUpArrow = Param("Buy Shape Typ",59,1,60,1);
shapeDownArrow = Param("Sell Shape Typ",60,1,60,1);


dist = 2.5*ATR(10);

for( i = 0; i < BarCount; i++ )
{

if( Impulse_UP ) PlotText( "SE\n" , i, L[ i ]-dist, colorWhite,colorDarkBlue );
if( Impulse_Down ) PlotText( "BE\n" , i, H[ i ]+dist, colorWhite, colorRed );
}
_SECTION_BEGIN("asrt");
Shadowcolor1 = ParamColor("Shadow1",ColorRGB(7,72,86));
PlotOHLC( 0, asd ,Lkj , Lkj , "", IIf(asd > Lkj ,Shadowcolor1,ColorRGB(7,72,86)), styleCloud | styleNoLabel);
_SECTION_END( );
_SECTION_BEGIN("aslo");

a15 = SS_a11();
a14 = SS_a2();

S14 = SS_a3();
S15 = SS_a4();

Shadowcolor = ParamColor("Shadow",ColorRGB(67,39,67));

Shadowcolor2 = ParamColor("Shadow2",ColorRGB(36,53,113));

style = styleDots | styleThick + styleNoRescale ;
rcolor = colorWhite;
scolor = colorGreen;

PlotOHLC(0 , a15 , a14 , a14 , "", IIf(a15 > a14 ,Shadowcolor,ColorRGB(67,39,67)),styleCloud| styleNoLabel);
PlotOHLC( 0, s15 , s14 , s14 , "", IIf(S15 > S14 ,Shadowcolor2,ColorRGB(36,53,113)), styleCloud | styleNoLabel);

_SECTION_END( );

_SECTION_BEGIN("lei");

if (messageboard == 0 )
{
GfxSelectFont( "Tahoma", 10, 100 );
//GfxSetBkMode( 0 );
GfxSetTextColor( colorWhite );

if ( sig ==" kep")
{
GfxSelectSolidBrush( colorBlue );
}
else
{
GfxSelectSolidBrush( colorRed );
}
pxHeight = Status( "pxchartheight" ) ;
xx = Status( "pxchartwidth");
Left = 1100;
width = 310;
x = 3;
x2 = 210;

y = pxHeight;

GfxSelectPen( colorWhite, 4);
GfxRoundRect( x, y - 88, x2, y -1, 25, 150 ) ;
GfxTextOut( ( "* STOCKXRAY MAGIC * "),101,y-85);
GfxSetTextColor(ColorHSB(125,180,300));
GfxTextOut( (" STOP LOSS : " + WriteVal(IIf(sig == " kep",(umkro-yoi),(umkro-iok)),2.1)), 95, y-20);;
GfxTextOut( (" SECURED SL # REVERSE TREND "), 105, y-35);
GfxSetTextColor( colorWhite );
//GfxTextOut( " "+Now(2), 250, y-35);
GfxSetTextColor( colorYellow );
GfxSetTextColor( colorBrightGreen );
GfxTextOut( ("CURRENT P/L : " + WriteVal(IIf(sig == " kep",(C-entry),(entry-C)),2.1)), 90, y-70);
GfxSelectFont("Tahomabold", 9.4, 100 );
GfxSetTextColor(ColorHSB(30,4,250));
GfxTextOut( ("BEST OPPORTUNITY * " + WriteVal(IIf(sig == " kep",(umkro-pot),(umkro-sot)),2.1)), 103, y-52);;
GfxSetTextColor(ColorRGB(10,250,250));
GfxTextOut( ( " Develop By "),1150,y-45);
GfxSetTextColor(ColorRGB(10,250,250));
GfxTextOut( ( "* STOCKXRAY SYSTEM * "),1150,y-25);
GfxSelectFont("Tahomabold",13,1,100 );

}


_SECTION_END( );


_SECTION_BEGIN("ikpr");

x=Param("xposn",434,0,2000,1);
y=Param("yposn",717,0,2000,1);

for(i=BarCount-1;i>1;i--)
{
if(Impulse_UP == 1)
{
result1 = "Impulse_UP";
bars = i;
i = 0;
}
if(Impulse_Down == 1)
{
result1 = "Impulse_Down";
bars = i;
i = 0;
}
}

GfxSelectFont( "Arial", 10, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorBlue );
GfxSelectPen( colorGold, 3 );
if ( result1 == "Impulse_UP" )
{
GfxSelectSolidBrush( ColorRGB(0,0,240) );
}
else{
GfxSelectSolidBrush( ColorRGB(255,0,0) );
}



GfxCircle( x-301,y-550,13 );


kmirr = SS_kmirr();
fdop=Cross(jldop,kmirr);
eopt=Cross(kmirr,jldop);
dist = 2.5*ATR(10);

for( i = 0; i < BarCount; i++ )
{

if( fdop ) PlotText("J\n" , i, L[ i ]-dist, colorWhite,colorGreen );
if( eopt ) PlotText( "J\n" , i, H[ i ]+dist, colorWhite, colorDarkRed );
}

for(i=BarCount-1;i>1;i--)
{
if(fdop == 1)
{
result6 = "fdop";
bars = i;
i = 0;
}
if(tt == 1)
{
result6 = "eopt";
bars = i;
i = 0;
}
}

GfxSelectFont( "Arial", 10, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorBlue );
GfxSelectPen( colorGold, 3 );
if ( result6 == "fdop" )
{
GfxSelectSolidBrush( ColorRGB(0,0,240) );
}
else{
GfxSelectSolidBrush( ColorRGB(255,0,0) );
}

GfxCircle( x-230,y-550,13 );

for(i=BarCount-1;i>1;i--)
{
if(yy == 1)
{
result6 = "yy";
bars = i;
i = 0;
}
if(tt == 1)
{
result6 = "tt";
bars = i;
i = 0;
}
}

GfxSelectFont( "Arial", 10, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorBlue );
GfxSelectPen( colorGold, 3 );
if ( result6 == "yy" )
{
GfxSelectSolidBrush( ColorRGB(0,0,240) );
}
else{
GfxSelectSolidBrush( ColorRGB(255,0,0) );
}



GfxCircle( x-265,y-550,13 );



gmod = Cross(O,jml);
nkjr = Cross(jml,O);
for(i=BarCount-1;i>1;i--)
{
if(gmod == 1)
{
result3 = "gmod ";
bars = i;
i = 0;
}
if(nkjr == 1)
{
result3 = "nkjr";
bars = i;
i = 0;
}
}

GfxSelectFont( "Arial", 10, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorBlue );
GfxSelectPen( colorGold, 3 );
if ( result3 == "gmod " )
{
GfxSelectSolidBrush( ColorRGB(0,0,240) );
}
else{
GfxSelectSolidBrush( ColorRGB(255,0,0) );
}



GfxCircle( x-410,y-550,13 );

uoed = jmot>0;
dotp = jmot<0;

for(i=BarCount-1;i>1;i--)
{
if(uoed == 1)
{
result = "uoed";
bars = i;
i = 0;
}
if(dotp == 1)
{
result = "dotp";
bars = i;
i = 0;
}
}

GfxSelectFont( "Arial", 10, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorBlue );
GfxSelectPen( colorGold, 3 );
if ( result == "uoed" )
{
GfxSelectSolidBrush( ColorRGB(0,0,240) );
}
else{
GfxSelectSolidBrush( ColorRGB(255,0,0) );
}
GfxCircle( x-338,y-550,13 );


for(i=BarCount-1;i>1;i--)
{
if(bomr == 1)
{
result4 = "bomr ";
bars = i;
i = 0;
}
if(fymo == 1)
{
result4 = "fymo";
bars = i;
i = 0;
}
}

GfxSelectFont( "Arial", 40, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorBlue );
GfxSelectPen( colorGold, 3 );
if ( result4 == "bomr " )
{
GfxSelectSolidBrush( ColorRGB(0,0,240) );
}
else{
GfxSelectSolidBrush( ColorRGB(255,0,0) );
}


GfxCircle(x-375,y-550,13 );

_SECTION_END();
 

amitrandive

Well-Known Member
dear all
can any one correct this afl pls



_SECTION_BEGIN("ooa");

GfxSetBkMode(1);
jmot=SS_jmot();
Graph0=jmot;
Graph0BarColor=IIf(jmot>0,5,4);


_SECTION_BEGIN("hmw");

GfxSelectFont("tohomabold", Status("pxheight")/16);

}
.
.


GfxCircle(x-375,y-550,13 );

_SECTION_END();
AFL needs dll file to run.

A sincere request to all to use code tags for pasting codes.
 

extremist

Well-Known Member
Hello ,

i had these formulas since long [ Angel / Slope ]

//----1-----
EMA34 = EMA(C,34);
PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
x1_EMA34 = 0;
x2_EMA34 = 2;
y1_EMA34 = 0;
y2_EMA34 = (Ref(EMA34, -2) - EMA34) / Avg * range;
c_EMA34 = sqrt((x2_EMA34 - x1_EMA34)*(x2_EMA34 - x1_EMA34) + (y2_EMA34 - y1_EMA34)*(y2_EMA34 - y1_EMA34));
angle_EMA34 = round(180 * acos((x2_EMA34 - x1_EMA34)/c_EMA34) / PI);
TitleAngleEMA34 = EncodeColor(colorWhite) + "\nEMA34 angle = ";
angle_EMA34 = IIf(y2_EMA34 > 0, - angle_EMA34, angle_EMA34);
if(abs(SelectedValue(angle_EMA34)) >= 25)
{
TitleAngleEMA34 = TitleAngleEMA34 + EncodeColor(colorLime);
}
else if(abs(SelectedValue(angle_EMA34)) >= 15)
{
TitleAngleEMA34 = TitleAngleEMA34 + EncodeColor(colorYellow);
}
else
{
TitleAngleEMA34 = TitleAngleEMA34 + EncodeColor(colorRed);
}
TitleAngleEMA34 = TitleAngleEMA34 + angle_EMA34;

Color_ema_eangle= IIf(angle_ema34>=5,ParamColor("EMA34 trending up",colorTurquoise),IIf(angle_ema34<=-5,ParamColor("EMA34 trending down",colorRed),ParamColor("EMA34 not trending",colorYellow)));
Plot(EMA34,"EMA ",Color_ema_eangle, styleDashed| styleThick );
Title=TitleAngleEMA34;

//============================

//this is coded By T.J

Var = MA(C,14);
Plot( Var,"",9, 128);

START=34; // can use param and define Lookback periods
END= 1;
ARRAY= Var ;
L1=LastValue( Cum(1));
X0=L1-START;
X1=L1-END;
Y0=ARRAY[X0] ;
Y1=ARRAY[X1] ;
PixelFactor = Status("pxheight" )/Status( "pxwidth" );
XYFactor =
(Status("axismaxy" )-Status( "axisminy" ))/(Status( "lastvisiblebarindex")-Status("firstvisiblebarindex"));
FACTOR = PixelFactor / XYFactor;
ANGLE=atan(FACTOR* (Y1-Y0)/( X1-X0));
Color = IIf(Y1 > Y0,5,4); // Green = Positive Red = Negative
Title1="ANGLE= "+WriteVal( ANGLE)+" RADS"+",
["+WriteVal( 45*ANGLE/ atan(1),1.0)+" DEGS]";
Plot(ARRAY," ",12,1);
Plot(LineArray( X0,Y0,X1, Y1),Title1 + "\nLine to Last Value of End Point
Value",Color ,1);
Plot(LineArray( X0,Y0,X1, Y0),"Horizontal" ,2,1);
Plot(LastValue( Y0),"\nBegin at This point in the Array",10,1);

Hope you will find useful
Thank you
Why so complex Codes ?
And i Still suspect the outcomes of these codes.
We have inbuilt Slope code in Amibroker.
LinRegSlope( ARRAY, periods )

Only the difference here Is it gives Values in Radians.

If u want the value of Slope in Degrees then use the following formula.

Code:
MAp = Param("EMA Periods", 20, 2, 3000, 1 );
Lb = Param("Lookback Periods", 20, 2, 3000, 1 );

slp=LinRegSlope( eMA(C,MAp),LB);// Radians
slpD=slp*(180/3.1416); // Degrees

Plot( slpD, _DEFAULT_NAME(), ParamColor( "Color", colorblack ), ParamStyle("Style",styleline) ,0,0,0,1); 
Plot( 0,"",  colorGold,styleDashed );
 
AFL needs dll file to run.

A sincere request to all to use code tags for pasting codes.
Amitji,
I am new to Traderji.com
I am interested in Bank Nifty Intraday Trade only.
Please suggest me most useful AFL or AFLs for Bank Nifty Intraday Trade.
I know that no AFL is 100% accurate.
But as an experienced trader suggest me one most useful in your experience.
Thanking you
PriyaRamesh
 

ethan hunt

Well-Known Member
Amitji,
I am new to Traderji.com
I am interested in Bank Nifty Intraday Trade only.
Please suggest me most useful AFL or AFLs for Bank Nifty Intraday Trade.
I know that no AFL is 100% accurate.
But as an experienced trader suggest me one most useful in your experience.
Thanking you
PriyaRamesh
Yes, you are at correct place.
We will find out that holy grail for you. :thumb:
 

amitrandive

Well-Known Member
Amitji,
I am new to Traderji.com
I am interested in Bank Nifty Intraday Trade only.
Please suggest me most useful AFL or AFLs for Bank Nifty Intraday Trade.
I know that no AFL is 100% accurate.
But as an experienced trader suggest me one most useful in your experience.
Thanking you
PriyaRamesh
Priya

I appreciate that you know ,that no AFL works 100% all the time and in all markets.

Any AFL is based on a system and a set of rules.If you already have these rules defined,you should not need an AFL to trade.

Still you can search for 315 system AFL,and many such more in this forum.
Believe me when I say , that even if you get the best trading system in the world,without discipline , you will surely make losses.

Trading is not about getting the best AFL's, you need to understand a lot of things to be able to trade Intraday profitably.

Simple 20 EMA and support resistance system works wonders.
Yet many don't believe this system is profitable due to its simplicity.

15 min chart of BankNifty(Spot)


 

Similar threads