BLOCK BLASTER SATURDAY

amibrokerfans

Well-Known Member
#1
Untitled.png


PART 1
Code:
_SECTION_BEGIN("Back_Set");
SetChartBkGradientFill( ParamColor("BT", colorGreen),
ParamColor("BB", colorOrange),ParamColor("Title",colorGreen) );
SetChartBkColor(ParamColor("OuterPanel",colorOrange));
SetChartOptions(0,chartShowArrows|chartShowDates);
noteboard =ParamToggle("Message Board","Show|Hide",0);
optno =  Optimize("TSL",Param("A (Change To Optimise)",10, 1, 55 ,1),1,20 ,1);
multi1 =  Optimize("Multi1",Param("B (Chng2Opt)",5, 1, 55 ,1),1, 25 ,1);
multi2 =  Optimize("Multi2",Param("C (Chng2Opt)",22, 1, 55 ,1),1, 25 ,1);
Tsl =ParamToggle("SlLine","No|Yes");
stoprev =ParamToggle("Swch2Stop&Rev","No|Yes");
CAtEnd = ParamToggle("ClosetradeEOD", "No|Yes");
mktc=Param("MarktEndTime",152500,000000,235959,1 );
function TBR(optno)
{
dres=HHV(H,optno);
dsup=LLV(L,optno);
davd=IIf(H>Ref(dres,-1),1,IIf(L<Ref(dsup,-1),-1,0));
davn=ValueWhen(davd!=0,davd,1);
dtsl1=IIf(davn==1,dsup,dres);
return dtsl1;
}
SetChartOptions(0,chartShowArrows|chartShowDates);
atsl=TBR(optno);
Hr=360;
Hr1=25;
Vr=14;
dB=H>atsl;
dS=L<atsl;
TimeFrameSet(multi1*Interval());
btsl=TBR(optno);
WB=H>btsl;
WS=L<btsl;
TimeFrameRestore();
ctsl=TimeFrameExpand(btsl,multi1*Interval(),expandFirst);
wb=TimeFrameExpand(WB,multi1*Interval(),expandFirst);
ws=TimeFrameExpand(WS,multi1*Interval(),expandFirst);
TimeFrameSet(multi2*Interval());
dtsl=TBR(optno);
MB=H>dtsl;
MS=L<dtsl;
TimeFrameRestore();
mtsl=TimeFrameExpand(dtsl,multi2*Interval(),expandFirst);
mb=TimeFrameExpand(MB,multi2*Interval(),expandFirst);
ms=TimeFrameExpand(MS,multi2*Interval(),expandFirst);
Buy = IIf((Low > ctsl AND Low > dtsl), DB, ((WB AND Low > atsl AND Low > dtsl) OR (MB AND Low > atsl AND Low > ctsl)));
Sell=IIf(CAtEnd==False, (DS OR (DS AND WS) AND (Low > dtsl)), (DS OR (DS AND WS) AND (Low > dtsl)) OR TimeNum() > mktc);
Short = IIf((High < ctsl AND High < dtsl), DS, (WS AND High < atsl AND High < dtsl) OR (MS AND High < atsl AND High < ctsl ));
Cover=IIf(CAtEnd==False, (DB OR (DB AND WB) AND (High < dtsl)), (DB OR (DB AND WB) AND (High < dtsl)) OR TimeNum() > mktc);
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);
lg=Flip(Buy,Sell);
St=Flip(Short,Cover);
Relax = NOT lg AND NOT Buy AND NOT St AND NOT Sell AND NOT Sell AND NOT Cover;
SellSL=ValueWhen(Short,atsl,1);
BuySL=ValueWhen(Buy,atsl,1);
BuyDifference= BuyPrice - BuySL;
SellDifference = SellSL - SellPrice;
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-25);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-35);                     
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-30);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=25);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=35);                     
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-30);
PlotShapes(IIf(Sell, shapeStar, shapeNone),colorGold, 0, L, Offset=-15);
PlotShapes(IIf(Cover, shapeStar, shapeNone),colorGold, 0,L, Offset=-15);
PlotShapes(IIf(CAtEnd==True AND TimeNum() > mktclose AND NOT Relax, shapeStar, shapeNone),colorGold, 0,L, Offset=-15);
tsl = IIf(Buy OR lg OR Short OR St AND NOT Relax, atsl,Null);
tslcolor = IIf(Buy OR lg AND NOT Relax, colorBrightGreen, colorCustom12);
Plot(tsl, "",tslcolor, styleLine);
SellPrice=ValueWhen(Short,C,1);
BuyPrice=ValueWhen(Buy,C,1);
Long=Flip(Buy,Sell);
Shrt=Flip(Short,Cover);
Relax = NOT Long AND NOT Buy AND NOT St AND NOT Sell AND NOT Sell AND NOT Cover;
SellSL=ValueWhen(Short,atsl,1);
BuySL=ValueWhen(Buy,atsl,1);
BuyDifference= BuyPrice - BuySL;
SellDifference = SellSL - SellPrice;
tar1 = IIf(Buy OR Long AND NOT Relax AND NOT Sell AND NOT Cover, (BuyPrice + BuyDifference), (SellPrice - SellDifference));
tar2 = IIf(Buy OR Long AND NOT Relax AND NOT Sell AND NOT Cover, (BuyPrice + (2*BuyDifference)), (SellPrice - (2*SellDifference)));
tar3 = IIf(Buy OR Long AND NOT Relax AND NOT Sell AND NOT Cover, (BuyPrice + (4*BuyDifference)), (SellPrice - (4*SellDifference)));
buyach1 = IIf((Buy OR Long AND NOT Relax AND NOT Cover AND NOT Short AND NOT Shrt), H > tar1, 0);
buyach2 = IIf((Buy OR Long AND NOT Relax AND NOT Cover AND NOT Short AND NOT Shrt), H > tar2, 0);
buyach3 = IIf((Buy OR Long AND NOT Relax AND NOT Cover AND NOT Short AND NOT Shrt), H > tar3, 0);
sellach1 = IIf((Short OR Shrt AND NOT Relax AND NOT Sell AND NOT Buy AND NOT Long), L < tar1, 0);
sellach2 = IIf((Short OR Shrt AND NOT Relax AND NOT Sell AND NOT Buy AND NOT Long), L < tar2, 0);
sellach3 = IIf((Short OR Shrt AND NOT Relax AND NOT Sell AND NOT Buy AND NOT Long), L < tar3, 0);
Trend = ADX(14) > 25 AND NOT ADX(14) < Ref(ADX(14), -1);
Range = ADX(14) < 25 AND NOT ADX(14) > Ref(ADX(14), -1);
mycolor=IIf(Long, colorBrightGreen,(IIf(shrt,colorCustom12,colorDarkGrey)));
SetBarFillColor( mycolor );
trendup = IIf(Long, colorDarkGreen, colorDarkGrey);
trendcolor = IIf(shrt, colorRed, trendup);
Plot( C, "Close", trendcolor, styleCandle );
grid_day = IIf(Day()!=Ref(Day(),-1),1,0);
Plot(grid_day,"",colorGrey40,styleHistogram|styleDots|styleNoLabel|styleOwnScale);
 

