Ansatsu Trend Follower System

KelvinHand

Well-Known Member
#11
The folder consists of indicators folders in which

ATR trailing stop
PSAR (dots_color.ex4)
CCI
Histobands.ex4

All the above indicators are redeaily available except "unknown" Histobands

I have decompiled Histobands.ex4 to .mq4 version for you.

Here is the code:
//+------------------------------------------------------------------+
//| HistoBands.mq4 |
//| Copyright 2006, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2006, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 DodgerBlue
#property indicator_color2 Red

double WBP[];
extern int ShortPeriod=5;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(3);
SetIndexStyle(0,DRAW_HISTOGRAM,0,2);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_HISTOGRAM,0,2);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexBuffer(2, WBP);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int i,k,counted_bars=IndicatorCounted();
double HH,LL,WBPma,Stdev,Bands;

if(Bars<=32) return(0);

//---- last counted bar will be recounted
int limit=Bars-counted_bars;
if(counted_bars>0) limit++;

for(i=0; i<limit-1; i++)
{
HH=High[Highest(NULL,0,MODE_HIGH,ShortPeriod,i)];
LL=Low[Lowest(NULL,0,MODE_LOW,ShortPeriod,i)];
WBP=(HH+LL+Close)/3;
}

for(i=0; i<limit; i++)
{
WBPma=iMAOnArray(WBP,Bars,34,0,MODE_SMA,i);
Stdev=iStdDevOnArray(WBP,Bars,34,MODE_SMA,0,i);
Bands=((WBP+2*Stdev-WBPma)/(4*Stdev))*4-2;
ExtMapBuffer1=0;
ExtMapBuffer2=0;
if (Bands>0){ExtMapBuffer1=Bands;}
if (Bands<0){ExtMapBuffer2=Bands;}
}

return(0);
}
//+------------------------------------------------------------------+



Please try to convert it to amibroker format.....will be very greatful

Regards
Anurag


Code:
_SECTION_BEGIN("HistoBands");
bgTop = ParamColor("BgTop",    colorBlack);
bgBot = ParamColor("BgBottom", colorBlack);
SetChartBkGradientFill( bgTop ,bgBot, colorLightGrey);



ShortPeriod = Param("Short Period", 5, 2, 200);

ColorBull = ParamColor("Bull", ColorRGB(40,144,255));
ColorBear = ParamColor("Bear", colorRed);


HH = HHV(H, ShortPeriod);
LL = LLV(L, ShortPeriod);
WBP = (HH+LL+C)/3;
WBPma=MA(WBP,34);

iStDev=StDev(WBP,34);
Bands=((WBP+2*iStDev-WBPma)/(4*iStDev))*4-2;

ColorHisto = IIf(Bands>0, ColorBull, ColorBear);

Plot(Bands, "HistoBand", ColorHisto, styleHistogram);

_SECTION_END();
 

KelvinHand

Well-Known Member
#13
hii everyone..

kelvin please post the complete code
Well!
Not every MT4 code is easy to convert to Amibroker.
It take time.

Just figure out MT4 LWMA is Ami WMA.

Dot Colors.ex4 for main chart
Code:
iPeriod = 8;

ColorDogerBlue = ColorRGB(30,144,255);

MAH_1 = Ref(WMA(H,iPeriod), -1);
MAL_1 = Ref(WMA(L,iPeriod), -1);

iDir =IIf(C > MAH_1, 1, IIf(C<MAL_1, -1, 0)); 


dotMA = IIf(iDir == 1,  MAL_1, 
        IIf(iDir == -1, MAH_1, Null));

cColor = IIf(iDir == -1, colorRed,
         IIf(iDir == 1,  ColorDogerBlue,  0));



Plot(dotMA, "Dot Colors", CColor, styleThick|styleDots|styleNoLabel|styleNoLine);
 
Last edited:

KelvinHand

Well-Known Member
#14
CCI_T3.ex4

