Skip to main content

Regression for Amibroker (AFL)

av1428 over 13 years ago Amibroker (AFL)

  • Rating:
    3 / 5 (Votes 8)
  • Tags:
    amibroker

Follow the signals, you may require to carry more positions but then EOM you will find yourself profitable.
No Targets or SL, only signals I usually trade with a 10 Point profit/Loss booking

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("BehgozinStrengthFinder");
CLN= Ref(C,0);
Beh=((CLN - EMA(CLN, 10)) / EMA(CLN, 10)) * 100;
V2 = HHV(Beh,100);
V3 = LLV(Beh,100);
Beh1= WMA(Beh*(V2-V3),6);
_SECTION_END();
_SECTION_BEGIN("Linear Regression");
P = Beh1;
Periods = Param("Periods", 15, 2, 300, 1, 10 );
_SECTION_END();
SetBarFillColor( IIf(Beh1 > LinearReg( P, Periods ) ,ColorRGB( 0, 100, 0 ),ColorRGB( 100,0,0 )));
SetChartOptions(0,chartShowDates);
SetChartBkColor( ParamColor("Color", ColorRGB( 105, 105, 105 ) ) );
GraphXSpace=Param("GraphXSpace",10,-100,100,1);
Plot(C,"Close",IIf(Beh1 > LinearReg( P, Periods ) ,ColorRGB( 0,255, 0 ),ColorRGB(255,0,5 )),styleCandle);

dtn=DateNum();
haC=EMA((O+H+L+C)/4,3); haO=AMA(Ref(haC,-1),0.5);
haH=Max(H,Max(haC,haO)); haL=Min(L,Min(haC,haO));

_SECTION_BEGIN ("pivot");

bi = BarIndex ();
nbar = Param ("nbar", 7,2,50,1);

// Define fractals
PHigh = H> Ref (HHV (H, nbar), -1) AND Ref (HHV (H, nbar), nbar) <= H;
PHighPrice = ValueWhen (PHigh, H);
PLow = L <Ref (LLV (L, nbar), -1) AND Ref (LLV (L, nbar), nbar)>= L;
PLowPrice = ValueWhen (PLow, L);

ll = IIf (PLow AND PLowPrice <Ref (PLowPrice, -1), 1, 0);
hl = IIf (PLow AND PLowPrice>= Ref (PLowPrice, -1), 2, 0);
lh = IIf (PHigh AND PHighPrice <Ref (PHighPrice, -1), 3, 0);
hh = IIf (PHigh AND PHighPrice>= Ref (PHighPrice, -1), 4, 0);

combi = ll + hl + lh + hh;

t1 = ValueWhen (combi, combi, 1);
t2 = ValueWhen (combi, combi, 2);
t3 = ValueWhen (combi, combi, 3);

AA = ValueWhen (PLow, L, 2);
AABar = ValueWhen (PLow, bi, 2);
BB = ValueWhen (PHigh, H, 1);
BBBar = ValueWhen (PHigh, bi, 1);
CC = ValueWhen (PLow, L, 1);
CCBar = ValueWhen (PLow, bi, 1);

GraphXSpace = 5;

PlotShapes (shapeSmallCircle * PLow, colorBrightGreen, 0, L, -10);

for( i = 0; i < BarCount; i++ ) 
{ 
 if( PLow[i] ) 
 {
  PlotText( "Buy Now", i-2.5, L[ i ]-1, colorBrightGreen, colorDefault );
 }
if( PHigh [i])
 {
  PlotText( "Sell Now", i-2.5, H[i]+1, colorRed, colorDefault ); 
 }
}



PlotShapes (shapeSmallCircle * PHigh, colorRed, 0, H, 10);

_SECTION_END ();



dec = (Param("Decimals",2,0,7,1)/10)+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) ;

6 comments

over 13 years ago

lol… i made this one. thanks for posting here. but its still not good to trade. i am still researching on it. and bar color is the signal, not the circle(is pivot points).

over 13 years ago

Good For posting..not for trade…
Anyway Thanks for posting…

3. ocil
over 13 years ago

Any AFL Repaint the signal , not good for trade.

over 13 years ago

bar color will not repaint, which is the main signal.

whoever added “buy now/sell now” text on this afl, my request is pls dont misguide others by this type of naughty modification. its just pivot point and deals with PA.

Leave Comment

Please login here to leave a comment.