logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Frenkys  
#1 Posted : Saturday, April 14, 2012 11:01:04 AM(UTC)
Frenkys

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/4/2010(UTC)
Posts: 12

I'm looking for the 'indicator as in the subject, does anyone know where I can find it? you see a little sick, but this is as it should be the 'indicator, red or yellow are the same thing, have only the difference of periods. I tried to build it but it's really hard for me .... thanks
wabbit  
#2 Posted : Monday, April 16, 2012 7:21:29 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Which indicator do you have plotted on the MT4 chart?


wabbit [:D]


Frenkys  
#3 Posted : Tuesday, April 17, 2012 1:49:40 PM(UTC)
Frenkys

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/4/2010(UTC)
Posts: 12

Hi Wabbit, The name of the indicator is Polynomial Regression Channel. A linear regression indicator draws a straight line of best fit on a chart. The PRC indicator applies a polynomial function to the linear regression function to adapt itself to the flow of market prices. Since they are regression bands that self adjust for volatility. This indicator is used to fade the direction of the market. The basic trading strategy is to buy when the price enters the lower band region or sell when the price hits the upper band. Traders will take profits at the middle band but an aggressive trader might hold out and expect the market to hit the other band. I would use the 'indicator to follow stock market cycles in the graph that I posted above you can see one that follows the annual cycle (the red one), l' else that follows the intermediate cycle (yellow one), is very interesting as the 'indicator held in a timely manner when a cycle reverses its direction. I want this indicator for Metastock are not very good at programming but I can do something ,,,,, I have the formula in the language of metatrader, but I do not know this language. The formula is as follows: //+------------------------------------------------------------------+ //| My Canale di Regressione Lineare.mq4 | //| Copyright © 2012, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ //---- #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Gray #property indicator_color2 Crimson #property indicator_color3 Crimson extern int degree = 3; extern double kstd = 2.0; extern int bars = 96; extern int shift = 0; //----- double fx[],sqh[],sql[]; double ai[10,10],b[10],x[10],sx[20]; double sum; int ip,p,n,f; double qq,mm,tt; int ii,jj,kk,ll,nn; double sq; int i0 = 0; /* void clear() { int total = ObjectsTotal(); for (int i=total-1; i >= 0; i--) { string name = ObjectName(i); if (StringFind(name, prefix) == 0) ObjectDelete(name); } } */ //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { SetIndexBuffer(0, fx); // Áóôåðû ìàññèâîâ èíäèêàòîðà SetIndexBuffer(1, sqh); SetIndexBuffer(2, sql); SetIndexStyle(0, DRAW_LINE); SetIndexStyle(1, DRAW_LINE); SetIndexStyle(2, DRAW_LINE); SetIndexEmptyValue(0, 0.0); SetIndexEmptyValue(1, 0.0); SetIndexEmptyValue(2, 0.0); SetIndexShift(0, shift); SetIndexShift(1, shift); SetIndexShift(2, shift); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //clear(); return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { if (Bars < bars) return; //---- int mi; // ïåðåìåííàÿ èñïîëüçóþùàÿñÿ òîëüêî â start ip = bars; p=ip; // òèïà ïðèñâàèâàíèå sx[1]=p+1; // ïðèìå÷àíèå - [] - îçíà÷àåò ìàññèâ nn = degree+1; SetIndexDrawBegin(0, Bars-p-1); SetIndexDrawBegin(1, Bars-p-1); SetIndexDrawBegin(2, Bars-p-1); //----------------------sx------------------------------------------------------------------- for(mi=1;mi<=nn*2-2;mi++) // ìàòåìàòè÷åñêîå âûðàæåíèå - äëÿ âñåõ mi îò 1 äî nn*2-2 { sum=0; for(n=i0;n<=i0+p;n++) { sum+=MathPow(n,mi); } sx[mi+1]=sum; } //----------------------syx----------- for(mi=1;mi<=nn;mi++) { sum=0.00000; for(n=i0;n<=i0+p;n++) { if(mi==1) sum+=Close[ n ]; else sum+=Close[ n ]*MathPow(n,mi-1); } b[mi]=sum; } //===============Matrix======================================================================================================= for(jj=1;jj<=nn;jj++) { for(ii=1; ii<=nn; ii++) { kk=ii+jj-1; ai[ii,jj]=sx[kk]; } } //===============Gauss======================================================================================================== for(kk=1; kk<=nn-1; kk++) { ll=0; mm=0; for(ii=kk; ii<=nn; ii++) { if(MathAbs(ai[ii,kk])>mm) { mm=MathAbs(ai[ii,kk]); ll=ii; } } if(ll==0) return(0); if (ll!=kk) { for(jj=1; jj<=nn; jj++) { tt=ai[kk,jj]; ai[kk,jj]=ai[ll,jj]; ai[ll,jj]=tt; } tt=b[kk]; b[kk]=b[ll]; b[ll]=tt; } for(ii=kk+1;ii<=nn;ii++) { qq=ai[ii,kk]/ai[kk,kk]; for(jj=1;jj<=nn;jj++) { if(jj==kk) ai[ii,jj]=0; else ai[ii,jj]=ai[ii,jj]-qq*ai[kk,jj]; } b[ii]=b[ii]-qq*b[kk]; } } x[nn]=b[nn]/ai[nn,nn]; for(ii=nn-1;ii>=1;ii--) { tt=0; for(jj=1;jj<=nn-ii;jj++) { tt=tt+ai[ii,ii+jj]*x[ii+jj]; x[ii]=(1/ai[ii,ii])*(b[ii]-tt); } } //=========================================================================================================================== for(n=i0;n<=i0+p;n++) { sum=0; for(kk=1;kk<=degree;kk++) { sum+=x[kk+1]*MathPow(n,kk); } fx[ n ]=x[1]+sum; } //-----------------------------------Std----------------------------------------------------------------------------------- sq=0.0; for(n=i0;n<=i0+p;n++) { sq+=MathPow(Close[ n ]-fx[ n ],2); } sq=MathSqrt(sq/(p+1))*kstd; for(n=i0;n<=i0+p;n++) { sqh[ n ]=fx[ n ]+sq; sql[ n ]=fx[ n ]-sq; } return(0); } //+------------------------------------------------------------------+ You can help me?????????? I hope we can build this indicator for metastock ... In this link you can find information on indicator: http://www.mypivots.com/...regression-channel-bands
wabbit  
#4 Posted : Tuesday, April 17, 2012 5:48:12 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
The indicator code which you have posted repaints, in other words, it's no good for real life trading! (Although there will be thousands of people trying to get it to). These indicators are the ultimate curve-fitters (over-optimisers). If your channel length is, say, 250 bars then as new bars are added to the chart the channel will be recomputed for the new set of 250 bars and signals generated in history. In order to generate tradable signals, once you have applied the indicator to the chart you need to leave the channels where they are and have them recompute only the current bar without refitting for the historical past. Once you have the code to do that, then you will quickly see these channels are mostly bumph.

