please edit this AFL

kumudhan

Well-Known Member
#1



code for chart1.

//Color
gradopt= ParamToggle( "Solid/gradient chart","Solid,Gradient", 1);
Colorsolid= ParamColor("Solid/axis background",colorLightGrey );//ColorRGB( 221, 221, 221 ) );
schemeopt= ParamToggle("Color scheme","No,Yes", 0);
scheme= ParamList("Schemes","Stockcharts" + "," +
"Sunset" + "," +
"Underwater" + "," +
"Streetlights" + "," +
"Desert" + "," +
"Fire and smoke" + "," +
"Smog from above" + "," +
"Smog from below" + "," +
"Overcast" + "," +
"Black on white", 1);

if ( gradopt )
{

colortop= ParamColor("Gradient top",ColorRGB( 255, 255, 210 ));
colorbottom= ParamColor("Gradient bottom",ColorRGB( 180, 180, 180 ) );

if ( schemeopt )
{
switch ( scheme )
{
case "Stockcharts":
Colortop= ColorRGB( 187, 212, 217 );
Colorbottom= ColorRGB( 250, 217, 173 );
break;

case "Sunset":
Colortop= ColorRGB( 135, 160, 210 );
Colorbottom= ColorRGB( 255, 255, 190 );
break;

case "Underwater":
Colortop= ColorRGB( 224, 217, 200 );
Colorbottom= ColorRGB( 106, 140, 202 );
break;

case "Streetlights":
//Colortop= ColorRGB( 180, 180, 180 );
Colortop= ColorRGB( 200, 200, 200 );
//Colorbottom= ColorRGB( 60, 60, 60 );
Colorbottom= ColorRGB( 80, 80, 80 );
break;

case "Desert":
Colortop= ColorRGB( 255, 255, 225 );
Colorbottom= ColorRGB( 200, 165, 115 );
break;

case "Fire and smoke":
Colortop= ColorRGB( 160, 160, 160 );
Colorbottom= ColorRGB( 255, 200, 145 );
break;

case "Smog from above":
Colortop= ColorRGB( 255, 255, 220 ); //ColorRGB( 170, 170, 170 );
Colorbottom= ColorRGB( 170, 170, 170 ); //ColorRGB( 255, 255, 220 );
break;

case "Smog from below":
Colortop= ColorRGB( 170, 170, 170 );
Colorbottom= ColorRGB( 255, 255, 220 );
break;

case "Overcast":
Colortop= ColorRGB( 180, 180, 180 );
Colorbottom= ColorRGB( 240, 240, 240 );
break;

case "Black on white":
Colortop= colorWhite;
Colorbottom= colorWhite;
Colorsolid= colorWhite;
colorDefault= colorBlack;
break;

default:
Colortop= ColorRGB( 185, 185, 185 );
Colorbottom= ColorRGB( 240, 240, 240 );
break;
}
}
SetChartBkGradientFill( Colortop, Colorbottom );
}

{
SetChartBkColor( Colorsolid );
}






















_SECTION_BEGIN("MA");
Len = IIf(Interval() > 300, 30, 60);
Disp = WriteIf(Interval() > 300, "MA30", "MA60");
Av = MA(C, Len);
ColorShow = IIf(Av > Ref(Av,-1) AND C > Av, colorGreen, IIf(Av < Ref(Av,-1) AND C < Av, colorRed, colorBlue));
Plot(Av, Disp, ColorShow ,styleLine+styleDots,styleThick,styleDots);
_SECTION_END();

ToolTip = "High = " + H + "\nOpen = " + O + "\nRange = " + (High-Low) +"\nTRUERange = " + (C-O) +"\nMID ="+((High+Low)/2)+ "\nClose = " + C + "\nLow = " + L;
_SECTION_BEGIN("BW Fractal");

UpFractal= ValueWhen(
(Ref(H,-2) > Ref(H, -4)) AND
(Ref(H,-2) > Ref(H, -3)) AND
(Ref(H,-2) > Ref(H, -1)) AND
(Ref(H,-2) > H), Ref(H,-2));

DownFractal= ValueWhen(
(Ref(L,-2) <= Ref(L, -4)) AND
(Ref(L,-2) <= Ref(L, -3)) AND
(Ref(L,-2) <= Ref(L, -1)) AND
(Ref(L,-2) <= L), Ref(L,-2));



