After some struggling Amibroker I was able to create the translation for the MSR indicator introduced by David Varadi. The code uses the QDMedian3() function for Amibroker, that can be download here.
During the weekend I will post the system analysis for my ETF’s based on the MSR system.
- QD -
MSR Indicator Code
#include<Additional functions.afl>
Period1=10;
Period2=20;
Period3=252;
MaxH=HHV(H,period2);MaxL=HHV(L,period2);MaxC=HHV(C,period2);
Max3=Max(Max(MaxH,MaxL),MaxC);
MSR=(QDMedian3(H,L,C,period1)-Max3)/Max3;
rank=percentrank(MSR,252);
Plot(rank, "PercentRank(MSR("+NumToStr(Period1,1.0)+","+NumToStr(Period2,1.0)+"),"+NumToStr(Period3,1.0)+")",colorBlue);
With the QDMedian code, this is a great contribution. Thanks!
One possible improvement (I might have this wrong as I am not an AB user): since for any day H C and L are partially ordered (H >= C >= L), Max(H, C, L) is the same as H, and the same is true over a period, so in your code Max3 = HHV(H, period2), and there is no need to calculate the highest C and highest L.
Thanks again.
Hi Toptick, you are absolutely right! It was late when I was coding this so I guess I was too focused on exact translation and no optimization:-)
Will adjust this in the my personal files.
Tks for your contribution
QD
I’m new to the #include call. I think I’m suppose to point it to the dll plugin??? If that’s correct, I keep getting a syntax error on that line. Can some one please give me some clarity on this part of the code?
Thanks! mike
Mike, #include call points towards an other amibroker formula file. This is a specific file containing additional functions and it is used to avoid writing the same functions over and over in each new strategy. Look into Amibroker helpfile for more information.
QD
Thanks. I get the call, but I did a search in Ami help on my c drive and google for the file Additional functions.afl. The hits I got were your blog. I am guessing this file and boiler plate are your personal creation?
Am I way out in left field?
Can I impose a little more and ask for further assistance?
I don’t know how to make AB see this file, line as it is posted errors out for me.
I downloaded the VC++ 2005 libraries too.
Thanks for your patience.
mike
DO you still intend to post the MSR with various ETF’s system?
Hi Aristotle, yes I still plan to write a post about that. Last days have been occupied by finding a solution for the dll problem some of the readers were facing.
QD