Fly candle afl

#2
dear friends

can anybody share fly candle afl, i put screenshot here

_SECTION_BEGIN("Price");

SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0, 0)));
//SetTradeDelays(1,1,1,1);
SetPositionSize(100,spsShares);
_SECTION_END();

NDays=Param("Number of Days",10,1,50,1);
DayC=TimeFrameGetPrice("C",inDaily,-1);
NDaysDHLAvg=0;
for(i=1;i<=NDays;i++)
{
DayH=TimeFrameGetPrice("H",inDaily,-i);
DayL=TimeFrameGetPrice("L",inDaily,-i);
NDaysDHLAvg=NDaysDHLAvg+(DayH-DayL);
}
NDaysDHLAvg=NDaysDHLAvg/NDays;

ADM= NDaysDHLAvg; // Average Day Moment

// Dynamic Levels//----------Majer Support Resistent Zones---------------------------------------------------

DayH = TimeFrameGetPrice("H", inDaily, -1); DayHI = LastValue (DayH,1); // yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1); DayLI = LastValue (DayL,1); // yesterdays low
DayC = TimeFrameGetPrice("C", inDaily, -1); DayCI = LastValue (DayC,1); // yesterdays close
DayO = TimeFrameGetPrice("O", inDaily); DayOI = LastValue (DayO,1); // current day open
WeekH= TimeFrameGetPrice("H", inWeekly, 0); WeekHI = LastValue (WeekH,1); // This Week high
WeekL= TimeFrameGetPrice("L", inWeekly, 0); WeekLI = LastValue (WeekL,1); // This Week low
MonthH= TimeFrameGetPrice("H", inMonthly, 0); MonthHI = LastValue (MonthH,1); // This Month high
MonthL= TimeFrameGetPrice("L", inMonthly, 0); MonthLI = LastValue (MonthL,1); // This Month low
LWeekH= TimeFrameGetPrice("H", inWeekly, -1); LWeekHI = LastValue (LWeekH,1); // One Week before high
LWeekL= TimeFrameGetPrice("L", inWeekly, -1); LWeekLI = LastValue (LWeekL,1); // One Week before low
LMonthH= TimeFrameGetPrice("H", inMonthly, -1); LMonthHI = LastValue (LMonthH,1); // One Month before high
LMonthL= TimeFrameGetPrice("L", inMonthly, -1); LMonthLI = LastValue (LMonthL,1); // One Month before low
L1WeekH= TimeFrameGetPrice("H", inWeekly, -2); L1WeekHI = LastValue (L1WeekH,1); // Two Week before high
L1WeekL= TimeFrameGetPrice("L", inWeekly, -2); L1WeekLI = LastValue (L1WeekL,1); // Two Week before low
L1MonthH= TimeFrameGetPrice("H", inMonthly, -2); L1MonthHI = LastValue (L1MonthH,1); // Two Month before high
L1MonthL= TimeFrameGetPrice("L", inMonthly, -2); L1MonthLI = LastValue (L1MonthL,1); // Two Month before low
L2WeekH= TimeFrameGetPrice("H", inWeekly, -3); L2WeekHI = LastValue (L2WeekH,1); // Three Week before high
L2WeekL= TimeFrameGetPrice("L", inWeekly, -3); L2WeekLI = LastValue (L2WeekL,1); // Three Week before low
L2MonthH= TimeFrameGetPrice("H", inMonthly, -3); L2MonthHI = LastValue (L2MonthH,1); // Three Month before high
L2MonthL= TimeFrameGetPrice("L", inMonthly, -3); L2MonthLI = LastValue (L2MonthL,1); // Three Month before low
L3MonthH= TimeFrameGetPrice("H", inMonthly, -4); L3MonthHI = LastValue (L3MonthH,1); // Four Month before high
L3MonthL= TimeFrameGetPrice("L", inMonthly, -4); L3MonthLI = LastValue (L3MonthL,1); // Four Month before low
L4MonthH= TimeFrameGetPrice("H", inMonthly, -5); L4MonthHI = LastValue (L4MonthH,1); // Five Month before high
L4MonthL= TimeFrameGetPrice("L", inMonthly, -5); L4MonthLI = LastValue (L4MonthL,1); // Five Month before low
L3WeekH= TimeFrameGetPrice("H", inWeekly, -4); L3WeekHI = LastValue (L3WeekH,1); // Four Week before high
L3WeekL= TimeFrameGetPrice("L", inWeekly, -4); L3WeekLI = LastValue (L3WeekL,1); // Four Week before low
//----------------------------------------------------------------------------------------------------------------------


Buy= C>((DayC)+((.382)*(ADM)));
Sell= C<((DayC)-((.382)*(ADM)));

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

Short=Sell;
Cover=Buy;

BuyPrice=ValueWhen(Buy,C);
SellPrice=ValueWhen(Sell,C);
ShortPrice=ValueWhen(Short,C);
CoverPrice=ValueWhen(Cover,C);

BuyTarget1= (0.45*ADM)+BuyPrice;
BuyTarget2= (0.95*ADM)+BuyPrice;
BuyTarget3= (1.95*ADM)+BuyPrice;
SellTarget1= SellPrice-(0.45*ADM);
SellTarget2= SellPrice-(0.95*ADM);
SellTarget3= SellPrice-(1.95*ADM);

//------------------------------------------------------------------------------------------------

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);

Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy);

BuyPrice=ValueWhen(Buy,C);
SellPrice=ValueWhen(Sell,C);

Bdc=(
WriteIf (Buy AND Ref(shrt,-1), " BUY@ "+C+" ","")+
WriteIf(Buy , "LastTrade Profit="+(SellPrice-C)+"","")
);

Sdc=(
WriteIf (Sell AND Ref(Long,-1), " SEll@ "+C+" ","")+
WriteIf(Sell , "LastTrade Profit="+(C-BuyPrice)+"","")
);

Ndc=(
WriteIf(Long AND NOT Buy, "Long@"+WriteVal((BuyPrice))+" /Profit="+WriteVal((C-BuyPrice))+"","")+
WriteIf(Shrt AND NOT Sell, "Short@"+WriteVal((SellPrice))+" /Profit="+WriteVal((SellPrice-C))+"","")
);

BTdc=(
WriteIf(Long AND NOT Buy, "Target1(1/2ADM)"+WriteVal((BuyTarget1))+
"::\nTarget2(One ADM)"+WriteVal((BuyTarget2))+
"::\nTarget3(Two ADM)"+WriteVal((BuyTarget3))+"","")
);

STdc=(
WriteIf(Shrt AND NOT Sell, "Target1(1/2ADM)"+WriteVal((SellTarget1))+
"::\nTarget2(One ADM)"+WriteVal((SellTarget2))+
"::\nTarget3(Two ADM)"+WriteVal((SellTarget3))+"","")
);

_SECTION_END();

trendup = IIf(C>((DayC)+((.382)*(ADM))), colorBlue, colorWhite);
trendcolor = IIf(C<((DayC)-((.382)*(ADM))), colorRed, trendup);
Plot( C, "Close", trendcolor, styleCandle | styleThick );

numbars = LastValue(Cum(Status("barvisible")));
hts = -33.5;

// Volatility Levels //
DC = DayC; DCI = LastValue (DC,1); // Yesterday Close
BY = ((DayC)+((.382)*(ADM))); BYI = LastValue (BY,1); // Buy Entry Line
BT1 = ((DayC)+((.618)*(ADM))); BT1I = LastValue (BT1,1); // Buy Target Line 1
BT2 = ((DayC)+((.786)*(ADM))); BT2I = LastValue (BT2,1); // Buy Target Line 2
BT3 = ((DayC)+(ADM)); BT3I = LastValue (BT3,1); // Buy Target Line 3
SH = ((DayC)-((.382)*(ADM))); SHI = LastValue (SH,1); // Sell Entry Line
ST1 = ((DayC)-((.618)*(ADM))); ST1I = LastValue (ST1,1); // Sell Target Line 1
ST2 = ((DayC)-((.786)*(ADM))); ST2I = LastValue (ST2,1); // Sell Target Line 2
ST3 = ((DayC)-(ADM)); ST3I = LastValue (ST3,1); // Sell Target Line 3