//== Added Crash crashandburn59 [at] hotmail.com solution
Plot(Ref(UpFractal,2), "Up Fractal", ParamColor("Up Fractal Color",colorRed),
ParamStyle("Up Fractal Style", styleDashed));
Plot(Ref(DownFractal,2), "Down Fractal",ParamColor("Down Fractal
Color",colorBlue), ParamStyle("Down Fractal Style", styleDashed));

//Plot(Max(HHV(H,3),Ref(UpFractal,2)), "Up Fractal", ParamColor("Up Fractal Color",colorRed), ParamStyle("Up Fractal Style", styleDashed));
//Plot(Max(HHV(H,3),Ref(UpFractal,2)), "Down Fractal",ParamColor("Down FractalColor",colorBlue), ParamStyle("Down Fractal Style", styleDashed));

_SECTION_END();


Plot(C,"",colorWhite,styleCandle);
Res =
(H>Ref(H,-1) AND H>Ref(H,-2) AND H>Ref(H,1) AND H>Ref(H,2)) OR
(H>Ref(H,-1) AND H>Ref(H,-2) AND H==Ref(H,1) AND H>Ref(H,2) AND H>Ref(H,3)) OR
(H>Ref(H,-1) AND H>Ref(H,-2) AND H>Ref(H,1) AND H==Ref(H,2) AND H>Ref(H,3)) OR
(H>Ref(H,-1) AND H>Ref(H,-2) AND H==Ref(H,1) AND H==Ref(H,2) AND H>Ref(H,3) AND H>Ref(H,4)) OR
(H>Ref(H,-1) AND H>Ref(H,-2) AND H==Ref(H,1) AND H>Ref(H,2) AND H==Ref(H,3) AND H>Ref(H,4)) OR
(H>Ref(H,-1) AND H>Ref(H,-2) AND H>Ref(H,1) AND H==Ref(H,2) AND H==Ref(H,3) AND H>Ref(H,4));
Resistance = ValueWhen(Res,H,1);


Sup =
(L<Ref(L,-1) AND L<Ref(L,-2) AND L<Ref(L,1) AND L<Ref(L,2)) OR
(L<Ref(L,-1) AND L<Ref(L,-2) AND L==Ref(L,1) AND L<Ref(L,2) AND L<Ref(L,3)) OR
(L<Ref(L,-1) AND L<Ref(L,-2) AND L<Ref(L,1) AND L==Ref(L,2) AND L<Ref(L,3)) OR
(L<Ref(L,-1) AND L<Ref(L,-2) AND L==Ref(L,1) AND L==Ref(L,2) AND L<Ref(L,3) AND L<Ref(L,4)) OR
(L<Ref(L,-1) AND L<Ref(L,-2) AND L==Ref(L,1) AND L<Ref(L,2) AND L==Ref(L,3) AND L<Ref(L,4)) OR
(L<Ref(L,-1) AND L<Ref(L,-2) AND L<Ref(L,1) AND L==Ref(L,2) AND L==Ref(L,3) AND L<Ref(L,4));
Support = ValueWhen(Sup,L,1);

AlligatorMode = ParamToggle("Alligator Anatomy 101", "Book and Course|Software",1);
smooth=(H+L)/2;
smooth5=MA(smooth,5);
smooth34=MA(smooth,34);
AlligatorNose=MA(C,5);
AlligatorLips=IIf(AlligatorMode,Ref(EMA(smooth,9),-3),Ref(MA(smooth,5),-3));
AlligatorTeeth=IIf(AlligatorMode,Ref(EMA(smooth,15),-5),Ref(MA(smooth,8),-5));
AlligatorJaw=IIf(AlligatorMode,Ref(EMA(smooth,25),-8),Ref(MA(smooth,13),-8));
AlligatorColor=IIf(AlligatorLips > AlligatorJaw, colorDarkGreen, colorDarkRed);
Plot(AlligatorLips, "Lips", colorGreen,styleThick);
Plot(AlligatorTeeth,"Teeth", colorRed,styleThick);
Plot(AlligatorJaw, "Jaw", colorBlue,styleThick);

_SECTION_BEGIN("Title");
Title = "";
HoD = TimeFrameGetPrice("H",inDaily);
LoD = TimeFrameGetPrice("L",inDaily);
Rng = HoD - LoD;
Mid = LoD + Rng/2;

//Draw the Panel Box
GfxSelectPen( colorBlack,1 );

GfxMoveTo(2,2);
GfxLineTo(2,30);
GfxLineTo(1044,30);
GfxLineTo(1044,2);
GfxLineTo(2,2);
GfxMoveTo(140,2);
GfxLineTo(140,30);
GfxMoveTo(430,2);
GfxLineTo(430,30);
GfxMoveTo(530,2);
GfxLineTo(530,30);

GfxSelectFont("Comic Sans MS Bold", 9, 800);
GfxSetTextColor(colorBlack);
GfxDrawText(Name(), 10, 3, 77, 20,0);
GfxDrawText(NumToStr(Interval()/60,2.0) + " Min", 82, 3, 140, 20,0);
GfxSelectFont("Comic Sans MS Bold", 7, 800);
GfxDrawText(Date(), 10, 18, 140, 30,0);
GfxSelectFont("Comic Sans MS Bold", 10, 800);
GfxSetTextColor(colorBlue);
GfxDrawText(" HoD:" + NumToStr(HoD,3.0), 148, 7, 240, 30,0);
GfxSetTextColor(colorRed);
GfxDrawText(" LoD:" + NumToStr(LoD,3.0), 242, 7, 340, 30,0);
GfxSetTextColor(colorBlack);
GfxDrawText(" Mid:" + NumToStr(Mid,3.0), 342, 7, 500, 30,0);
GfxDrawText(" Range:" + NumToStr(Rng,3.0), 437, 7, 620, 30,0);
GfxDrawText("Open: " + NumToStr(O,3.0), 537, 7, 740, 30,0);
GfxSetTextColor(colorBlue);
GfxDrawText("Hi: " + NumToStr(H,3.0), 647, 7, 740, 30,0);
GfxSetTextColor(colorRed);
GfxDrawText("Lo: " + NumToStr(L,3.0), 740, 7, 860, 30,0);
GfxSetTextColor(colorBlack);
GfxDrawText("Close: " + NumToStr(C,3.0), 840, 7, 980, 30,0);
GfxSetTextColor(colorBlack);
GfxDrawText("Volume: " + NumToStr(V,3.0), 940, 7, 1080, 30,0);

_SECTION_END();


code for chart2.


//30 FOR OTHERS
//60 FOR BANKNIFTY
//Fractal up
fUp = (Ref(H,-2) > Ref(H, -4)) AND
(Ref(H,-2) > Ref(H, -3)) AND
(Ref(H,-2) > Ref(H, -1)) AND
(Ref(H,-2) > H);
var1=ValueWhen(fUp ,Ref(H,-2) ,1);
FractalUp=HighestSince(var1 > 0, var1, 1);
//Plot(FractalUp, "F+",ParamColor( "F+ Color", colorCycle ) , styleLine);






_SECTION_BEGIN("Basic Chart");
Plot(Close,"Price",colorWhite, styleCandle);
SetChartOptions(0,chartShowArrows|chartShowDates);
_SECTION_END();
_SECTION_BEGIN("Title");
Title = "";
HoD = TimeFrameGetPrice("H",inDaily);
LoD = TimeFrameGetPrice("L",inDaily);
Rng = HoD - LoD;
Mid = LoD + Rng/2;

//Draw the Panel Box
GfxSelectPen( colorBlack,1 );

GfxMoveTo(2,2);
GfxLineTo(2,30);
GfxLineTo(1044,30);
GfxLineTo(1044,2);
GfxLineTo(2,2);
GfxMoveTo(140,2);
GfxLineTo(140,30);
GfxMoveTo(430,2);
GfxLineTo(430,30);
GfxMoveTo(530,2);
GfxLineTo(530,30);

GfxSelectFont("Comic Sans MS Bold", 9, 800);
GfxSetTextColor(colorBlack);
GfxDrawText(Name(), 10, 3, 77, 20,0);
GfxDrawText(NumToStr(Interval()/60,2.0) + " Min", 82, 3, 140, 20,0);
GfxSelectFont("Comic Sans MS Bold", 7, 800);
GfxDrawText(Date(), 10, 18, 140, 30,0);
GfxSelectFont("Comic Sans MS Bold", 10, 800);
GfxSetTextColor(colorBlue);
GfxDrawText(" HoD:" + NumToStr(HoD,3.0), 148, 7, 240, 30,0);
GfxSetTextColor(colorRed);
GfxDrawText(" LoD:" + NumToStr(LoD,3.0), 242, 7, 340, 30,0);
GfxSetTextColor(colorBlack);
GfxDrawText(" Mid:" + NumToStr(Mid,3.0), 342, 7, 500, 30,0);
GfxDrawText(" Range:" + NumToStr(Rng,3.0), 437, 7, 620, 30,0);
GfxDrawText("Open: " + NumToStr(O,3.0), 537, 7, 740, 30,0);
GfxSetTextColor(colorBlue);
GfxDrawText("Hi: " + NumToStr(H,3.0), 647, 7, 740, 30,0);
GfxSetTextColor(colorRed);
GfxDrawText("Lo: " + NumToStr(L,3.0), 740, 7, 860, 30,0);
GfxSetTextColor(colorBlack);
GfxDrawText("Close: " + NumToStr(C,3.0), 840, 7, 980, 30,0);
GfxSetTextColor(colorBlack);
GfxDrawText("Volume: " + NumToStr(V,3.0), 940, 7, 1080, 30,0);

_SECTION_END();
_SECTION_BEGIN("Ini Dia AFL Candlestick");
Plot
(C,"",colorBlack,styleCandle);
r=CdDoji( threshold = 0.05 );
s=CdHammer( rangefactor= 1.1 );
t=CdBearishEngulfing( bodyfactor = 0.4, rangefactor = 0.5);
u=CdBullishEngulfing( bodyfactor = 0.4, rangefactor = 0.5);
PlotShapes
(r*shapeSmallCircle,colorRed,Layer=0,yposition=H,Offset=12);
PlotShapes
(s*shapeSmallCircle,colorBlack,Layer=0,yposition=H,Offset=12);
PlotShapes
(t*shapeHollowSmallCircle,colorLime,Layer=0,yposition=H,Offset=12);
PlotShapes
(u*shapeSmallCircle,colorBlue,Layer=0,yposition=H,Offset=12);
for
(i=0;i<BarCount-1;i++)
{
if(r==True)PlotText("D", i, H+20, colorRed, bkcolor = colorDefault);
if(s==True)PlotText("H", i, H+20, colorBlack, bkcolor = colorDefault);
if(t==True)PlotText("Be.E", i, H+20, colorLime, bkcolor = colorDefault);
if(u==True)PlotText("Bu.E", i, H+20, colorBlue, bkcolor = colorDefault);
}
_SECTION_END();
_SECTION_BEGIN("Volume1");
Plot( Volume, _DEFAULT_NAME(), ParamColor("Color", colorBlueGrey ), ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick, maskHistogram ), 2 );
_SECTION_END();
_SECTION_BEGIN("MA");
Len = IIf(Interval() > 300, 30, 60);
Disp = WriteIf(Interval() > 300, "MA30", "MA60");
Av = MA(C, Len);
ColorShow = IIf(Av > Ref(Av,-1) AND C > Av, colorGreen, IIf(Av < Ref(Av,-1) AND C < Av, colorRed, colorBlue));
Plot(Av, Disp, ColorShow ,styleLine+styleDots,styleThick,styleDots);
_SECTION_END();

ToolTip = "High = " + H + "\nOpen = " + O + "\nClose = " + C + "\nLow = " + L;

_SECTION_BEGIN("text");
GfxSetOverlayMode(1);
GfxSelectFont("Comic Sans MS Bold", Status("pxheight")/15 );
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( ColorRGB( 160, 160, 160 ) );
GfxSetTextColor( ColorHSB( 160, 0, 151 ) );

GfxSetBkMode(0); // transparent
GfxTextOut( "-DO WHAT THE SYSTEM SAYS-", Status("pxwidth")/2, Status("pxheight")/3 );
_SECTION_END();
_SECTION_BEGIN("CH");
Ch = Param("ch", 5,1,15,1);
bi = Cum(1)-1;
cbar = Param("cbar",2,2,50,1);
function GetTop(bars)
{
Top = H == HHV(H,2*bars) AND Ref(HHV(H,bars),bars) < H;
Top = Top AND LastValue(bi)-ValueWhen(Top,bi) > bars;
return Top;
}
function GetValley(bars)
{
Valley = L == LLV(L,2*bars) AND Ref(LLV(L,bars),bars) > L;
Valley = Valley AND LastValue(bi)-ValueWhen(Valley,bi) > bars;
return Valley;
}
P1 = GetTop(Ch);
V1 = GetValley(Ch);
P1 = IIf(P1,IIf(ValueWhen(P1,bi,2) < ValueWhen(V1,bi),P1,IIf(ValueWhen(P1,H,2) > H,False,P1)),P1);
P1 = IIf(P1 AND ValueWhen(P1,bi,0) > bi,IIf(ValueWhen(P1,bi,0) < ValueWhen(V1,bi,0),IIf(ValueWhen(P1,H,0) >= H,False,P1),P1),P1);
V1 = IIf(V1,IIf(ValueWhen(V1,bi,2) < ValueWhen(P1,bi),V1,IIf(ValueWhen(V1,L,2)<L,False, V1)),V1);
V1 = IIf(V1 AND ValueWhen(V1,bi,0) > bi ,IIf(ValueWhen(V1,bi,0) < ValueWhen(P1,bi,0),IIf(ValueWhen(V1,L,0) <= L, False,V1),V1),V1);
RF=ValueWhen(P1,H);
SF=ValueWhen(V1,L);
RF1 = IIf(RF AND BarsSince(P1) <=cbar,RF,Null);
SF1 = IIf(SF AND BarsSince(V1) <=cbar,SF,Null);
Plot(RF1,"",colorWhite,styleDots | styleNoLine);
Plot(SF1,"",colorWhite,styleDots | styleNoLine);
Plot(RF,"",colorViolet,40+16);
Plot(SF,"",colorViolet,40+16);
PlotShapes(IIf(P1, shapeSmallSquare,shapeNone),colorYellow,0,H,10);
PlotShapes(shapeSmallCircle*P1,colorBlack,0,H,10);
PlotShapes(IIf(V1, shapeSmallSquare,shapeNone),colorYellow,0,L,-10);
PlotShapes(shapeSmallCircle*V1,colorBlack,0,L,-10);
_SECTION_END();


now what i need is the words DO WHAT STSTEM SAYS to be shown in chart 1.tried many times but in vain.seniors pl help.thank you in advance..
 
#2
now what i need is the words do what ststem says to be shown in chart 1.tried many times but in vain.seniors pl help.thank you in advance..

yes this code will make the background black ...


:) Happy
 
