Skip to main content

TScore for Amibroker (AFL)

amon over 13 years ago Amibroker (AFL)

  • Rating:
    4 / 5 (Votes 5)
  • Tags:
    amibroker

Monitoring the strength of a trend.

Src: http://finantepersonale.blogspot.com/
Author: Emmen

Screenshots

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("TScore");
//*********************************************************
   //http://finantepersonale.blogspot.com/	
   //writted by Emmen	   			
   //Trend Score Monitor
//*********************************************************
HaClose =EMA((O+H+L+C)/4,3);  // Woodie 
HaOpen = IIf(BarIndex()>0,AMA( Ref( HaClose, -1 ), 0.5 ),Open);
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) ); 

p1=Param("Extreme period1",5,3,10);
p2=Param("Extreme period2",8,3,20);
p3=Param("Extreme period3",13,3,50);

HaDiff = IIf(HaClose>HaOpen, 1, IIf(HaClose<HaOpen,-1,0));
HaDiff1 = IIf(HaClose>EMA(HaClose,p1), 1, IIf(HaClose<EMA(HaClose,p1),-1,0));
HaDiff2 = IIf(HaClose>EMA(HaClose,p2), 1, IIf(HaClose<EMA(HaClose,p2),-1,0));
HaDiff3 = IIf(HaClose>EMA(HaClose,p3), 1, IIf(HaClose<EMA(HaClose,p3),-1,0));
HaDiff4 = IIf(EMA(HaClose,p1)>EMA(HaClose,p2), 1, IIf(EMA(HaClose,p1)<EMA(HaClose,p2),-1,0));
HaDiff5 = IIf(EMA(HaClose,p2)>EMA(HaClose,p3), 1, IIf(EMA(HaClose,p2)<EMA(HaClose,p3),-1,0));
HaDiff6 = IIf(HaClose>Ref(HaClose,-1), 1, IIf(HaClose<Ref(HaClose,-1),-1,0));

TScore = HaDiff + HaDiff1 + HaDiff2 + HaDiff3 + HaDiff4 + HaDiff5 + HaDiff6;

pxchartwidth = Status("pxchartwidth");
pxchartheight = Status("pxchartheight");
pxwidth = Status("pxwidth");
pxheight = Status("pxheight");

GfxSelectPen( ColorRGB(180,180,180), width = 1, 0) ;

Color1=IIf(SelectedValue(TScore)>0,ColorRGB(0,120,0),IIf(SelectedValue(TScore)<0,ColorRGB(215,0,0),GetChartBkColor()));
Color2=IIf(SelectedValue(TScore)>1,ColorRGB(0,140,0),IIf(SelectedValue(TScore)<-1,ColorRGB(235,0,0),GetChartBkColor()));
Color3=IIf(SelectedValue(TScore)>2,ColorRGB(0,160,0),IIf(SelectedValue(TScore)<-2,ColorRGB(255,0,0),GetChartBkColor()));
Color4=IIf(SelectedValue(TScore)>3,ColorRGB(0,180,0),IIf(SelectedValue(TScore)<-3,ColorRGB(255,20,0),GetChartBkColor()));
Color5=IIf(SelectedValue(TScore)>4,ColorRGB(0,200,0),IIf(SelectedValue(TScore)<-4,ColorRGB(255,40,0),GetChartBkColor()));
Color6=IIf(SelectedValue(TScore)>5,ColorRGB(0,220,0),IIf(SelectedValue(TScore)<-5,ColorRGB(255,60,0),GetChartBkColor()));
Color7=IIf(SelectedValue(TScore)>6,ColorRGB(0,240,0),IIf(SelectedValue(TScore)<-6,ColorRGB(255,80,0),GetChartBkColor()));