vvl = ParamToggle("Intraday Target Levels","Hide|Show",0);
if(vvl==1) {
Plot(DC, "DC",colorWhite,styleDots|styleLine|styleNoRescale|styleNoTitle);
Plot(BY, "BY",colorLime,styleDots|styleLine|styleNoRescale|styleNoTitle);
Plot(BT1, "BT1",colorGreen,styleDots|styleLine|styleNoRescale|styleNoTitle);
Plot(BT2, "BT2",colorGreen,styleDots|styleLine|styleNoRescale|styleNoTitle);
Plot(BT3, "BT3",colorGreen,styleDots|styleLine|styleNoRescale|styleNoTitle);
Plot(SH, "SH",colorRed,styleDots|styleLine|styleNoRescale|styleNoTitle);
Plot(ST1, "ST1",colorBrown,styleDots|styleLine|styleNoRescale|styleNoTitle);
Plot(ST2, "ST2",colorBrown,styleDots|styleLine|styleNoRescale|styleNoTitle);
Plot(ST3, "ST3",colorBrown,styleDots|styleLine|styleNoRescale|styleNoTitle);

PlotText(" DC ", LastValue(BarIndex())-(numbars/Hts), DCI, colorDarkGrey);
PlotText(" Buy " , LastValue(BarIndex())-(numbars/Hts), BYI, colorLime);
PlotText(" Target1 " , LastValue(BarIndex())-(numbars/Hts), BT1I, colorGreen);
PlotText(" Target2 " , LastValue(BarIndex())-(numbars/Hts), BT2I, colorGreen);
PlotText(" Target3 " , LastValue(BarIndex())-(numbars/Hts), BT3I, colorGreen);
PlotText(" Sell " , LastValue(BarIndex())-(numbars/Hts), SHI, colorRed);
PlotText(" Target1 " , LastValue(BarIndex())-(numbars/Hts), ST1I, colorBrown);
PlotText(" Target2 " , LastValue(BarIndex())-(numbars/Hts), ST2I, colorBrown);
PlotText(" Target3 " , LastValue(BarIndex())-(numbars/Hts), ST3I, colorBrown);
}

mmwwl = ParamToggle(" MOnthly, Weekly Levels","Hide|Show",1);
if(mmwwl==1) {
Plot(DayH, "PDH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(WeekH, "CWH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(LWeekH, "LWH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(L1WeekH, "2WH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(L2WeekH, "3WH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(L3WeekH, "4WH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(MonthH, "CMH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(LMonthH, "LMH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(L1MonthH, "2MH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(L2MonthH, "3MH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(L3MonthH, "4MH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(L4MonthH, "5MH",colorBlue,styleLine|styleNoRescale|styleNoTitle);

Plot(DayL, "PDL",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(WeekL, "CWL",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(LWeekL, "LWL",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(L1WeekL, "2WL",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(L2WeekL, "3WL",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(L3WeekL, "4WL",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(MonthL, "CML",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(LMonthL, "LML",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(L1MonthL, "2ML",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(L2MonthL, "3ML",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(L3MonthL, "4ML",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(L4MonthL, "5ML",colorViolet,styleLine|styleNoRescale|styleNoTitle);

PlotText(" PDH ", LastValue(BarIndex())-(numbars/Hts), DayHI, colorBlue);
PlotText(" CWH " , LastValue(BarIndex())-(numbars/Hts), WeekHI, colorBlue);
PlotText(" LWH " , LastValue(BarIndex())-(numbars/Hts), LWeekHI, colorBlue);
PlotText(" 2WH " , LastValue(BarIndex())-(numbars/Hts), L1WeekHI, colorBlue);
PlotText(" 3WH " , LastValue(BarIndex())-(numbars/Hts), L2WeekHI, colorBlue);
PlotText(" 4WH " , LastValue(BarIndex())-(numbars/Hts), L3WeekHI, colorBlue);
PlotText(" CMH " , LastValue(BarIndex())-(numbars/Hts), MonthHI, colorBlue);
PlotText(" LMH " , LastValue(BarIndex())-(numbars/Hts), LMonthHI, colorBlue);
PlotText(" 2MH " , LastValue(BarIndex())-(numbars/Hts), L1MonthHI, colorBlue);
PlotText(" 3MH ", LastValue(BarIndex())-(numbars/Hts), L2MonthHI, colorBlue);
PlotText(" 4MH " , LastValue(BarIndex())-(numbars/Hts), L3MonthHI, colorBlue);
PlotText(" 5MH " , LastValue(BarIndex())-(numbars/Hts), L4MonthHI, colorBlue);

PlotText(" PDL " , LastValue(BarIndex())-(numbars/Hts), DayLI, colorViolet);
PlotText(" CWL " , LastValue(BarIndex())-(numbars/Hts), WeekLI, colorViolet);
PlotText(" LWL " , LastValue(BarIndex())-(numbars/Hts), LWeekLI, colorViolet);
PlotText(" 2WL " , LastValue(BarIndex())-(numbars/Hts), L1WeekLI, colorViolet);
PlotText(" 3WL " , LastValue(BarIndex())-(numbars/Hts), L2WeekLI, colorViolet);
PlotText(" 4WL " , LastValue(BarIndex())-(numbars/Hts), L3WeekLI, colorViolet);
PlotText(" CML " , LastValue(BarIndex())-(numbars/Hts), MonthLI, colorViolet);
PlotText(" LML " , LastValue(BarIndex())-(numbars/Hts), LMonthLI, colorViolet);
PlotText(" 2ML " , LastValue(BarIndex())-(numbars/Hts), L1MonthLI, colorViolet);
PlotText(" 3ML ", LastValue(BarIndex())-(numbars/Hts), L2MonthLI, colorViolet);
PlotText(" 4ML " , LastValue(BarIndex())-(numbars/Hts), L3MonthLI, colorViolet);
PlotText(" 5ML " , LastValue(BarIndex())-(numbars/Hts), L4MonthLI, colorViolet);

}

_SECTION_BEGIN("Background text");
C11=ParamColor("up panel",colorBlack );
C12=ParamColor("dn panel",colorBlack );
C13=Param("fonts",20,10,30,1 );
C14=Param("left-right",2.1,1.0,5.0,0.1 );
C15=Param("up-down",8,1,30,1 );
Miny = Status("axisminy");
Maxy = Status("axismaxy");
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
pxwidth = Status("pxwidth");
pxheight = Status("pxheight");
GfxSetBkMode( 0 );
GfxSelectFont("Tahoma", 12, 500, False, False, 0);
GfxSetTextColor(colorCustom12);
GfxSetTextAlign( 6 );
GfxTextOut( "ADM (Average Day Moment) "+WriteVal(ADM,1.2), Status("pxwidth")/C14, Status("pxheight")/C15*1.5);
GfxSelectFont("Tahoma", 15, 600, False, False, 0);
GfxSetTextColor(colorWhite);
GfxSetTextAlign( 6 );
GfxTextOut( "LTP "+WriteVal(C,1.2), Status("pxwidth")/C14, Status("pxheight")/C15);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorBrightGreen);
GfxTextOut(""+Bdc+"", Status("pxwidth")/C14, Status("pxheight")/C15*2.0);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorRed);
GfxTextOut(""+Sdc+"", Status("pxwidth")/C14, Status("pxheight")/C15*2.0);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorYellow);
GfxTextOut(""+Ndc+"", Status("pxwidth")/C14, Status("pxheight")/C15*2.0);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorGreen);
GfxTextOut(""+BTdc+"", Status("pxwidth")/C14, Status("pxheight")/C15*2.5);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorGreen);
GfxTextOut(""+STdc+"", Status("pxwidth")/C14, Status("pxheight")/C15*2.5);


pricechange=(C-Ref(C,-1))*100/Ref(C,-1);
changeponit=C-Ref(C,-1);
Vlp=Param("Volume lookback period",15,10,300,10);
Vrg=MA(V,Vlp);
St = StDev(Vrg,Vlp);
Vp3 = Vrg + 3*st;
Vp2 = Vrg + 2*st;;
Vp1 = Vrg + 1*st;;
Vn1 = Vrg -1*st;
Vn2 = Vrg -2*st;

x=Param("xposn",1,0,1000,1);
y=Param("yposn",1,0,1000,1);

GfxGradientRect( 1, 1, 1400, 40, colorGrey50, colorDarkGrey);
GfxSetBkMode(0);
GfxSelectFont( "Georgia", 18, 800, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "ULTIMATE VOLATILITY EXPERT ", x+600, y+10 );
GfxSelectFont( "Tahoma", 16, 800, False );
GfxSetTextColor( colorGold );
GfxTextOut( Name(), x+100, y+10 );
GfxSelectFont( "Century Gothic", 15, 100, False );
GfxSetTextColor( colorWhite );
GfxTextOut( Date(), x+1000, y+10 );
GfxSelectFont( "Comic Sans MS", 15, 500, False );
GfxSetTextColor( colorYellow );
GfxTextOut( Interval(2), x+275, y+10 );
//------------------------------------------------------------ H, L, O, C----------------------
GfxGradientRect( 1, 40, 1400, 55, colorGrey50, colorDarkGrey );
GfxSetBkMode(0);
GfxSelectFont( "Areal", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "High:"+WriteVal(H,1.2), x+100, y+40 );
GfxSelectFont( "Areal", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Low:"+WriteVal(L,1.2), x+200, y+40 );
GfxSelectFont( "Areal", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Open:"+WriteVal(O,1.2), x+300, y+40 );
GfxSelectFont( "Areal", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Close:"+WriteVal(C,1.2), x+400, y+40 );
GfxSelectFont( "Script MT Bold", 12, 100, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Created By Murali Krishna ", x+1000, y+39 );
//-----------------------------------------------------------Valume-------------------------------
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Volume="+WriteVal(V,1.2), x+500, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorLime );
GfxTextOut( WriteIf(V>Vp2,"Very High",""), x+600, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorLime );
GfxTextOut( WriteIf(V>Vp1," High",""), x+600, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorLime );
GfxTextOut( WriteIf(V>Vrg,"Above Average",""), x+600, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorRed );
GfxTextOut( WriteIf(V<Vrg AND V>Vn1,"Less than Average",""), x+600, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorRed );
GfxTextOut( WriteIf(V<Vn1,"Low",""), x+600, y+40 );
//----------------------------------------------------------------Leveles----------------------------

GfxGradientRect( 1, 185, 90, 200, colorGrey50,colorDarkGrey );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorOrange );
GfxTextOut( "Levels ", x+45, y+185 );

GfxGradientRect( 1, 200, 90, 215, colorDarkGrey,colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L4MonthH>C, " 5MH "+WriteVal(L4MonthH,1.2)+" ",""), x+50, y+200 );

GfxGradientRect( 1, 215, 90, 230, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L3MonthH>C, " 4MH "+WriteVal(L3MonthH,1.2)+" ",""), x+50, y+215 );

GfxGradientRect( 1, 230, 90, 245, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L2MonthH>C, " 3MH "+WriteVal(L2MonthH,1.2)+" ",""), x+50, y+230 );

GfxGradientRect( 1, 245, 90, 260, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L1MonthH>C, " 2MH "+WriteVal(L1MonthH,1.2)+" ",""), x+50, y+245 );

GfxGradientRect( 1, 260, 90, 275, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (LMonthH>C, " LMH "+WriteVal(LMonthH,1.2)+" ",""), x+50, y+260 );

GfxGradientRect( 1, 275, 90, 290, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (MonthH>C, " CMH "+WriteVal(MonthH,1.2)+" ",""), x+50, y+275 );

GfxGradientRect( 1, 290, 90, 305, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L3WeekH>C, " 4WH "+WriteVal(L3WeekH,1.2)+" ",""),x+50, y+290 );

GfxGradientRect( 1, 305, 90, 320, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L2WeekH>C, " 3WH "+WriteVal(L2WeekH,1.2)+" ",""), x+50, y+305 );

GfxGradientRect( 1, 320, 90, 335, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L1WeekH>C, " 2WH "+WriteVal(L1WeekH,1.2)+" ",""), x+50, y+320 );

GfxGradientRect( 1, 335, 90, 350, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (LWeekH>C, " 1WH "+WriteVal(LWeekH,1.2)+" ","") , x+50, y+335 );

GfxGradientRect( 1, 350, 90, 365, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (WeekH>C, " CWH "+WriteVal(WeekH,1.2)+" ",""), x+50, y+350 );

GfxGradientRect( 1, 365, 90, 380, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (DayH>C, " PDH "+WriteVal(DayH,1.2)+" ",""), x+50, y+365 );

GfxGradientRect( 1, 380, 90, 395, colorLightBlue , colorBlue );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorCustom12);
GfxTextOut( WriteIf (C, " LTP "+WriteVal(C,1.2)+" ",""), x+50, y+380 );

GfxGradientRect( 1, 395, 90, 410, colorDarkGrey,colorDarkGreen);
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (DayL<C, " PDL "+WriteVal(DayL,1.2)+" ",""), x+50, y+395 );

GfxGradientRect( 1, 410, 90, 425, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (WeekL<C, " CWL "+WriteVal(WeekL,1.2)+" ",""), x+50, y+410 );

GfxGradientRect( 1, 425, 90, 440, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (LWeekL<C, " 1WL "+WriteVal(LWeekL,1.2)+" ",""), x+50, y+425 );

GfxGradientRect( 1, 440, 90, 455, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 9, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L1WeekL<C, " 2WL "+WriteVal(L1WeekL,1.2)+" ",""), x+50, y+440);

GfxGradientRect( 1, 455, 90, 470, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L2WeekL<C, " 3WL "+WriteVal(L2WeekL,1.2)+" ",""), x+50, y+455);

GfxGradientRect( 1, 470, 90, 485, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L3WeekL<C, " 4WL "+WriteVal(L3WeekL,1.2)+" ",""), x+50, y+470);

GfxGradientRect( 1, 485, 90, 500, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (MonthL<C, " CML "+WriteVal(MonthL,1.2)+" ",""), x+50, y+485);

GfxGradientRect( 1, 500, 90, 515, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (LMonthL<C, " 1ML "+WriteVal(LMonthL,1.2)+" ",""), x+50, y+500);

GfxGradientRect( 1, 515, 90, 530, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L1MonthL<C, " 2ML "+WriteVal(L1MonthL,1.2)+" ",""), x+50, y+515);

GfxGradientRect( 1, 530, 90, 545, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L2MonthL<C, " 3ML "+WriteVal(L2MonthL,1.2)+" ",""), x+50, y+530);

GfxGradientRect( 1, 545, 90, 560, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L3MonthL<C, " 4ML "+WriteVal(L3MonthL,1.2)+" ",""), x+50, y+545);

