Does any body help in formulating amibroker afl for TTTB trading system?
T3B System :
_SECTION_BEGIN("_ChartTemplat_GD-B_dark");
//-------------------------------------------------------------------------
//----Anweisungen abhängig vom Charttyp------------------------------------
dec = (Param("Decimals",2,0,7,1)/10)+1;
bi = BarIndex();
Lbi = LastValue(BarIndex());
sbi = SelectedValue(bi);
x1= BarCount-1;
Title = EncodeColor(55)+ Title = Name() + " " + EncodeColor(32) + Date() +
" " + EncodeColor(5) + "{{INTERVAL}} " +
EncodeColor(55)+ " Open = "+ EncodeColor(52)+ WriteVal(O,dec) +
EncodeColor(55)+ " High = "+ EncodeColor(5) + WriteVal(H,dec) +
EncodeColor(55)+ " Low = "+ EncodeColor(32)+ WriteVal(L,dec) +
EncodeColor(55)+ " Close = "+ EncodeColor(52)+ WriteVal(C,dec)+
EncodeColor(55)+ " Volume = "+ EncodeColor(52)+ WriteVal(V,1);
cs = GetPriceStyle(); // CS == ChartStyle
choose = ParamToggle("Charttypabhängigkeit?", "Yes|No");
if(choose == 0){
if(cs == styleBar){
chartArt = "bar";
}
else if (cs == styleCandle){
chartArt = "candle";
}else{
chartArt = "line";
}
} else {
chartArt = "";
};
//-------------------------------------------------------------------------
//---- ChartFarben --ChartStyle--------------------------------------------
if(!choose )
SetChartBkColor( ParamColor("HintergrundFarbe", ColorRGB( 0, 50, 50 ) ) ); // Hintergrund >> nur wenn ChartTemplet greift
line_color_up = ParamColor("Line_Color_UP", ColorRGB( 46, 139 , 87 ) ); //- UP - DOWN -
line_color_down = ParamColor("Line_Color_DOWN", ColorRGB( 220, 20, 60 ) ); //- UP - DOWN -
bar_color_up = ColorRGB( 44, 138 , 84);
bar_color_down = ColorRGB( 220, 22, 60);
candle_color_up = ColorRGB( 0, 0, 255);
candle_color_down = ColorRGB( 255, 0, 0);
candle_rahmen = ColorRGB( 128, 128 , 128);
spezial_color = ParamColor( "PinBar-Color", ColorRGB( 255, 255 , 0) );
//-------------------------------------------------------------------------
//---- Bedingungen --------------------------------------------------------
// PinBars werden anders coloriert
// Bars/Lines/Candles bei denen open und close dicht beieiander liegen werden anders farbieg dargestellt
// zur Vereinfachung, ist der Abstand Hoch - Tief um Faktor "pinbar_faktor" größer als der Abstand Open-Close, gilt die Bedingung
pinbar_faktor = Param( "Pinbar-Faktor", 5, 1, 10, 0.1);
bedingungOpenNearClose = abs(H-L)/ pinbar_faktor > abs(O-C) ;
bedingungUp = O< C;
style = styleNoTitle | ParamStyle("Style");
if(chartArt == "line"){
Plot( C, "Price", IIf(bedingungOpenNearClose, spezial_color, IIf( bedingungUp, line_color_up, line_color_down) ),style |styleThick | GetPriceStyle()); // |styleThick
}else if (chartArt == "bar"){
Plot( C, "Price", IIf( bedingungOpenNearClose, spezial_color, IIf( bedingungUp, bar_color_up, bar_color_down) ),style | GetPriceStyle());
}else if (chartArt == "candle"){
// bei CandleChart wird hiermit die FüllFarbe definiert
SetBarFillColor( IIf( bedingungUp, candle_color_up, candle_color_down) );
// Color definiert bei CandlChart den Rahmen
Plot( C, "Price", IIf (bedingungOpenNearClose, spezial_color, candle_rahmen ), style | GetPriceStyle());
}else{
// StandartChart
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
}
//-------------------------------------------------------------------------
//---- Indis --------------------------------------------------------------
//---ChartTypAbhängiges
if(chartArt == "line"){
// wenn LinienChart
}
_SECTION_BEGIN("scaner if candle above SMA5= buy");
Buy = Cross( C,MA( Close, 5 ) );
Sell = Cross(MA(C,5),C);
PlotShapes(IIf(Buy==1, shapeUpArrow , shapeNone), colorBlue, 0,Low, Offset=-15);
PlotShapes(IIf(Sell==1, shapeDownArrow , shapeNone), colorRed, 0,High, Offset=-15);
_SECTION_END();
/*_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();*/
GfxSetOverlayMode(1);
GfxSelectFont("Tahoma", Status("pxheight")/40 );
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( ParamColor( "Warna", colorLightGrey ) );
GfxSetBkMode(0); // transparent
GfxTextOut( "", Status("pxwidth")/2, Status("pxheight")/18 );
_SECTION_BEGIN("MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 5);
//Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorBlue ),styleDots, ParamStyle("Style") );
_SECTION_END();
//Plot(V,"",IIf(C>O,colorGreen,IIf(C<O,4,7)),2|4|32768,5);
//Plot(MA(V,45),"",colorBlue,0|4|32768,40);
//,styleLine|styleThick|styleOwnScale);
GfxSetOverlayMode(0);
GfxSelectFont("Tahoma", Status("pxheight")/40);
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( colorLightGrey );
GfxSetBkMode(0); // transparent
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/10 );
PeakLine = ValueWhen(( High>= Ref(High,-1) AND
High>= Ref(High, 1) AND
High>= Ref(High, 2) AND
High>= Ref(High,3 ) AND
High> Low),H);
TroughLine = ValueWhen(((
Low<=Ref(Low, 1) AND
Low<=Ref(Low, 2) AND
Low<=Ref(Low, 3) AND
Low<=Ref(Low,-1))),L);
Plot( Peakline, "PeakLine", ParamColor("PeakLine Color", colorRed), styleNoLabel);
Plot( TroughLine, "TroughLine", ParamColor("TroughLine Color",colorBlue), styleNoLabel);
_SECTION_BEGIN("Smarttrade trading system");
SetChartOptions(0,chartShowDates|chartShowArrows|chartLogarithmic|chartWrapTitle);
GraphXSpace = 5;
Plot(C,"",colorBlack,styleCandle);
x = Ref(H,-1);
Y = Ref(L,-1);
a=x+5;
b=y-5;
aa=StochK(39,3);
bb=StochD(39,3,3);
Buy = Cover = C>a AND aa>bb;
Sell = Short = C<b AND aa<bb;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
//PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,L,-15);
//PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,H,-15);
_SECTION_END();
_SECTION_BEGIN("CCI80");
CCI80 = IIf( CCI(10) >80 AND EMA(Close,13)>EMA(Close,39), colorGreen, IIf(CCI(10) <-80 AND EMA (Close, 13)<EMA(Close,39),colorRed,colorBlue));
Plot(5, "ribbon", CCI80, styleOwnScale|styleArea|styleNoLabel, 0, -5);
_SECTION_END();