Color11=IIf(SelectedValue(Ref(TScore,-1))>0,ColorRGB(0,120,0),IIf(SelectedValue(Ref(TScore,-1))<0,ColorRGB(215,0,0),GetChartBkColor()));
Color21=IIf(SelectedValue(Ref(TScore,-1))>1,ColorRGB(0,140,0),IIf(SelectedValue(Ref(TScore,-1))<-1,ColorRGB(235,0,0),GetChartBkColor()));
Color31=IIf(SelectedValue(Ref(TScore,-1))>2,ColorRGB(0,160,0),IIf(SelectedValue(Ref(TScore,-1))<-2,ColorRGB(255,0,0),GetChartBkColor()));
Color41=IIf(SelectedValue(Ref(TScore,-1))>3,ColorRGB(0,180,0),IIf(SelectedValue(Ref(TScore,-1))<-3,ColorRGB(255,20,0),GetChartBkColor()));
Color51=IIf(SelectedValue(Ref(TScore,-1))>4,ColorRGB(0,200,0),IIf(SelectedValue(Ref(TScore,-1))<-4,ColorRGB(255,40,0),GetChartBkColor()));
Color61=IIf(SelectedValue(Ref(TScore,-1))>5,ColorRGB(0,220,0),IIf(SelectedValue(Ref(TScore,-1))<-5,ColorRGB(255,60,0),GetChartBkColor()));
Color71=IIf(SelectedValue(Ref(TScore,-1))>6,ColorRGB(0,240,0),IIf(SelectedValue(Ref(TScore,-1))<-6,ColorRGB(255,80,0),GetChartBkColor())); 

Color12=IIf(SelectedValue(Ref(TScore,-2))>0,ColorRGB(0,120,0),IIf(SelectedValue(Ref(TScore,-2))<0,ColorRGB(215,0,0),GetChartBkColor()));
Color22=IIf(SelectedValue(Ref(TScore,-2))>1,ColorRGB(0,140,0),IIf(SelectedValue(Ref(TScore,-2))<-1,ColorRGB(235,0,0),GetChartBkColor()));
Color32=IIf(SelectedValue(Ref(TScore,-2))>2,ColorRGB(0,160,0),IIf(SelectedValue(Ref(TScore,-2))<-2,ColorRGB(255,0,0),GetChartBkColor()));
Color42=IIf(SelectedValue(Ref(TScore,-2))>3,ColorRGB(0,180,0),IIf(SelectedValue(Ref(TScore,-2))<-3,ColorRGB(255,20,0),GetChartBkColor()));
Color52=IIf(SelectedValue(Ref(TScore,-2))>4,ColorRGB(0,200,0),IIf(SelectedValue(Ref(TScore,-2))<-4,ColorRGB(255,40,0),GetChartBkColor()));
Color62=IIf(SelectedValue(Ref(TScore,-2))>5,ColorRGB(0,220,0),IIf(SelectedValue(Ref(TScore,-2))<-5,ColorRGB(255,60,0),GetChartBkColor()));
Color72=IIf(SelectedValue(Ref(TScore,-2))>6,ColorRGB(0,240,0),IIf(SelectedValue(Ref(TScore,-2))<-6,ColorRGB(255,80,0),GetChartBkColor()));

Color13=IIf(SelectedValue(Ref(TScore,-3))>0,ColorRGB(0,120,0),IIf(SelectedValue(Ref(TScore,-3))<0,ColorRGB(215,0,0),GetChartBkColor()));
Color23=IIf(SelectedValue(Ref(TScore,-3))>1,ColorRGB(0,140,0),IIf(SelectedValue(Ref(TScore,-3))<-1,ColorRGB(235,0,0),GetChartBkColor()));
Color33=IIf(SelectedValue(Ref(TScore,-3))>2,ColorRGB(0,160,0),IIf(SelectedValue(Ref(TScore,-3))<-2,ColorRGB(255,0,0),GetChartBkColor()));
Color43=IIf(SelectedValue(Ref(TScore,-3))>3,ColorRGB(0,180,0),IIf(SelectedValue(Ref(TScore,-3))<-3,ColorRGB(255,20,0),GetChartBkColor()));
Color53=IIf(SelectedValue(Ref(TScore,-3))>4,ColorRGB(0,200,0),IIf(SelectedValue(Ref(TScore,-3))<-4,ColorRGB(255,40,0),GetChartBkColor()));
Color63=IIf(SelectedValue(Ref(TScore,-3))>5,ColorRGB(0,220,0),IIf(SelectedValue(Ref(TScore,-3))<-5,ColorRGB(255,60,0),GetChartBkColor()));
Color73=IIf(SelectedValue(Ref(TScore,-3))>6,ColorRGB(0,240,0),IIf(SelectedValue(Ref(TScore,-3))<-6,ColorRGB(255,80,0),GetChartBkColor()));