GfxGradientRect( 1, 560, 90, 575, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L4MonthL<C, " 5ML "+WriteVal(L4MonthL,1.2)+" ",""), x+50, y+560);
 

ajeetsingh

Well-Known Member
#5
i applied in 5.9, it said 31 errors, all error from Plot function, can you solve it sir
Copy Now:


Code:
_SECTION_BEGIN("Price");

SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0, 0)));
//SetTradeDelays(1,1,1,1);
SetPositionSize(100,spsShares);
_SECTION_END();

NDays=Param("Number of Days",10,1,50,1); 
DayC=TimeFrameGetPrice("C",inDaily,-1);
NDaysDHLAvg=0;
for(i=1;i<=NDays;i++)
{
DayH=TimeFrameGetPrice("H",inDaily,-i);
DayL=TimeFrameGetPrice("L",inDaily,-i);
NDaysDHLAvg=NDaysDHLAvg+(DayH-DayL);
}
NDaysDHLAvg=NDaysDHLAvg/NDays;

ADM= NDaysDHLAvg; // Average Day Moment

// Dynamic Levels//----------Majer Support Resistent Zones---------------------------------------------------

DayH = TimeFrameGetPrice("H", inDaily, -1); DayHI = LastValue (DayH,1); // yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1); DayLI = LastValue (DayL,1); // yesterdays low
DayC = TimeFrameGetPrice("C", inDaily, -1); DayCI = LastValue (DayC,1); // yesterdays close
DayO = TimeFrameGetPrice("O", inDaily); DayOI = LastValue (DayO,1); // current day open
WeekH= TimeFrameGetPrice("H", inWeekly, 0); WeekHI = LastValue (WeekH,1); // This Week high
WeekL= TimeFrameGetPrice("L", inWeekly, 0); WeekLI = LastValue (WeekL,1); // This Week low
MonthH= TimeFrameGetPrice("H", inMonthly, 0); MonthHI = LastValue (MonthH,1); // This Month high
MonthL= TimeFrameGetPrice("L", inMonthly, 0); MonthLI = LastValue (MonthL,1); // This Month low
LWeekH= TimeFrameGetPrice("H", inWeekly, -1); LWeekHI = LastValue (LWeekH,1); // One Week before high
LWeekL= TimeFrameGetPrice("L", inWeekly, -1); LWeekLI = LastValue (LWeekL,1); // One Week before low
LMonthH= TimeFrameGetPrice("H", inMonthly, -1); LMonthHI = LastValue (LMonthH,1); // One Month before high
LMonthL= TimeFrameGetPrice("L", inMonthly, -1); LMonthLI = LastValue (LMonthL,1); // One Month before low
L1WeekH= TimeFrameGetPrice("H", inWeekly, -2); L1WeekHI = LastValue (L1WeekH,1); // Two Week before high
L1WeekL= TimeFrameGetPrice("L", inWeekly, -2); L1WeekLI = LastValue (L1WeekL,1); // Two Week before low
L1MonthH= TimeFrameGetPrice("H", inMonthly, -2); L1MonthHI = LastValue (L1MonthH,1); // Two Month before high
L1MonthL= TimeFrameGetPrice("L", inMonthly, -2); L1MonthLI = LastValue (L1MonthL,1); // Two Month before low
L2WeekH= TimeFrameGetPrice("H", inWeekly, -3); L2WeekHI = LastValue (L2WeekH,1); // Three Week before high
L2WeekL= TimeFrameGetPrice("L", inWeekly, -3); L2WeekLI = LastValue (L2WeekL,1); // Three Week before low
L2MonthH= TimeFrameGetPrice("H", inMonthly, -3); L2MonthHI = LastValue (L2MonthH,1); // Three Month before high
L2MonthL= TimeFrameGetPrice("L", inMonthly, -3); L2MonthLI = LastValue (L2MonthL,1); // Three Month before low
L3MonthH= TimeFrameGetPrice("H", inMonthly, -4); L3MonthHI = LastValue (L3MonthH,1); // Four Month before high
L3MonthL= TimeFrameGetPrice("L", inMonthly, -4); L3MonthLI = LastValue (L3MonthL,1); // Four Month before low
L4MonthH= TimeFrameGetPrice("H", inMonthly, -5); L4MonthHI = LastValue (L4MonthH,1); // Five Month before high
L4MonthL= TimeFrameGetPrice("L", inMonthly, -5); L4MonthLI = LastValue (L4MonthL,1); // Five Month before low
L3WeekH= TimeFrameGetPrice("H", inWeekly, -4); L3WeekHI = LastValue (L3WeekH,1); // Four Week before high
L3WeekL= TimeFrameGetPrice("L", inWeekly, -4); L3WeekLI = LastValue (L3WeekL,1); // Four Week before low
//----------------------------------------------------------------------------------------------------------------------