amibrokerfans

Well-Known Member
#2
PART 2
Code:
if
(noteboard == 0 )
{
SetChartOptions(0,chartShowArrows|chartShowDates);
Title = EncodeColor(colorYellow)+ Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorSkyblue) +
" - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Open-"+O+" "+"High-"+H+" "+"Low-"+L+" "+"Close-"+C+" "+ "Volume= "+ WriteVal(V);
GfxSelectFont( "Tahoma", 13, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor
( colorWhite );
GfxSelectSolidBrush( colorBlack );
pxHeight = Status( "pxchartheight" ) ;
xx = Status( "pxchartwidth");
Left = 1100;
width = 310;
x = 5;
x2 = 290;
y = pxHeight;
GfxSelectPen
( colorLightBlue, 1);
GfxRoundRect
( x, y - 187, x2, y , 7, 7 ) ;
GfxTextOut
( ("" + WriteIf(trend, "Trending Market " ,"")), 13, y-185);
GfxTextOut
( ("" + WriteIf(range, "flat Market " ,"")), 13, y-185);
GfxTextOut
( ("" + WriteIf(Buy, "Go Long At "+C+" - SL " +atsl,"")), 13, y-165);
GfxTextOut
( ("" + WriteIf (Short, "Go Short At "+C+" - SL " +atsl,"")), 13, y-165);
if (stoprev==0)
{
GfxTextOut
( ("" + WriteIf (Sell AND NOT Short, "Exit Long At "+C,"")), 13, y-165);
GfxTextOut
( ("" + WriteIf (Cover AND NOT Buy, "Exit Short At "+C,"")), 13, y-165);
}
GfxTextOut
( ("" + WriteIf (Long AND NOT Buy, "Long At "+(BuyPrice)+" - TSL " + atsl + "","")), 13, y-165);
GfxTextOut
( ("" + WriteIf (shrt AND NOT Short, "Short At "+(SellPrice)+" - TSL " + atsl + "","")), 13, y-165);
GfxTextOut
( ("" + WriteIf (Relax, "Do not enter in Trade - Just Chill!!!","")), 13, y-165);
GfxTextOut
( ("" + WriteIf (Long AND NOT Buy, "Current P/L: "+(C-BuyPrice)+" Points","")), 13, y-145);
GfxTextOut
( ("" + WriteIf (shrt AND NOT Short, "Current P/L: "+(SellPrice-C)+" Points","")), 13, y-145);
GfxTextOut
( ("" + WriteIf (Long OR Buy OR Shrt OR Short, "Target 1: "+tar1,"")), 13, y-125);
GfxTextOut
( ("" + WriteIf (Long OR Buy OR Shrt OR Short, "Target 2: "+tar2,"")), 13, y-105);
GfxTextOut
( ("" + WriteIf (Long OR Buy OR Shrt OR Short, "Target 3: "+tar3,"")), 13, y-85);
GfxTextOut
( ("" + WriteIf (buyach1, "1st Target Done: "+tar1,"")), 13, y-65);
GfxTextOut
( ("" + WriteIf (sellach1, "1st Target Done: "+tar1,"")), 13, y-65);
GfxTextOut
( ("" + WriteIf (buyach2, "2nd Target Done: "+tar2,"")), 13, y-45);
GfxTextOut
( ("" + WriteIf (sellach2, "2nd Target Done: "+tar2,"")), 13, y-45);
GfxTextOut
( ("" + WriteIf (buyach3, "3rd Target Done: "+tar3,"")), 13, y-25);
GfxTextOut
( ("" + WriteIf (sellach3, "3rd Target Done: "+tar3,"")), 13, y-25);
}
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-25);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-35);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-30);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=25);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=35);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-30);
if (stoprev==0)
{
PlotShapes(IIf(Sell, shapeStar, shapeNone),colorRed, 0, L, Offset=-15);
PlotShapes(IIf(Sell, shapeHollowCircle, shapeNone),colorWhite, 0, L, Offset=-15);
PlotShapes(IIf(Cover, shapeStar, shapeNone),colorGreen, 0,L, Offset=-15);
PlotShapes(IIf(Cover, shapeHollowCircle, shapeNone),colorWhite, 0, L, Offset=-15);
PlotShapes(IIf(CAtEnd==True AND TimeNum() > mktclose AND NOT Relax, shapeStar, shapeNone),colorGold, 0,L, Offset=-15);
}
if (noteboard == 1 )
{
(
Title = EncodeColor(colorYellow) + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorSkyblue) +
" - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Open-"+O+" "+"High-"+H+" "+"Low-"+L+" "+"Close-"+C+" "+ "Volume= "+ WriteVal(V)+"\n"+"\n"+
EncodeColor(colorLime)+"\n"+
WriteIf(trend, "Trending Market Condition " ,"")+
WriteIf(range, "Rangebound Market Condition " ,"")+"\n"+
WriteIf (Buy, "Action: Go Long At "+C+" - SL " +DTSL,"")+
WriteIf (Short, "Action: Go Short At "+C+" - SL " +DTSL,"")+
WriteIf(Long AND NOT Buy, "Action : Long Taken At "+(BuyPrice)+" - Trail SL @ " + DTSL + "","")+
WriteIf(shrt AND NOT Sell, "Action : Short Taken At "+(SellPrice)+" - Trail SL @ " + DTSL + "","")+
WriteIf (Sell AND NOT Short, "Exit Long At "+C,"")+
WriteIf (Cover AND NOT Buy, "Exit Short At "+C,"")+
WriteIf(NOT Long AND NOT Buy AND NOT shrt AND NOT Sell, "Action: Not In A Trade - RELAX!!!","")+"\n"+
WriteIf(Long AND NOT Buy, "Profit/Loss: "+(C-BuyPrice)+" Points","")+
WriteIf(shrt AND NOT Sell, "Profit/Loss: "+(SellPrice-C)+" Points","")+"\n"+
WriteIf(Long OR Buy OR Shrt OR Short, "Target 1: "+tar1,"")+"\n"+
WriteIf(Long OR Buy OR Shrt OR Short, "Target 2: "+tar2,"")+"\n"+
WriteIf(Long OR Buy OR Shrt OR Short, "Target 3: "+tar3,"")+"\n"+
WriteIf(buyach1, "1st Target Done: "+tar1,"")+
WriteIf(sellach1, "1st Target Done: "+tar1,"")+"\n"+
WriteIf(buyach2, "2nd Target Done: "+tar2,"")+
WriteIf(sellach2, "2nd Target Done: "+tar2,"")+"\n"+
WriteIf(buyach3, "3rd Target Done: "+tar3,"")+
WriteIf(sellach3, "3rd Target Done: "+tar3,""));
}
t1=Param("t1", 20, -20);
Top = Sum(High, t1) / t1;
Bottom = Sum(Low, t1) / t1;
av1=(Top+Bottom)/2;
mc=IIf(av1>C, colorBrown, colorGreen);
Plot(av1, "", mc, styleStaircase);
t2=Param("t2", 30, -30);
Top = Sum(High, t2) / t2;
Bottom = Sum(Low, t2) / t2;
av2=(Top+Bottom)/2;
mc=IIf(av2>C, colorBrown, colorGreen);
Plot(av2, "", mc, styleStaircase);
t3=Param("t3", 50, -50);
Top = Sum(High, t3) / t3;
Bottom = Sum(Low, t3) / t3;
av3=(Top+Bottom)/2;
mc=IIf(av3>C, colorBrown, colorGreen);
Plot(av3, "", mc, styleStaircase);
_SECTION_END();
 

Similar threads