Now to the issue of code writing: The code as it stands cannot be achieved in MS formula language because it requires loops to solve the matrix (and MSFL cannot loop), so you'll either need to find another way to solve the matrix or have the code written outside of MS and then made available as a DLL function to MS.

Whilst you're having the code written, instead of blindly following along with what others have done, IF -REPEAT- IF I were going to use the channel premise for trading, I'd be looking for something slightly different, namely; draw a channel fixed between specified bars, with the channel width representing a 90% or 95% confidence interval, then as each new bar of information arrives have the channel continue plotting using the same polynomial values, i.e. the channel length in bars will grow as new bars are added. This will give you a fighting chance at obtaining tradable signals at the bleeding right hand side of the chart instead of new signals being generated in history.



wabbit [:D]

Frenkys  
#5 Posted : Wednesday, April 18, 2012 2:56:24 PM(UTC)
Frenkys

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/4/2010(UTC)
Posts: 12

I do not know Wabbit, the calculation of the bars every time you add new could make me comfortable for the 'cycle analysis of long, medium and short term. Do not use the 'indicator for signals of buy or sale, but to understand when it ends or changes direction a cycle. However if it is not possible to program the code for me it doesn't have a lot of importance if something similar can be made, but that you are recommending me seem similar to the bands of bollinger with two standard devaizionis, or I are being wrong me? Do you know where I can find the code of an indicator similar to that? you can do a similar code even more simple? Excuse but I don't speak very well English / American Thanks
wabbit  
#6 Posted : Wednesday, April 18, 2012 7:11:13 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
You could try using Bollinger Bands, Keltner Bands or just about any other sort of channel; just make sure that whatever you use that it can be traded in real life and doesn't use historical hindsight or the unknowable future.



wabbit [:D]

Frenkys  
#7 Posted : Thursday, April 19, 2012 1:56:19 PM(UTC)
Frenkys

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/4/2010(UTC)
Posts: 12

Hi Wabbit, my analysis with the 'indicator PRC are based on time and not on price, the price indicators that work there are many including Bollinger Bands, the Keltner, Envelope ........ Thank you for your assistance in the short will make you an 'other question.
Derek Worswick  
#8 Posted : Sunday, April 22, 2012 6:04:55 AM(UTC)
Derek Worswick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 8/11/2005(UTC)
Posts: 104

Hi Frenkys Please read Private message in your Inbox Derek
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.