Buy= C>((DayC)+((.382)*(ADM)));
Sell= C<((DayC)-((.382)*(ADM)));

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

Short=Sell;
Cover=Buy;

BuyPrice=ValueWhen(Buy,C);
SellPrice=ValueWhen(Sell,C);
ShortPrice=ValueWhen(Short,C);
CoverPrice=ValueWhen(Cover,C);

BuyTarget1= (0.45*ADM)+BuyPrice;
BuyTarget2= (0.95*ADM)+BuyPrice;
BuyTarget3= (1.95*ADM)+BuyPrice;
SellTarget1= SellPrice-(0.45*ADM);
SellTarget2= SellPrice-(0.95*ADM);
SellTarget3= SellPrice-(1.95*ADM);

//------------------------------------------------------------------------------------------------

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50); 
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45); 
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50); 
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);

Long=Flip(Buy,Sell); 
Shrt=Flip(Sell,Buy); 

BuyPrice=ValueWhen(Buy,C);
SellPrice=ValueWhen(Sell,C);

Bdc=(
WriteIf (Buy AND Ref(shrt,-1), " BUY@ "+C+" ","")+ 
WriteIf(Buy , "LastTrade Profit="+(SellPrice-C)+"","")
);

Sdc=(
WriteIf (Sell AND Ref(Long,-1), " SEll@ "+C+" ","")+
WriteIf(Sell , "LastTrade Profit="+(C-BuyPrice)+"","")
);

Ndc=(
WriteIf(Long AND NOT Buy, "Long@"+WriteVal((BuyPrice))+" /Profit="+WriteVal((C-BuyPrice))+"","")+
WriteIf(Shrt AND NOT Sell, "Short@"+WriteVal((SellPrice))+" /Profit="+WriteVal((SellPrice-C))+"","")
);

BTdc=(
WriteIf(Long AND NOT Buy, "Target1(1/2ADM)"+WriteVal((BuyTarget1))+
"::\nTarget2(One ADM)"+WriteVal((BuyTarget2))+
"::\nTarget3(Two ADM)"+WriteVal((BuyTarget3))+"","")
);

STdc=(
WriteIf(Shrt AND NOT Sell, "Target1(1/2ADM)"+WriteVal((SellTarget1))+
"::\nTarget2(One ADM)"+WriteVal((SellTarget2))+
"::\nTarget3(Two ADM)"+WriteVal((SellTarget3))+"","")
);

_SECTION_END();

trendup = IIf(C>((DayC)+((.382)*(ADM))), colorBlue, colorWhite);
trendcolor = IIf(C<((DayC)-((.382)*(ADM))), colorRed, trendup);
Plot( C, "Close", trendcolor, styleCandle | styleThick );

numbars = LastValue(Cum(Status("barvisible")));
hts = -33.5;

// Volatility Levels //
DC = DayC; DCI = LastValue (DC,1); // Yesterday Close
BY = ((DayC)+((.382)*(ADM))); BYI = LastValue (BY,1); // Buy Entry Line
BT1 = ((DayC)+((.618)*(ADM))); BT1I = LastValue (BT1,1); // Buy Target Line 1
BT2 = ((DayC)+((.786)*(ADM))); BT2I = LastValue (BT2,1); // Buy Target Line 2
BT3 = ((DayC)+(ADM)); BT3I = LastValue (BT3,1); // Buy Target Line 3
SH = ((DayC)-((.382)*(ADM))); SHI = LastValue (SH,1); // Sell Entry Line
ST1 = ((DayC)-((.618)*(ADM))); ST1I = LastValue (ST1,1); // Sell Target Line 1
ST2 = ((DayC)-((.786)*(ADM))); ST2I = LastValue (ST2,1); // Sell Target Line 2
ST3 = ((DayC)-(ADM)); ST3I = LastValue (ST3,1); // Sell Target Line 3

vvl = ParamToggle("Intraday Target Levels","Hide|Show",0);
if(vvl==1) {
Plot(DC, "DC",colorWhite,styleDots|styleLine|styleNoRescale |styleNoTitle);
Plot(BY, "BY",colorLime,styleDots|styleLine|styleNoRescale| styleNoTitle);
Plot(BT1, "BT1",colorGreen,styleDots|styleLine|styleNoRescale|styleNoTitle);
Plot(BT2, "BT2",colorGreen,styleDots|styleLine|styleNoRescale|styleNoTitle);
Plot(BT3, "BT3",colorGreen,styleDots|styleLine|styleNoRescale|styleNoTitle);
Plot(SH, "SH",colorRed,styleDots|styleLine|styleNoRescale|styleNoTitle);
Plot(ST1, "ST1",colorBrown,styleDots|styleLine|styleNoRescale|styleNoTitle);
Plot(ST2, "ST2",colorBrown,styleDots|styleLine|styleNoRescale|styleNoTitle);
Plot(ST3, "ST3",colorBrown,styleDots|styleLine|styleNoRescale|styleNoTitle);

PlotText(" DC ", LastValue(BarIndex())-(numbars/Hts), DCI, colorDarkGrey);
PlotText(" Buy " , LastValue(BarIndex())-(numbars/Hts), BYI, colorLime);
PlotText(" Target1 " , LastValue(BarIndex())-(numbars/Hts), BT1I, colorGreen);
PlotText(" Target2 " , LastValue(BarIndex())-(numbars/Hts), BT2I, colorGreen);
PlotText(" Target3 " , LastValue(BarIndex())-(numbars/Hts), BT3I, colorGreen);
PlotText(" Sell " , LastValue(BarIndex())-(numbars/Hts), SHI, colorRed);
PlotText(" Target1 " , LastValue(BarIndex())-(numbars/Hts), ST1I, colorBrown);
PlotText(" Target2 " , LastValue(BarIndex())-(numbars/Hts), ST2I, colorBrown);
PlotText(" Target3 " , LastValue(BarIndex())-(numbars/Hts), ST3I, colorBrown);
}