Color14=IIf(SelectedValue(Ref(TScore,-4))>0,ColorRGB(0,120,0),IIf(SelectedValue(Ref(TScore,-4))<0,ColorRGB(215,0,0),GetChartBkColor()));
Color24=IIf(SelectedValue(Ref(TScore,-4))>1,ColorRGB(0,140,0),IIf(SelectedValue(Ref(TScore,-4))<-1,ColorRGB(235,0,0),GetChartBkColor()));
Color34=IIf(SelectedValue(Ref(TScore,-4))>2,ColorRGB(0,160,0),IIf(SelectedValue(Ref(TScore,-4))<-2,ColorRGB(255,0,0),GetChartBkColor()));
Color44=IIf(SelectedValue(Ref(TScore,-4))>3,ColorRGB(0,180,0),IIf(SelectedValue(Ref(TScore,-4))<-3,ColorRGB(255,20,0),GetChartBkColor()));
Color54=IIf(SelectedValue(Ref(TScore,-4))>4,ColorRGB(0,200,0),IIf(SelectedValue(Ref(TScore,-4))<-4,ColorRGB(255,40,0),GetChartBkColor()));
Color64=IIf(SelectedValue(Ref(TScore,-4))>5,ColorRGB(0,220,0),IIf(SelectedValue(Ref(TScore,-4))<-5,ColorRGB(255,60,0),GetChartBkColor()));
Color74=IIf(SelectedValue(Ref(TScore,-4))>6,ColorRGB(0,240,0),IIf(SelectedValue(Ref(TScore,-4))<-6,ColorRGB(255,80,0),GetChartBkColor()));

GfxSelectSolidBrush(color14);
GfxRoundRect( 3,pxchartheight-15,13,pxchartheight-25 ,2,2) ;
GfxSelectSolidBrush(color24);
GfxRoundRect( 3,pxchartheight-27,13,pxchartheight-37 ,2,2) ;
GfxSelectSolidBrush(color34);
GfxRoundRect( 3,pxchartheight-39,13,pxchartheight-49 ,2,2) ;
GfxSelectSolidBrush(color44);
GfxRoundRect( 3,pxchartheight-51,13,pxchartheight-61 ,2,2) ;
GfxSelectSolidBrush(color54);
GfxRoundRect( 3,pxchartheight-63,13,pxchartheight-73 ,2,2) ;
GfxSelectSolidBrush(color64);
GfxRoundRect( 3,pxchartheight-75,13,pxchartheight-85 ,2,2) ;
GfxSelectSolidBrush(color74);
GfxRoundRect( 3,pxchartheight-87,13,pxchartheight-97 ,2,2) ;

GfxSelectSolidBrush(color13);
GfxRoundRect( 15,pxchartheight-15,25,pxchartheight-25 ,2,2) ;
GfxSelectSolidBrush(color23);
GfxRoundRect( 15,pxchartheight-27,25,pxchartheight-37 ,2,2) ;
GfxSelectSolidBrush(color33);
GfxRoundRect( 15,pxchartheight-39,25,pxchartheight-49 ,2,2) ;
GfxSelectSolidBrush(color43);
GfxRoundRect( 15,pxchartheight-51,25,pxchartheight-61 ,2,2) ;
GfxSelectSolidBrush(color53);
GfxRoundRect( 15,pxchartheight-63,25,pxchartheight-73 ,2,2) ;
GfxSelectSolidBrush(color63);
GfxRoundRect( 15,pxchartheight-75,25,pxchartheight-85 ,2,2) ;
GfxSelectSolidBrush(color73);
GfxRoundRect( 15,pxchartheight-87,25,pxchartheight-97 ,2,2) ;

