4xmeter Posted January 31, 2010 Report Share Posted January 31, 2010 You have to draw a trendline of your swing Price movement that you are measuring; and write down the number of the trendline that is given when you place you mouse over it in the input of the indicator under Index TrendLine _______.  I can not qualify the performance of this indicator, as of today; however, it is in the right direction for (Sharpeyes 8-) )! Could some one make it more user friendly! Please!  //+------------------------------------------------------------------+ //| TrendLineRange.mq4 | //| Ñîêðà òèëèà Àëåêñåé | //| [email protected] | //+------------------------------------------------------------------+ #property copyright "Ñîêðà òèëèà Àëåêñåé" #property link "[email protected]" #property indicator_chart_window //---- input parameters extern int PointsRange1=20; //1-îå ðà ññòîÿÃèå äî òðåÃäîâîé ëèÃèè extern int PointsRange2=10; //2-îå ðà ññòîÿÃèå äî òðåÃäîâîé ëèÃèè extern int PointsRange3=5; //3-åå ðà ññòîÿÃèå äî òðåÃäîâîé ëèÃèè extern string IndexTrendLine; //ÈÃäåêñ òðåÃäîâîé ëèÃèè â ñïèñêå îáúåêòîâ //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { static int S1,S2,S3; //Ñ÷åò÷èêè ñèãÃà ëîâ string TrendLine="Trendline "+IndexTrendLine; //Äîáà âëåÃèå èÃäåêñà òåÃäîâîé ëèÃèè ê "Trendline" double Price=Bid; //Òåêóùà ÿ öåÃà double TrendLineValue=NormalizeDouble(ObjectGetValueByShift(TrendLine,0),Digits); //Òåêóùåå çÃà ÷åÃèå òðåÃäîâîé ëèÃèè int Range=MathAbs((NormalizeDouble(Price,Digits)-TrendLineValue)*MathPow(10,Digits)); //Âû÷èñëåÃèå ðà ññòîÿÃèÿ ìåæäó òåêóùåé öåÃîé è òðåÃäîâîé ëèÃèåé Comment("Range=",Range); if (Range<=PointsRange1 && Range>PointsRange2 && S1==0) //Åñëè òåêóùåå ðà ñññòîÿÃèå <= ðà ññòîÿÃèÿ1 è > ðà ññòîÿÃèÿ2 { //ñèãÃà ë Ãà ýòîì ïðîìåæóòêå ÃÃ¥ ïîäà âà ëñÿ, òî ïîäà åì îäèà ñèãÃà ë. Alert("Range=",Range," Price=",Price," TrendLine=",TrendLineValue); S1=1; S2=0; S3=0; //ÎáÃóëåÃèå ñ÷åò÷èêîâ } else if (Range<=PointsRange2 && Range>PointsRange3 && S2==0) //Åñëè òåêóùåå ðà ñññòîÿÃèå <= ðà ññòîÿÃèÿ2 è > ðà ññòîÿÃèÿ3 { //ñèãÃà ë Ãà ýòîì ïðîìåæóòêå ÃÃ¥ ïîäà âà ëñÿ, òî ïîäà åì îäèà ñèãÃà ë. Alert("Range=", Range, " Price=", Price, " TrendLine=",TrendLineValue); S1=0; S2=1; S3=0; //ÎáÃóëåÃèå ñ÷åò÷èêîâ } else if (Range<=PointsRange3 && S3==0) //Åñëè òåêóùåå ðà ñññòîÿÃèå <= ðà ññòîÿÃèÿ3 { //ñèãÃà ë Ãà ýòîì ïðîìåæóòêå ÃÃ¥ ïîäà âà ëñÿ, òî ïîäà åì îäèà ñèãÃà ë. Alert("Range=", Range, " Price=", Price, " TrendLine=",TrendLineValue); S1=0; S2=0; S3=1; //ÎáÃóëåÃèå ñ÷åò÷èêîâ }  return(0); } //+------------------------------------------------------------------+ Quote Link to comment Share on other sites More sharing options...
4xmeter Posted January 31, 2010 Author Report Share Posted January 31, 2010 Re: TrendlineRange Indicator Here are the instructions by the Author. The matter of the indicator is as follows: when the price approaches to the support/resistance line by 20, 10 and 5 points (these are default values that can be changed by desire), the indicator will produce one signal (Alert) if the price is located in the spaces before the trend line (20<=Price<10), (10<=Price<5), (5<=Price=0), but doesn't bury the user with signals at every tick. The only thing is that the indicator will produce several signals when the price moves from one space into another. It also shows the current distance from the price to the support/resistance line in the upper left corner (Comment).  The following is contained by the signal: Range - distance from the price to the support/resistance line; Price - current price; TrendLine - current location of the support/resistance line. The following must be introduced in settings: PointsRange1 - the first (largest) distance to the trend line, at which the signal will be produced; PointsRange2 - the second (medium) distance to the trend line, at which the signal will be produced; PointsRange3 - the third (small) distance to the trend line, at which the signal will be produced; IndexTrendLine - index, exactly the index of the trend line, which you can see in the list of objects. The values of distances 1, 2 and 3 must be introduced in decreasing order!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.