mmwwl = ParamToggle(" MOnthly, Weekly Levels","Hide|Show",1);
if(mmwwl==1) {
Plot(DayH, "PDH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(WeekH, "CWH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(LWeekH, "LWH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(L1WeekH, "2WH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(L2WeekH, "3WH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(L3WeekH, "4WH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(MonthH, "CMH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(LMonthH, "LMH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(L1MonthH, "2MH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(L2MonthH, "3MH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(L3MonthH, "4MH",colorBlue,styleLine|styleNoRescale|styleNoTitle);
Plot(L4MonthH, "5MH",colorBlue,styleLine|styleNoRescale|styleNoTitle);

Plot(DayL, "PDL",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(WeekL, "CWL",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(LWeekL, "LWL",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(L1WeekL, "2WL",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(L2WeekL, "3WL",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(L3WeekL, "4WL",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(MonthL, "CML",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(LMonthL, "LML",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(L1MonthL, "2ML",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(L2MonthL, "3ML",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(L3MonthL, "4ML",colorViolet,styleLine|styleNoRescale|styleNoTitle);
Plot(L4MonthL, "5ML",colorViolet,styleLine|styleNoRescale|styleNoTitle);

PlotText(" PDH ", LastValue(BarIndex())-(numbars/Hts), DayHI, colorBlue);
PlotText(" CWH " , LastValue(BarIndex())-(numbars/Hts), WeekHI, colorBlue);
PlotText(" LWH " , LastValue(BarIndex())-(numbars/Hts), LWeekHI, colorBlue);
PlotText(" 2WH " , LastValue(BarIndex())-(numbars/Hts), L1WeekHI, colorBlue);
PlotText(" 3WH " , LastValue(BarIndex())-(numbars/Hts), L2WeekHI, colorBlue);
PlotText(" 4WH " , LastValue(BarIndex())-(numbars/Hts), L3WeekHI, colorBlue);
PlotText(" CMH " , LastValue(BarIndex())-(numbars/Hts), MonthHI, colorBlue);
PlotText(" LMH " , LastValue(BarIndex())-(numbars/Hts), LMonthHI, colorBlue);
PlotText(" 2MH " , LastValue(BarIndex())-(numbars/Hts), L1MonthHI, colorBlue);
PlotText(" 3MH ", LastValue(BarIndex())-(numbars/Hts), L2MonthHI, colorBlue);
PlotText(" 4MH " , LastValue(BarIndex())-(numbars/Hts), L3MonthHI, colorBlue);
PlotText(" 5MH " , LastValue(BarIndex())-(numbars/Hts), L4MonthHI, colorBlue);

PlotText(" PDL " , LastValue(BarIndex())-(numbars/Hts), DayLI, colorViolet);
PlotText(" CWL " , LastValue(BarIndex())-(numbars/Hts), WeekLI, colorViolet);
PlotText(" LWL " , LastValue(BarIndex())-(numbars/Hts), LWeekLI, colorViolet);
PlotText(" 2WL " , LastValue(BarIndex())-(numbars/Hts), L1WeekLI, colorViolet);
PlotText(" 3WL " , LastValue(BarIndex())-(numbars/Hts), L2WeekLI, colorViolet);
PlotText(" 4WL " , LastValue(BarIndex())-(numbars/Hts), L3WeekLI, colorViolet);
PlotText(" CML " , LastValue(BarIndex())-(numbars/Hts), MonthLI, colorViolet);
PlotText(" LML " , LastValue(BarIndex())-(numbars/Hts), LMonthLI, colorViolet);
PlotText(" 2ML " , LastValue(BarIndex())-(numbars/Hts), L1MonthLI, colorViolet);
PlotText(" 3ML ", LastValue(BarIndex())-(numbars/Hts), L2MonthLI, colorViolet);
PlotText(" 4ML " , LastValue(BarIndex())-(numbars/Hts), L3MonthLI, colorViolet);
PlotText(" 5ML " , LastValue(BarIndex())-(numbars/Hts), L4MonthLI, colorViolet);

}

_SECTION_BEGIN("Background text");
C11=ParamColor("up panel",colorBlack );
C12=ParamColor("dn panel",colorBlack );
C13=Param("fonts",20,10,30,1 );
C14=Param("left-right",2.1,1.0,5.0,0.1 );
C15=Param("up-down",8,1,30,1 );
Miny = Status("axisminy");
Maxy = Status("axismaxy");
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
pxwidth = Status("pxwidth");
pxheight = Status("pxheight");
GfxSetBkMode( 0 ); 
GfxSelectFont("Tahoma", 12, 500, False, False, 0);
GfxSetTextColor(colorCustom12); 
GfxSetTextAlign( 6 );
GfxTextOut( "ADM (Average Day Moment) "+WriteVal(ADM,1.2), Status("pxwidth")/C14, Status("pxheight")/C15*1.5);
GfxSelectFont("Tahoma", 15, 600, False, False, 0);
GfxSetTextColor(colorWhite); 
GfxSetTextAlign( 6 );
GfxTextOut( "LTP "+WriteVal(C,1.2), Status("pxwidth")/C14, Status("pxheight")/C15);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorBrightGreen);
GfxTextOut(""+Bdc+"", Status("pxwidth")/C14, Status("pxheight")/C15*2.0);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorRed);
GfxTextOut(""+Sdc+"", Status("pxwidth")/C14, Status("pxheight")/C15*2.0);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorYellow);
GfxTextOut(""+Ndc+"", Status("pxwidth")/C14, Status("pxheight")/C15*2.0);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorGreen);
GfxTextOut(""+BTdc+"", Status("pxwidth")/C14, Status("pxheight")/C15*2.5);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorGreen);
GfxTextOut(""+STdc+"", Status("pxwidth")/C14, Status("pxheight")/C15*2.5);


pricechange=(C-Ref(C,-1))*100/Ref(C,-1);
changeponit=C-Ref(C,-1);
Vlp=Param("Volume lookback period",15,10,300,10);
Vrg=MA(V,Vlp);
St = StDev(Vrg,Vlp); 
Vp3 = Vrg + 3*st; 
Vp2 = Vrg + 2*st;;
Vp1 = Vrg + 1*st;;
Vn1 = Vrg -1*st; 
Vn2 = Vrg -2*st; 

x=Param("xposn",1,0,1000,1);
y=Param("yposn",1,0,1000,1);

GfxGradientRect( 1, 1, 1400, 40, colorGrey50, colorDarkGrey);
GfxSetBkMode(0);
GfxSelectFont( "Georgia", 18, 800, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "ULTIMATE VOLATILITY EXPERT ", x+600, y+10 );
GfxSelectFont( "Tahoma", 16, 800, False );
GfxSetTextColor( colorGold );
GfxTextOut( Name(), x+100, y+10 );
GfxSelectFont( "Century Gothic", 15, 100, False );
GfxSetTextColor( colorWhite );
GfxTextOut( Date(), x+1000, y+10 );
GfxSelectFont( "Comic Sans MS", 15, 500, False );
GfxSetTextColor( colorYellow );
GfxTextOut( Interval(2), x+275, y+10 );
//------------------------------------------------------------ H, L, O, C----------------------
GfxGradientRect( 1, 40, 1400, 55, colorGrey50, colorDarkGrey );
GfxSetBkMode(0);
GfxSelectFont( "Areal", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "High:"+WriteVal(H,1.2), x+100, y+40 );
GfxSelectFont( "Areal", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Low:"+WriteVal(L,1.2), x+200, y+40 );
GfxSelectFont( "Areal", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Open:"+WriteVal(O,1.2), x+300, y+40 );
GfxSelectFont( "Areal", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Close:"+WriteVal(C,1.2), x+400, y+40 );
GfxSelectFont( "Script MT Bold", 12, 100, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Created By Murali Krishna ", x+1000, y+39 );
//-----------------------------------------------------------Valume-------------------------------
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Volume="+WriteVal(V,1.2), x+500, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorLime );
GfxTextOut( WriteIf(V>Vp2,"Very High",""), x+600, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorLime );
GfxTextOut( WriteIf(V>Vp1," High",""), x+600, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorLime );
GfxTextOut( WriteIf(V>Vrg,"Above Average",""), x+600, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorRed );
GfxTextOut( WriteIf(V<Vrg AND V>Vn1,"Less than Average",""), x+600, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorRed );
GfxTextOut( WriteIf(V<Vn1,"Low",""), x+600, y+40 );
//----------------------------------------------------------------Leveles----------------------------

GfxGradientRect( 1, 185, 90, 200, colorGrey50,colorDarkGrey );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorOrange );
GfxTextOut( "Levels ", x+45, y+185 );

GfxGradientRect( 1, 200, 90, 215, colorDarkGrey,colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L4MonthH>C, " 5MH "+WriteVal(L4MonthH,1.2)+" ",""), x+50, y+200 );

GfxGradientRect( 1, 215, 90, 230, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L3MonthH>C, " 4MH "+WriteVal(L3MonthH,1.2)+" ",""), x+50, y+215 );

GfxGradientRect( 1, 230, 90, 245, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L2MonthH>C, " 3MH "+WriteVal(L2MonthH,1.2)+" ",""), x+50, y+230 );

GfxGradientRect( 1, 245, 90, 260, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L1MonthH>C, " 2MH "+WriteVal(L1MonthH,1.2)+" ",""), x+50, y+245 );

GfxGradientRect( 1, 260, 90, 275, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (LMonthH>C, " LMH "+WriteVal(LMonthH,1.2)+" ",""), x+50, y+260 );

GfxGradientRect( 1, 275, 90, 290, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (MonthH>C, " CMH "+WriteVal(MonthH,1.2)+" ",""), x+50, y+275 );

GfxGradientRect( 1, 290, 90, 305, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L3WeekH>C, " 4WH "+WriteVal(L3WeekH,1.2)+" ",""),x+50, y+290 );

GfxGradientRect( 1, 305, 90, 320, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L2WeekH>C, " 3WH "+WriteVal(L2WeekH,1.2)+" ",""), x+50, y+305 );

GfxGradientRect( 1, 320, 90, 335, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L1WeekH>C, " 2WH "+WriteVal(L1WeekH,1.2)+" ",""), x+50, y+320 );

GfxGradientRect( 1, 335, 90, 350, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (LWeekH>C, " 1WH "+WriteVal(LWeekH,1.2)+" ","") , x+50, y+335 );

GfxGradientRect( 1, 350, 90, 365, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (WeekH>C, " CWH "+WriteVal(WeekH,1.2)+" ",""), x+50, y+350 );

GfxGradientRect( 1, 365, 90, 380, colorDarkGrey, colorDarkRed );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (DayH>C, " PDH "+WriteVal(DayH,1.2)+" ",""), x+50, y+365 );

GfxGradientRect( 1, 380, 90, 395, colorLightBlue , colorBlue );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorCustom12);
GfxTextOut( WriteIf (C, " LTP "+WriteVal(C,1.2)+" ",""), x+50, y+380 );

GfxGradientRect( 1, 395, 90, 410, colorDarkGrey,colorDarkGreen);
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (DayL<C, " PDL "+WriteVal(DayL,1.2)+" ",""), x+50, y+395 );

GfxGradientRect( 1, 410, 90, 425, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (WeekL<C, " CWL "+WriteVal(WeekL,1.2)+" ",""), x+50, y+410 );

GfxGradientRect( 1, 425, 90, 440, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (LWeekL<C, " 1WL "+WriteVal(LWeekL,1.2)+" ",""), x+50, y+425 );

GfxGradientRect( 1, 440, 90, 455, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 9, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L1WeekL<C, " 2WL "+WriteVal(L1WeekL,1.2)+" ",""), x+50, y+440);

GfxGradientRect( 1, 455, 90, 470, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L2WeekL<C, " 3WL "+WriteVal(L2WeekL,1.2)+" ",""), x+50, y+455);

GfxGradientRect( 1, 470, 90, 485, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L3WeekL<C, " 4WL "+WriteVal(L3WeekL,1.2)+" ",""), x+50, y+470);

