[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Four Point Indicator



PureBytes Links

Trading Reference Links

Title: Four Point Indicator

Hi,

Here is an indicator that I wrote over the weekend.  It should be used on a bar chart. The indicator compares the current close to the close 4 bars earlier (this can be changed).  The colour differences indicate whether the open is above or below the close, is the same, or is a within bar I would appreciate some feedback from others and their ideas.  When I wrote it I was thinking about intraday charts, but it should work well on all timeframes.  If you have problems with the listing below, I also attached it as a file.



<<...>>


//////////////////////////////////////////////////////////

// Four Point

//////////////////////////////////////////////////////////

Periods = Param("Periods", 4, 2, 200, 1, 1 );

uh = ParamColor("Strong Up",colorBlue);

uw = ParamColor("Weak Up",colorLightBlue);

dh = ParamColor("Strong Down",colorRed);

dw = ParamColor("Weak Down",colorPink);

thesame = ParamColor("Sideways",colorGreen);

within = ParamColor("Within Bar",colorYellow);

background =""> ParamColor("Background Colour",colorLightGrey);

SetChartBkColor(background);

for ( i = Periods+1; i < BarCount; i++ )                                                        // we start calculations from 'Periods' bar. Previous bars are set to null

{

        // Going up

        if (Close[i] > Close[i-Periods]){                                                               // the close is higher than number of periods before

                if(Close[i] > Open[i]){                                                                         // and the close is higher than the open

                        if (High[i]<=High[i-1] AND Low[i]>=Low[i-1]){           // but if it is a within bar

                                colour[i] = within;                                                                                     // It's a withing bar, so give it the within colour

                        }else

                                colour[i] = uh;                                                                                         // It's a strong up bar, so give it the strong up colour

                        }

                }else{

                        colour[i] = uw;                                                                                                 // It's a weak up bar, so give it the weak up colour

                }

       

        // Going down

        }else if (Close[i] < Close[i-Periods]){                                         // the close is lower than number of periods before

                if(Close[i] < Open[i]){                                                                         // and the close is lower than the open

                        if (High[i]<=High[i-1] AND Low[i]>=Low[i-1]){           // but if it is a within bar

                                colour[i] = within;                                                                                     // It's a withing bar, so give it the within colour

                        }else{

                                colour[i] = dh;                                                                                         // It's a strong down bar, so give it the strong down colour

                        }

                }else{

                        colour[i] = dw;                                                                                                 // It's a weak down bar, so give it the weak down colour

                }

        }else{

                colour[i] = thesame;                                                                                    // the close is the same as the number of periods before

        }

}

Plot( Close, "Four Point", colour, styleBar);




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS




//////////////////////////////////////////////////////////
// Four Point
//////////////////////////////////////////////////////////

Periods = Param("Periods", 4, 2, 200, 1, 1 );
uh = ParamColor("Strong Up",colorBlue);
uw = ParamColor("Weak Up",colorLightBlue);
dh = ParamColor("Strong Down",colorRed);
dw = ParamColor("Weak Down",colorPink);
thesame = ParamColor("Sideways",colorGreen);
within = ParamColor("Within Bar",colorYellow);
background = ParamColor("Background Colour",colorLightGrey);

SetChartBkColor(background); 

for ( i = Periods+1; i < BarCount; i++ ) 							// we start calculations from 'Periods' bar. Previous bars are set to null
{ 

	// Going up

	if (Close[i] > Close[i-Periods]){								// the close is higher than number of periods before
		if(Close[i] > Open[i]){										// and the close is higher than the open
			if (High[i]<=High[i-1] AND Low[i]>=Low[i-1]){		    // but if it is a within bar
				colour[i] = within;											// It's a withing bar, so give it the within colour
			}else{	
				colour[i] = uh;												// It's a strong up bar, so give it the strong up colour
			}
		}else{
			colour[i] = uw;													// It's a weak up bar, so give it the weak up colour
		}
	
	// Going down

	}else if (Close[i] < Close[i-Periods]){							// the close is lower than number of periods before
		if(Close[i] < Open[i]){										// and the close is lower than the open
			if (High[i]<=High[i-1] AND Low[i]>=Low[i-1]){			// but if it is a within bar
				colour[i] = within;											// It's a withing bar, so give it the within colour
			}else{
				colour[i] = dh;												// It's a strong down bar, so give it the strong down colour
			}
		}else{
			colour[i] = dw;													// It's a weak down bar, so give it the weak down colour
		}
	}else{
		colour[i] = thesame;												// the close is the same as the number of periods before
	}

} 

Plot( Close, "Four Point", colour, styleBar);