Code:
CCI_Period = Param("CCI Period",168, 2, 500);
T3_Period = Param("T3 Period", 34, 2);
b = Param("b", 0.618);


   c1 = b * b;
   c2 = c1 * b;
   c3 = -c2;
   c4 = 3.0 * (c1 + c2);
   c5 = -3.0 * (2.0 * c1 + b + c2);
   c6 = 3.0 * b + 1.0 + c2 + 3.0 * c1;
   c7 = T3_Period;
   if (c7 < 1.0) c7 = 1;
   
   c7 = (c7 - 1.0) / 2.0 + 1.0;
   
   c8 = 2 / (c7 + 1.0);
   c9 = 1 - c8;

dC1 = 0;
dC2 = 0;
dC3 = 0;
dC4 = 0;
dC5 = 0;

dCCI = CCI(CCI_Period);

for(i=CCI_Period+1; i<BarCount; i++)
{
	dC1[i] = c9 * dC1[i-1] + c8 * dCCI[i];
	dC2[i] = c9 * dC2[i-1] + c8 * dC1[i];
	dC3[i] = c9 * dC3[i-1] + c8 * dC2[i];
	dC4[i] = c9 * dC4[i-1] + c8 * dC3[i];
	dC5[i] = c9 * dC5[i-1] + c8 * dC4[i];
  CCI_T3[i] = c3 * dC5[i] + c4 * dC4[i] + c5 * dC3[i] + c6 * dC2[i];
 
}
    


cColor = IIf(CCI_T3 >=0, ColorRGB(30,144,255), colorRed);
Plot(CCI_T3, "CCI_T3", cColor, styleHistogram|styleThick|styleNoLabel);
 

KelvinHand

Well-Known Member
#15
Bar Color.ex4
Code:
Color0 = ColorRGB(102,179,255);
Color1 = ColorRGB(30,144,255);   //DodgerBlue
Color2 = ColorRGB(0,103,206);
Color3 = colorWhite;
Color4 = ColorRGB(255,51,51);
Color5 = ColorRGB(196,0,0);
Color6 = ColorRGB(140,0,0);
Color7 = ColorRGB(130,36,0);


Period = Param("Period", 30, 2);
invert_strength = ParamToggle("invert_strength", "False|True");

dRSI = RSI(Period);

if (invert_strength == True) 
dRSI -= 2.0 * (dRSI - 50.0); 


CBar = IIf(dRSI<=45,             Color7,
       IIf(dRSI>42 AND dRSI<=45, Color4,
       IIf(dRSI>38 AND dRSI<=41, Color5,
       IIf(dRSI>35 AND dRSI<=37, Color6, 

       IIf(dRSI>55  AND dRSI<57, Color0,
       IIf(dRSI>=58 AND dRSI<60, Color1,
       IIf(dRSI>=55,             Color2, Color3)))))));

Plot( 1, "ColorBar", cBar, styleOwnScale|styleArea|styleNoLabel, 0, 1 );
 
#19
All thanks go to KelvinHand for porting the metatrader code to amibroker. Thanks to you we have one more system to play around with. The CCI T3 and HistoBands are pretty neat. Thanks for sharing the code with us. You could have easily chosen not to do so.

rakeshkrohilla-

Open a new price chart and then drag the main chart code from post #13 using the charts submenu from window submenu.

If you still have problems in figuring it out, add the following lines at the beginning of the code in post no 13.

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", colorGreen ), styleNoTitle | ParamStyle("Style") | styleCandle );
 

KelvinHand

Well-Known Member
#20
Dear Kevlin

I don't know how to reach your Post #13. Please paste main chart formula here.
There are 2 groups of people doing different ways.
One of the group required every thing integrated.
So for you, you need to copy the code in Post #18 by PrkTrade and paste into in font of mycode.

Another group is software developer, like me, always doing object oriented.
PrkTrade's Post #19 is my Clean Price Chart. What you need to do is not to double click the AFL of mycode but to do a click and hold and move the cursor to the price chart.

The reason I maintenance this way, cause over the year, new features can be add on the same price chart AFL easily. Otherwise, i had to import new features to so many AFL codes i created. It is very troublesome.
 
Last edited:

Similar threads