GfxGradientRect( 1, 485, 90, 500, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (MonthL<C, " CML "+WriteVal(MonthL,1.2)+" ",""), x+50, y+485);

GfxGradientRect( 1, 500, 90, 515, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (LMonthL<C, " 1ML "+WriteVal(LMonthL,1.2)+" ",""), x+50, y+500);

GfxGradientRect( 1, 515, 90, 530, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L1MonthL<C, " 2ML "+WriteVal(L1MonthL,1.2)+" ",""), x+50, y+515);

GfxGradientRect( 1, 530, 90, 545, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L2MonthL<C, " 3ML "+WriteVal(L2MonthL,1.2)+" ",""), x+50, y+530);

GfxGradientRect( 1, 545, 90, 560, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L3MonthL<C, " 4ML "+WriteVal(L3MonthL,1.2)+" ",""), x+50, y+545);

GfxGradientRect( 1, 560, 90, 575, colorDarkGrey, colorDarkGreen );
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 10, 300, False );
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf (L4MonthL<C, " 5ML "+WriteVal(L4MonthL,1.2)+" ",""), x+50, y+560);

.
 

Nehal_s143

Well-Known Member
#7
Thanks to cepetrading, for this code

http:// www. traderji. com /amibroker/90119-simple-coding-help-no-promise-334.html#post1077584

Code:
_SECTION_BEGIN("HA");
a=20;
GraphXSpace=5;
p=30;
p = Param("p",30,2,100,1);
Om=DEMA(O,p);
hm=DEMA(H,p);
lm=DEMA(L,p);
Cm=DEMA(C,p);
HACLOSE=(Om+Hm+Lm+Cm)/4;
HaOpen = AMA( Ref( HaClose, -1), 1);
HaHigh = Max( Hm, Max( HaClose, HaOpen ) );
HaLow = Min( Lm, Min( HaClose, HaOpen ) );
slope = Param("slope",2,2,100,1);
Color20= IIf(LinRegSlope(MA(HaClose,a),slope)<0,colorRed,colorBlue);
Color=IIf(Haclose>MA(HaClose,a),colorBlue, colorRed);
PlotOHLC( HaOpen, HaOpen, HaClose, HaClose, "" + Name(), color, styleCandle);

Buy=Cover= Cross(Haclose,MA(HaClose,a));
Sell=Short= Cross(MA(HaClose,a),Haclose);

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);

_SECTION_END();


_SECTION_BEGIN("KPL Swing with N&M Swing");
SetBarsRequired(200,0);

GraphXSpace = 5;
SetChartOptions(0,chartShowArrows|chartShowDates);
k = Optimize("K",Param("K",3,0.25,5,0.25),0.25,5,0.25) ;
Per= Optimize("atr",Param("atr",10,3,20,1),3,20,1);
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 ) );
j=Haclose;

// set background gradient colours
SetChartBkGradientFill( ParamColor("BgTop", colorDarkGrey),ParamColor("BgBottom", colorLightGrey ),ParamColor("titleblock",colorWhite));
GraphXSpace = 5;

//================================================== ================================================== ===================
//=========================Indicator================ ================================================== ============================
f=ATR(15);

rfsctor = WMA(H-L, Per);

revers = k * rfsctor;

Trend = 1;
NW[0] = 0;
NW[BarCount-1] = Null;


for(i = 1; i < BarCount-1; 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================

//Plot(NW, "", IIf(Trend == 1, 27, 4), 4);
//Buy=NW<HACLOSE;
//Sell=NW>HACLOSE;
//SellPrice=ValueWhen(Sell,C,1);
//BuyPrice=ValueWhen(Buy,C,1);
//Buy=ExRem(Buy,Sell);
//Sell=ExRem(Sell,Buy );

//Short=Sell;
//Cover=Buy;


//NMAB= NW<HACLOSE;
//NMAS= NW>HACLOSE;
AlertIf( Buy, "SOUND C:\\Windows\\Media\\buy.wav", "Audio alert", 1,1+1 );
AlertIf( Sell, "SOUND C:\\Windows\\Media\\sell.wav", "Audio alert", 2,1+1 );

//NMA_status= WriteIf(NMAB, "BUY MODE", WriteIf(NMAS, "SELL MODE", "NEUTRAL"));
//NMAS_Col=IIf(NMAB, colorGreen, IIf(NMAS, colorRed, colorLightGrey));
Filter=1;
//AddColumn( NW[BarCount-1], "SAR", 1.2 );
//AddColumn( HACLOSE, "HA Close", 1.2 );
//AddColumn( C, "Close", 1.2 );
//AddTextColumn(NMA_status, "MODE", 1, colorWhite, NMAS_Col);
//AddColumn( DateTime(), "Date / Time", formatDateTime );
_SECTION_END();

_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorBlack)+ " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorBlack) +
" - " + Date() +" - "+"\n" +EncodeColor(colorBlack) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n"+
EncodeColor(colorLime)+
WriteIf (Buy , " GO LONG / Reverse Signal at "+C+" ","")+
WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+" ","")+"\n"+EncodeColor(colorWhite)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy , "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)+"",""));
//PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
//PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
//PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
//PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
//PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
//PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);

GraphXSpace=5;


for(i=BarCount-1;i>1;i--)
{
if(Buy[i] == 1)
{
entry = C[i];
sig = "BUY";
sl = Ref(NW,-1);
tar1 = entry + (entry * .0050);
tar2 = entry + (entry * .0092);
tar3 = entry + (entry * .0179);

bars = i;
i = 0;
}
if(Sell[i] == 1)
{
sig = "SELL";
entry = C[i];
sl = Ref(NW,-1);
tar1 = entry - (entry * .0060);
tar2 = entry - (entry * .0120);
tar3 = entry - (entry * .0220);


bars = i;
i = 0;
}
}
Offset = 20;
//Clr = IIf(sig == "BUY", colorLime, colorRed);
//ssl = IIf(bars == BarCount-1, NW[BarCount-1], Ref(NW, -1));
//sl = ssl[BarCount-1];

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



