- Katılım
- 23 Eki 2020
- Mesajlar
- 1,826
From: draggiedriver <draggiedriver[at]yahoo.com.au> To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com> Date: Thursday, October 13, 2005, 1:52:31 AM Subject: [EquisMetaStock Group] Normalising the 'Q' Files: <none> Hi everyone. Here's my story. I wanted to have a look at exit techniques; and I found Richard Dale's dll for an ATR-based exit - I love it: but Richard makes the point that the ATR multiplier varies according to one's outlook - 2.5 for the short-termers, 3.5 to 4 for us slower types. That got me thinking: what if one started out as a long-termer, but saw a good hard trend developing such that it would be prudent to take the profits off the table earlier. I had a look at perhaps using the Aroon oscillator as a factor to the ATR multiplier, but perhaps it's a little too coarse: that's where I joined the 'Q'. Plagiarising shamelessly from Jose's site, I saw how he normalised the MACD and came up with this: Driver's Q Oscillator {Plagiarised shamelessly from Jose Silva and David Sepiashvili} {Inputs} m:=Input("% Scalar trend period",1,25,4); n:=Input("% Scalar noise period",1,500,250); cf:=Input("% Scalar correction factor",1,250,2); p1:=Input("First moving average periods",1,200,7); p2:=Input("Second moving average periods",1,200,15); p3:=Input("Normalising periods, (1=none)", 1,2520,252); {Q Directional indicator - from Equis} rev:=Mov(C,p1,E)-Mov(C,p2,E); pds:=If(rev>0,1,-1); dc:=ROC(C,1,$); cpc:=If(pds<>Ref(pds,-1),0,(dc*pds)+PREV); trend:=If(pds<>Ref(pds,-1),0,(cpc*(1/m))+(PREV*(1-(1/m)))); dt:=cpc-trend; noise:=cf*Sqrt(Mov(dt*dt,n,S)); Q:=trend/noise; {Normalising} Qnorm:=(Q-LLV(Q,p3)/(HHV(Q,p3)-LLV(Q,p3)+.000001)*100); Qnorm; It's hopeless! and I have no idea where I went wrong. All I want is a bounded Q oscillator. (The B is no good for my purposes as I'm long only.) Puleeease? Newton said that he merely stood on the shoulders of giants; so I'm quite prepared to ask for a hand up. Many thanks in advance =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= From: Jose Silva <josesilva22[at]yahoo.com> To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com> Date: Thursday, October 13, 2005, 8:51:02 AM Subject: [EquisMetaStock Group] Re: Normalising the 'Q' Files: <none> DD, that's some story - I look forward to the film version... : ) The easiest way to normalize Q (or any plot), is this way: |
|
Driver's Q Oscillator {Plagiarised shamelessly from Jose Silva and David Sepiashvili} {Inputs} m:=Input("% Scalar trend period",1,25,4); n:=Input("% Scalar noise period",1,500,250); cf:=Input("% Scalar correction factor",1,250,2); p1:=Input("First moving average periods",1,200,7); p2:=Input("Second moving average periods",1,200,15); p3:=Input("Normalising periods, (1=none)", 1,2520,252); {Q Directional indicator - from Equis} rev:=Mov(C,p1,E)-Mov(C,p2,E); pds:=If(rev>0,1,-1); dc:=ROC(C,1,$); cpc:=If(pds<>Ref(pds,-1),0,(dc*pds)+PREV); trend:=If(pds<>Ref(pds,-1),0,(cpc*(1/m))+(PREV*(1-(1/m)))); dt:=cpc-trend; noise:=cf*Sqrt(Mov(dt*dt,n,S)); Q:=trend/noise; {Normalising} Qnorm:=(Q-Lowest(Q))/Max(Highest(Q)-Lowest(Q),.000001)*100; Qnorm |
The above code will produce a somewhat wild plot for the first 100~300 bars or so, as the normalizing code finds new plot value extremes. This will settle down to a Q-identical plot (0~100% bounded) after this initial period. You now, I've applied the above to the wife, and it works just great: ---8<-------------- Manic:=Highest(MoodSwings); Depressive:=Lowest(MoodSwings); MoodNormalized:=(MoodSwings-Depressive) /Max(Manic-Depressive,.000001)*100; MoodNormalized ---8<-------------- Warning: The above will produce a somewhat interesting time for the first year of marriage or so, as the normalizing code finds new mood extremes. jose '-) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= From: draggiedriver <draggiedriver[at]yahoo.com.au> To: equismetastock[at]yahoogroups.com <equismetastock[at]yahoogroups.com> Date: Thursday, October 13, 2005, 8:59:10 PM Subject: [EquisMetaStock Group] Re: Normalising the 'Q' Files: <none> Hi Jose Am working on the script now. I see it as a 'triumph over adversity' saga chronicling the adventures of a naive but determined novitiate to the black arts of TA. Have you pencilled in for a Yoda-type appearance as the Oracle. I liked your moodswing code, although I think you may have minimised the utimately random nature of the underlying function. 'Normal' may turn out to be an illogical premise. BTW, I got the code to work overnight - a misplaced ) don't you know! Cheers n Beers, and Thanks DD | |
| |
Source / From: |