GfxSelectSolidBrush(color12);
GfxRoundRect( 27,pxchartheight-15,37,pxchartheight-25 ,2,2) ;
GfxSelectSolidBrush(color22);
GfxRoundRect( 27,pxchartheight-27,37,pxchartheight-37 ,2,2) ;
GfxSelectSolidBrush(color32);
GfxRoundRect( 27,pxchartheight-39,37,pxchartheight-49 ,2,2) ;
GfxSelectSolidBrush(color42);
GfxRoundRect( 27,pxchartheight-51,37,pxchartheight-61 ,2,2) ;
GfxSelectSolidBrush(color52);
GfxRoundRect( 27,pxchartheight-63,37,pxchartheight-73 ,2,2) ;
GfxSelectSolidBrush(color62);
GfxRoundRect( 27,pxchartheight-75,37,pxchartheight-85 ,2,2) ;
GfxSelectSolidBrush(color72);
GfxRoundRect( 27,pxchartheight-87,37,pxchartheight-97 ,2,2) ;

GfxSelectSolidBrush(color11);
GfxRoundRect( 39,pxchartheight-15,49,pxchartheight-25 ,2,2) ;
GfxSelectSolidBrush(color21);
GfxRoundRect( 39,pxchartheight-27,49,pxchartheight-37 ,2,2) ;
GfxSelectSolidBrush(color31);
GfxRoundRect( 39,pxchartheight-39,49,pxchartheight-49 ,2,2) ;
GfxSelectSolidBrush(color41);
GfxRoundRect( 39,pxchartheight-51,49,pxchartheight-61 ,2,2) ;
GfxSelectSolidBrush(color51);
GfxRoundRect( 39,pxchartheight-63,49,pxchartheight-73 ,2,2) ;
GfxSelectSolidBrush(color61);
GfxRoundRect( 39,pxchartheight-75,49,pxchartheight-85 ,2,2) ;
GfxSelectSolidBrush(color71);
GfxRoundRect( 39,pxchartheight-87,49,pxchartheight-97 ,2,2) ;

GfxSelectSolidBrush(color1);
GfxRoundRect( 51,pxchartheight-15,61,pxchartheight-25 ,2,2) ;
GfxSelectSolidBrush(color2);
GfxRoundRect( 51,pxchartheight-27,61,pxchartheight-37 ,2,2) ;
GfxSelectSolidBrush(color3);
GfxRoundRect( 51,pxchartheight-39,61,pxchartheight-49 ,2,2) ;
GfxSelectSolidBrush(color4);
GfxRoundRect( 51,pxchartheight-51,61,pxchartheight-61 ,2,2) ;
GfxSelectSolidBrush(color5);
GfxRoundRect( 51,pxchartheight-63,61,pxchartheight-73 ,2,2) ;
GfxSelectSolidBrush(color6);
GfxRoundRect( 51,pxchartheight-75,61,pxchartheight-85 ,2,2) ;
GfxSelectSolidBrush(color7);
GfxRoundRect( 51,pxchartheight-87,61,pxchartheight-97 ,2,2) ;

_SECTION_END();

18 comments

over 13 years ago

Hi,

I want to shift this to the bottom or at the top of rightside of the screen. Now it is at the bottom of left side.

Anybody can do this Plz

Thanks
Viswanath

over 13 years ago

Hi, change parameters to 10,30 & 60 for daily TF. Good results

my rating 5

thanks for sharing
Viswanath

over 13 years ago

Hi, seems standard parameters also working fine.

Plz live test & update your findings

thanks
Viswanath

over 13 years ago

Backtested for 1 hour in Realtime frame – Works really good for tops and bottoms.
Specially works excellent with heikein ashi candles. Havnt yet tested in Daily and weekly – So no comments.

Thanx you Amon for the Formula

(5 Star Rating From me).

over 13 years ago

Hi Anand,

Do you have idea how to move all the blocks to right side at the bottom?

At present, its leftside of the bottom

THanks
Viswanath

7. Divyesh
over 13 years ago

@kv_maligi,
Vishwanath sir, i will try to shift it to right top…..
if get sucseed will up date here…..

over 13 years ago