messageboard = ParamToggle("Message Board","Show|Hide",1);
if (messageboard == 1 )
{
GfxSelectFont( "Tahoma", 13, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );

if ( sig =="BUY")
{
GfxSelectSolidBrush( colorDarkGreen ); // this is the box background color
}
else
{
GfxSelectSolidBrush( colorDarkRed ); // this is the box background color
}
pxHeight = Status( "pxchartheight" ) ;
xx = Status( "pxchartwidth");
Left = 1100;
width = 310;
x = 5;
x2 = 290;

y = pxHeight;

GfxSelectPen( colorGreen, 1); // broader color
GfxRoundRect( x, y - 163, x2, y , 7, 7 ) ;
GfxTextOut( (" Amibroker trading System "),33,y-165);
GfxTextOut( (" "),27,y-160);
GfxTextOut( ("" + WriteIf(sig =="Long",sig + " at ",sig + " @") + " : " + entry), 13, y-120);
//GfxTextOut( ("Trailing SL : " + sl + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"), 13, y-100);
//GfxTextOut( ("TGT:1 : " + tar1), 13, y -80);
//GfxTextOut( ("TGT:2 : " + tar2), 13,y-60);
//GfxTextOut( ("TGT:3 : " + tar3), 13,y-40);
GfxTextOut( ("Current Profit : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2)+" Points"), 13, y-100);;

}
_SECTION_END();




_SECTION_BEGIN("Background text");
C11=ParamColor("up panel",colorBlack );
C12=ParamColor("dn panel",colorBlack );
C13=Param("fonts",20,10,30,1 );
C14=Param("left-right",2.1,1.0,5.0,0.1 );
C15=Param("up-down",8,1,30,1 );
Miny = Status("axisminy");
Maxy = Status("axismaxy");
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
pxwidth = Status("pxwidth");
pxheight = Status("pxheight");
GfxSetBkMode( 0 );
GfxSelectFont("Tahoma", 12, 500, False, False, 0);
GfxSetTextColor(colorCustom12);
GfxSetTextAlign( 6 );
GfxSelectFont("Tahoma", 15, 600, False, False, 0);
GfxSetTextColor(colorWhite);
GfxSetTextAlign( 6 );
GfxTextOut( "LTP "+WriteVal(C,1.2), Status("pxwidth")/C14, Status("pxheight")/C15);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorBrightGreen);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorRed);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorYellow);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorGreen);

pricechange=(C-Ref(C,-1))*100/Ref(C,-1);
changeponit=C-Ref(C,-1);
Vlp=Param("Volume lookback period",15,10,300,10);
Vrg=MA(V,Vlp);
St = StDev(Vrg,Vlp);
Vp3 = Vrg + 3*st;
Vp2 = Vrg + 2*st;;
Vp1 = Vrg + 1*st;;
Vn1 = Vrg -1*st;
Vn2 = Vrg -2*st;

x=Param("xposn",1,0,1000,1);
y=Param("yposn",1,0,1000,1);

/*GfxGradientRect( 1, 1, 1400, 40, colorGrey50, colorDarkGrey);
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 16, 800, False );
GfxSetTextColor( colorGold );
GfxTextOut( Name(), x+100, y+10 );
GfxSelectFont( "Century Gothic", 15, 100, False );
GfxSetTextColor( colorWhite );
GfxTextOut( Date(), x+600, y+10 );
GfxSelectFont( "Comic Sans MS", 15, 500, False );
GfxSetTextColor( colorYellow );
GfxTextOut( Interval(2), x+275, y+10 );
GfxSelectFont( "Georgia", 18, 800, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Amibroker Trading System ", x+1000, y+10 );
*/
//------------------------------------------------------------ H, L, O, C----------------------
GfxGradientRect( 1, 40, 1400, 55, colorGrey50, colorDarkGrey );
GfxSetBkMode(0);
GfxSelectFont( "Areal", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Open:"+WriteVal(O,1.2), x+100, y+40 );
GfxSelectFont( "Areal", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "High:"+WriteVal(H,1.2), x+200, y+40 );
GfxSelectFont( "Areal", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Low:"+WriteVal(L,1.2), x+300, y+40 );
GfxSelectFont( "Areal", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Close:"+WriteVal(C,1.2), x+400, y+40 );
GfxSelectFont( "Script MT Bold", 12, 100, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "By Amibroker Trading System ", x+1000, y+39 );
//-----------------------------------------------------------Valume-------------------------------
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Volume="+WriteVal(V,1.2), x+500, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorLime );
GfxTextOut( WriteIf(V>Vp2,"Very High",""), x+600, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorLime );
GfxTextOut( WriteIf(V>Vp1," High",""), x+600, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorLime );
GfxTextOut( WriteIf(V>Vrg,"Above Average",""), x+600, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorRed );
GfxTextOut( WriteIf(V<Vrg AND V>Vn1,"Less than Average",""), x+600, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorRed );
GfxTextOut( WriteIf(V<Vn1,"Low",""), x+600, y+40 );

Title = " ";

//Settings for exploration
Value1 = V;
Value2 = V*(H-L);
Value3 = V/(H-L);

Climax = (Value2 == HHV(Value2,10));

VolumeBlast = V > Ref(V, -1) AND Climax AND V > 2*WMA( V, 8 );
Filter=Buy OR Short;
AddColumn( IIf( Buy, 66 , 83 ), "Signal", formatChar, colorDefault, IIf( Buy , colorGreen, colorRed ) );
AddColumn(Close,"Entry Price",1.4, colorDefault, IIf( Buy , colorGreen, colorRed ));
//AddColumn(dtsl,"Stop Loss",1.4, colorDefault, IIf( Buy , colorGreen, colorRed ));
AddColumn(tar1,"Target 1",1.4, colorDefault, IIf( Buy , colorGreen, colorRed ));
AddColumn(tar2,"Target 2",1.4, colorDefault, IIf( Buy , colorGreen, colorRed ));
AddColumn(tar3,"Target 3",1.4, colorDefault, IIf( Buy , colorGreen, colorRed ));
 
#8
Thanks to cepetrading, for this code

http:// www. traderji. com /amibroker/90119-simple-coding-help-no-promise-334.html#post1077584

Code:
_SECTION_BEGIN("HA");
a=20;
GraphXSpace=5;
p=30;
p = Param("p",30,2,100,1);
Om=DEMA(O,p);
hm=DEMA(H,p);
lm=DEMA(L,p);
Cm=DEMA(C,p);
HACLOSE=(Om+Hm+Lm+Cm)/4;
HaOpen = AMA( Ref( HaClose, -1), 1);
HaHigh = Max( Hm, Max( HaClose, HaOpen ) );
HaLow = Min( Lm, Min( HaClose, HaOpen ) );
slope = Param("slope",2,2,100,1);
Color20= IIf(LinRegSlope(MA(HaClose,a),slope)<0,colorRed,colorBlue);
Color=IIf(Haclose>MA(HaClose,a),colorBlue, colorRed);
PlotOHLC( HaOpen, HaOpen, HaClose, HaClose, "" + Name(), color, styleCandle);

Buy=Cover= Cross(Haclose,MA(HaClose,a));
Sell=Short= Cross(MA(HaClose,a),Haclose);

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);

_SECTION_END();


_SECTION_BEGIN("KPL Swing with N&M Swing");
SetBarsRequired(200,0);

GraphXSpace = 5;
SetChartOptions(0,chartShowArrows|chartShowDates);
k = Optimize("K",Param("K",3,0.25,5,0.25),0.25,5,0.25) ;
Per= Optimize("atr",Param("atr",10,3,20,1),3,20,1);
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 ) );
j=Haclose;

// set background gradient colours
SetChartBkGradientFill( ParamColor("BgTop", colorDarkGrey),ParamColor("BgBottom", colorLightGrey ),ParamColor("titleblock",colorWhite));
GraphXSpace = 5;

//================================================== ================================================== ===================
//=========================Indicator================ ================================================== ============================
f=ATR(15);

rfsctor = WMA(H-L, Per);

revers = k * rfsctor;

Trend = 1;
NW[0] = 0;
NW[BarCount-1] = Null;