Last edited:

kumudhan

Well-Known Member
#3
hello happy sir.thanks or your effort..but with your code look ff first chart changed overall.i need same as first chat and those words in centre of it.pl help.
 
#5
One of your AFls is using this . . .

Code:
GfxSetOverlayMode(1);
GfxSelectFont("Comic Sans MS Bold", Status("pxheight")/15 );
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( ColorRGB( 160, 160, 160 ) );
GfxSetTextColor( ColorHSB( 160, 0, 151 ) );

GfxSetBkMode(0); // transparent
GfxTextOut( "-DO ONLY WHAT THE SYSTEM SAYS-", Status("pxwidth")/2, Status("pxheight")/3 );
Please try the above one again and let me know . . .

happy
 
#7
Hey Kumudhan

just hold on for 10-15 mins will give it another try . . .

but maybe its not working because you keep addressing me as sir :)

only Happy is fine ;)

Cheers

:) Happy

There is a clash between these 2 lines in your code . . .

Code:
SetChartBkGradientFill( Colortop, Colorbottom );
the above gives you the look and feel that you do not want to scarifice so comment out this line in the code block with the message . . .


Code:
//GfxSetOverlayMode(1);

or just paste this at end of your first afl

Code:
//GfxSetOverlayMode(1);
GfxSelectFont("Comic Sans MS Bold", Status("pxheight")/15 );
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( ColorRGB( 160, 160, 160 ) );
GfxSetTextColor( ColorHSB( 160, 0, 151 ) );

GfxSetBkMode(0); // transparent
GfxTextOut( "-DO ONLY WHAT THE SYSTEM SAYS-", Status("pxwidth")/2, Status("pxheight")/3 );
 
Last edited:
#9
still needs some tinkering happy....
As i wrote in above msg, paste the code for message at the extreme end . . .

the only other option was changing the back ground . . . which you do not prefer

if the words go behind the candle they also go behind the back ground

the code for title bar has to be before the message code . . . seems you have not done it . . .


btw what is the version for you amibroker?

:) Happy
 

Similar threads

Broker Special Offers

Intraday Higher Leverage

Save up to 90% in brokerage and get higher leverage for intraday trades.

Name:Phone:
Email:City:
State:
Are you a day trader?