Need help with financial back testing
이전 댓글 표시
So I'm trying to back test a strategy using bollinger bands.
I want the short signal to be whenever the high of a day is above the upper band, and I want the exit(buy) signal to be when the low penetrates the middle band. The thing I could think of was this:
s(TestHigh>UPPER)=-1
Where: S= Signal (-1 is short, 1 is long)
TestHigh = High of my data
UPPER = Upper Bollinger Band
But all that does is short whenever the high is above the upper band. So now I really don't know what to do (I just started programming, so I'm very inexperienced).
Any help is appreciated!
댓글 수: 1
Sanjeev
2012년 7월 1일
at any point in time you will not know what the high of the day is. you need to write the strategy for the bck test as if you were walking forward in real time.
you should be generating a signal on closes not highs
even if you are using intra day data you should use the close of the 1min bar, hourly bar or whatever, i hope that helps.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Financial Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!