for(i = 1; i < BarCount-1; 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================

//Plot(NW, "", IIf(Trend == 1, 27, 4), 4);
//Buy=NW<HACLOSE;
//Sell=NW>HACLOSE;
//SellPrice=ValueWhen(Sell,C,1);
//BuyPrice=ValueWhen(Buy,C,1);
//Buy=ExRem(Buy,Sell);
//Sell=ExRem(Sell,Buy );

//Short=Sell;
//Cover=Buy;


//NMAB= NW<HACLOSE;
//NMAS= NW>HACLOSE;
AlertIf( Buy, "SOUND C:\\Windows\\Media\\buy.wav", "Audio alert", 1,1+1 );
AlertIf( Sell, "SOUND C:\\Windows\\Media\\sell.wav", "Audio alert", 2,1+1 );

//NMA_status= WriteIf(NMAB, "BUY MODE", WriteIf(NMAS, "SELL MODE", "NEUTRAL"));
//NMAS_Col=IIf(NMAB, colorGreen, IIf(NMAS, colorRed, colorLightGrey));
Filter=1;
//AddColumn( NW[BarCount-1], "SAR", 1.2 );
//AddColumn( HACLOSE, "HA Close", 1.2 );
//AddColumn( C, "Close", 1.2 );
//AddTextColumn(NMA_status, "MODE", 1, colorWhite, NMAS_Col);
//AddColumn( DateTime(), "Date / Time", formatDateTime );
_SECTION_END();

_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorBlack)+ " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorBlack) +
" - " + Date() +" - "+"\n" +EncodeColor(colorBlack) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n"+
EncodeColor(colorLime)+
WriteIf (Buy , " GO LONG / Reverse Signal at "+C+" ","")+
WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+" ","")+"\n"+EncodeColor(colorWhite)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy , "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)+"",""));
//PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
//PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
//PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
//PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
//PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
//PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);

GraphXSpace=5;


for(i=BarCount-1;i>1;i--)
{
if(Buy[i] == 1)
{
entry = C[i];
sig = "BUY";
sl = Ref(NW,-1);
tar1 = entry + (entry * .0050);
tar2 = entry + (entry * .0092);
tar3 = entry + (entry * .0179);

bars = i;
i = 0;
}
if(Sell[i] == 1)
{
sig = "SELL";
entry = C[i];
sl = Ref(NW,-1);
tar1 = entry - (entry * .0060);
tar2 = entry - (entry * .0120);
tar3 = entry - (entry * .0220);


bars = i;
i = 0;
}
}
Offset = 20;
//Clr = IIf(sig == "BUY", colorLime, colorRed);
//ssl = IIf(bars == BarCount-1, NW[BarCount-1], Ref(NW, -1));
//sl = ssl[BarCount-1];

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



messageboard = ParamToggle("Message Board","Show|Hide",1);
if (messageboard == 1 )
{
GfxSelectFont( "Tahoma", 13, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );

if ( sig =="BUY")
{
GfxSelectSolidBrush( colorDarkGreen ); // this is the box background color
}
else
{
GfxSelectSolidBrush( colorDarkRed ); // this is the box background color
}
pxHeight = Status( "pxchartheight" ) ;
xx = Status( "pxchartwidth");
Left = 1100;
width = 310;
x = 5;
x2 = 290;

y = pxHeight;

GfxSelectPen( colorGreen, 1); // broader color
GfxRoundRect( x, y - 163, x2, y , 7, 7 ) ;
GfxTextOut( (" Amibroker trading System "),33,y-165);
GfxTextOut( (" "),27,y-160);
GfxTextOut( ("" + WriteIf(sig =="Long",sig + " at ",sig + " @") + " : " + entry), 13, y-120);
//GfxTextOut( ("Trailing SL : " + sl + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"), 13, y-100);
//GfxTextOut( ("TGT:1 : " + tar1), 13, y -80);
//GfxTextOut( ("TGT:2 : " + tar2), 13,y-60);
//GfxTextOut( ("TGT:3 : " + tar3), 13,y-40);
GfxTextOut( ("Current Profit : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2)+" Points"), 13, y-100);;

}
_SECTION_END();




_SECTION_BEGIN("Background text");
C11=ParamColor("up panel",colorBlack );
C12=ParamColor("dn panel",colorBlack );
C13=Param("fonts",20,10,30,1 );
C14=Param("left-right",2.1,1.0,5.0,0.1 );
C15=Param("up-down",8,1,30,1 );
Miny = Status("axisminy");
Maxy = Status("axismaxy");
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
pxwidth = Status("pxwidth");
pxheight = Status("pxheight");
GfxSetBkMode( 0 );
GfxSelectFont("Tahoma", 12, 500, False, False, 0);
GfxSetTextColor(colorCustom12);
GfxSetTextAlign( 6 );
GfxSelectFont("Tahoma", 15, 600, False, False, 0);
GfxSetTextColor(colorWhite);
GfxSetTextAlign( 6 );
GfxTextOut( "LTP "+WriteVal(C,1.2), Status("pxwidth")/C14, Status("pxheight")/C15);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorBrightGreen);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorRed);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorYellow);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorGreen);

pricechange=(C-Ref(C,-1))*100/Ref(C,-1);
changeponit=C-Ref(C,-1);
Vlp=Param("Volume lookback period",15,10,300,10);
Vrg=MA(V,Vlp);
St = StDev(Vrg,Vlp);
Vp3 = Vrg + 3*st;
Vp2 = Vrg + 2*st;;
Vp1 = Vrg + 1*st;;
Vn1 = Vrg -1*st;
Vn2 = Vrg -2*st;

x=Param("xposn",1,0,1000,1);
y=Param("yposn",1,0,1000,1);

/*GfxGradientRect( 1, 1, 1400, 40, colorGrey50, colorDarkGrey);
GfxSetBkMode(0);
GfxSelectFont( "Tahoma", 16, 800, False );
GfxSetTextColor( colorGold );
GfxTextOut( Name(), x+100, y+10 );
GfxSelectFont( "Century Gothic", 15, 100, False );
GfxSetTextColor( colorWhite );
GfxTextOut( Date(), x+600, y+10 );
GfxSelectFont( "Comic Sans MS", 15, 500, False );
GfxSetTextColor( colorYellow );
GfxTextOut( Interval(2), x+275, y+10 );
GfxSelectFont( "Georgia", 18, 800, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Amibroker Trading System ", x+1000, y+10 );
*/
//------------------------------------------------------------ H, L, O, C----------------------
GfxGradientRect( 1, 40, 1400, 55, colorGrey50, colorDarkGrey );
GfxSetBkMode(0);
GfxSelectFont( "Areal", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Open:"+WriteVal(O,1.2), x+100, y+40 );
GfxSelectFont( "Areal", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "High:"+WriteVal(H,1.2), x+200, y+40 );
GfxSelectFont( "Areal", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Low:"+WriteVal(L,1.2), x+300, y+40 );
GfxSelectFont( "Areal", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Close:"+WriteVal(C,1.2), x+400, y+40 );
GfxSelectFont( "Script MT Bold", 12, 100, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "By Amibroker Trading System ", x+1000, y+39 );
//-----------------------------------------------------------Valume-------------------------------
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorWhite );
GfxTextOut( "Volume="+WriteVal(V,1.2), x+500, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorLime );
GfxTextOut( WriteIf(V>Vp2,"Very High",""), x+600, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorLime );
GfxTextOut( WriteIf(V>Vp1," High",""), x+600, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorLime );
GfxTextOut( WriteIf(V>Vrg,"Above Average",""), x+600, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorRed );
GfxTextOut( WriteIf(V<Vrg AND V>Vn1,"Less than Average",""), x+600, y+40 );
GfxSelectFont( "Tahoma", 9, 200, False );
GfxSetTextColor( colorRed );
GfxTextOut( WriteIf(V<Vn1,"Low",""), x+600, y+40 );

Title = " ";

//Settings for exploration
Value1 = V;
Value2 = V*(H-L);
Value3 = V/(H-L);

Climax = (Value2 == HHV(Value2,10));

VolumeBlast = V > Ref(V, -1) AND Climax AND V > 2*WMA( V, 8 );
Filter=Buy OR Short;
AddColumn( IIf( Buy, 66 , 83 ), "Signal", formatChar, colorDefault, IIf( Buy , colorGreen, colorRed ) );
AddColumn(Close,"Entry Price",1.4, colorDefault, IIf( Buy , colorGreen, colorRed ));
//AddColumn(dtsl,"Stop Loss",1.4, colorDefault, IIf( Buy , colorGreen, colorRed ));
AddColumn(tar1,"Target 1",1.4, colorDefault, IIf( Buy , colorGreen, colorRed ));
AddColumn(tar2,"Target 2",1.4, colorDefault, IIf( Buy , colorGreen, colorRed ));
AddColumn(tar3,"Target 3",1.4, colorDefault, IIf( Buy , colorGreen, colorRed ));

pls add bactesting code in this afl
 

Similar threads