(X1,Y1)
-——————
-——————
-——————
-——————
-——————
-——————
’’’’’’’’’’’’’’’’’’’’’’’’(X2,Y2)
suppose u want 2 draw above rectangle with rounded corners then
GfxRoundRect( x1, y1, x2, y2, x3, y3 )

x1 – x-coordinate of the upper left corner of the rectangle
y1 – y-coordinate of the upper left corner of the rectangle
x2 – x-coordinate of the lower right corner of the rectangle
y2 – y-coordinate of the lower right corner of the rectangle

here X3& Y3 are radii of the corners

if u want to move this rectangle on the screen 2 ur desired location then just change the coordinates of tht rectangle and it will be done.

(these coordinates means the pixels of ur screen. so they r subject to change with the resolution of the screen. i guess so.)
it is very easy
Mr. Vishwanath i would have done tht but tht is of no use. it is actually at right spot on screen obstructing nothing.

over 13 years ago

Thanks extremist & divyesh. When i do exploration ( old one), this indicator gets covered as i normally keep exploration left side.
And also you can easily have glance at this when it is near the signal. I mean latest prices are at right side.

I have done chnages after few trials, herewith attaching the same. The indicator appears at rightside bottom. Replace the old one with following

GfxRoundRect( 703,pxchartheight-15,713,pxchartheight-25 ,2,2) ;

GfxRoundRect( 715,pxchartheight-15,725,pxchartheight-25 ,2,2) ;

GfxRoundRect( 727,pxchartheight-15,737,pxchartheight-25 ,2,2) ;

GfxRoundRect( 739,pxchartheight-15,749,pxchartheight-25 ,2,2) ;

GfxRoundRect( 739,pxchartheight-15,749,pxchartheight-25 ,2,2) ;

GfxRoundRect( 751,pxchartheight-15,761,pxchartheight-25 ,2,2) ;

thanks
viswanath

10. hmsanil
over 13 years ago

hi,

Can somebody tell us how to use this indicator

Thanks

Sudha

11. extremist
over 13 years ago

This is the best Question Put up by u Mr. Sudha.
this could be the real challenge for anandnst and group. as they r giving stars to the code. they might have understood it. he actually has backtested it!
but he is not willing to share it with us.

12. amon
over 13 years ago

Hi all!
I use this indicator in 2 TF for potential Buy/Sell Signals:
Long TF: current Tscore <= 3 of the previous trend or change color
Short TF: current Tscore > 4

Ex:
Long TF: Trend up & TScore <= 3 (green) or Trend up & TScore first color change (red)
Short TF: TScore > 4 & red

14. siddhx
over 13 years ago

If all the squares are red , it is a buy signal .

if all squares are green , it is a sell signal.

i hope i am right .

regards

15. samapada
over 13 years ago

Its not working in mine……Showing Blank Chart….Pls Help me… any pulgins I need or wt….. Hope of getting help frm any1

16. leoguy7
over 13 years ago

MINE IS THE SAME PROBLEM AS SAMAPADA. My chart is showing Entirely Blank and just showing only RED Colored boxes on the left hand down side of the screen. kindly help me. my AMI version is 5.3

over 13 years ago

logical solutions seems to be, in you existing chart set up, just add above code at the bottom, chk and revert back

18. ford7k
almost 13 years ago

hi siddhx
The system can be used on daily and if you need on hourly.
you can use two timeframe method.
have one chart 30 minutes tf and another 60min tf.
once buy signal comes on 60min tf,go for entry on 30min chart
similarly for shorting-get first signal on 60min tf then try to enter short on 30min tf.

the colors mean green =up red=down

//Trend Score is a very compact indicator which shows 5 days trend computed using using Heiken Ashi
// in a grid of 5 × 7. It will NOT occupy more than 75 × 50 pixels space on screen.
// Here is full size image of Indicator on screen.
//Colors have usual meaning. Green is uppity up. Red is Down. White is unknown.
//As you move across candles, colors will change.

unless you add price and ema etc your screen remains blank.
just drag n drop price and ema5,ema8,and ema13 with Haclose AS price field if you want clarity visually

Leave Comment

Please login here to leave a comment.