We've set up a page illustrating an interesting technique that can turn many a traditional, fixed-period indicator into a dynamic, adaptive one -
with the help of the
Adaptive Lookback period finder (already available in Community.Indicators).
Size:
Color:
QUOTE:
With the fastSwing option enabled, it takes two consecutive bars before the swing point and just one after - for faster detection
CODE:
Please log in to see this code.
I think this code is necessary to alter the following:
CODE:
Please log in to see this code.
Here's the code to check
CODE:
Please log in to see this code.
Size:
Color:
I appreciate your suggestion Yury. However, I believe I've made a mistake in the documentation which should sound like this:
QUOTE:
(With the ''fastSwing'' option enabled, it takes just one bar before the swing point and just one after - for faster detection).
Thanks for the heads-up.
Size:
Color:
QUOTE:
(With the ''fastSwing'' option enabled, it takes just one bar before the swing point and just one after - for faster detection).
For such variant would be the code
CODE:
Please log in to see this code.
Size:
Color:
You're right, I stand corrected. The only difference in my version vs. yours is that my version can detect a swing high condition when two highs are equal, and a swing low when two lows are equal.
CODE:
Please log in to see this code.
I'm grateful to you for spotting the inconsistency. While your version is precise, but I also like how my rendition catches some swings missed by your formula.
Therefore for now, let's fix the documentation as follows:
QUOTE:
With the fastSwing option enabled, it takes two consecutive bars before the swing point and just one after - for faster detection. The high of the bar preceding a swing high or the low of the bar preceding a swing low can be equal to the swing bar's high/low, respectively.
I'll add a new parameter to the fast swing calculation (e.g. "preciseDetection") that will implement your version.
Thanks again.
Size:
Color:
I think that in this version it's all right.
Size:
Color:
Version 2013.01 of Community Indicators brings two optional overloaded method calls:
* Added new overload for
parameterless adaptive lookback. For more info see the
Wiki online reference.
* Added new overload for precise swing detection to accompany the "fastSwing" constructor (thanks Yuriy)
Size:
Color:
In summary I need the volatility to trade every day but with short ( say 5 days up or or down trends) my strategy does not enter or cannot exit.
QUOTE:
This makes the variable lookback period grow in calm or trending markets, and shorten in range-bound and volatile markets. For a trend-following system you would like the opposite to prevent being whipsawed, therefore this indicator is more suitable for short-term traders and counter-trend systems.
Does this mean that if I'm short term (every day) /counter-trend trader and the markets trends for a few days, that I would remain in the trend longer after an entry for a higher exit price? Normally in a short uptrend my system doesn't enter because I must get a good down day.
What about te reverse of above, the lookback is longer if short down trends occur after an entry, and my strategy cannot exit quickly.
QUOTE:
This example illustrates how to construct and plot the "traditional" Adaptive RSI indicator. The lookback period is based on the Adaptive Lookback readings. This technique can be easily applied to other indicators such as price channels and oscillators.
How about an example of a price channels breakout strategy?...and some entry and exit rules would make it testable.
BTW Should your code in the Wiki example produce the curves shown?...I don't get curves only errors.
Size:
Color:
QUOTE:
How about an example of a price channels breakout strategy?...and some entry and exit rules would make it testable.
There is a bands strategy published in Active Trader Magazine. You can find it among the uploaded strategies.
QUOTE:
BTW Should your code in the Wiki example produce the curves shown?...I don't get curves only errors.
Undoubtedly the sample code works. If you need assistance, be specific regarding the error messages.
Size:
Color:
QUOTE:
"Undoubtedly the sample code works. If you need assistance, be specific regarding the error messages."
It is working now thanks.
I woul like to test one of my strategies using this parameterless lookback but I have no idea on how to integrate the two. That is why I have asked the questions in my previous post...it seems too slow to react/adapt considering that I only have EOD price feeds for backtesting.
A helping hand would be appreciated if and when you have time.
Size:
Color:
As you could have read on the Wiki page, it was not meant for "integrating into a strategy". The purpose is to make an indicator adaptive. So, if your strategy has an indicator that seems slow to react and might benefit from making it adaptive, then the code examples there are precisely to illustrate how would one integrate Adaptive Lookback into a traditional indicator's formula like RSI.
This also applies to the example of a price channel breakout strategy you requested above. You'll have to do some basic howework to get it done. Price channels are constructed using Highest and Lowest. Again, see the Wiki for their syntax and usage examples. On how to work with
DataSeries, please re-read the WealthScript Programming Guide > DataSeries. Hope that helps.
Size:
Color:
Size:
Color:
This is a reasonable objective. Here's the code:
CODE:
Please log in to see this code.
Below is an example of price channels made adaptive:
CODE:
Please log in to see this code.
P.S. One thing to keep in mind that the adaptive lookback typically 'oscillates' from 2 to 20. It wasn't meant for trading longer-term systems.
Size:
Color:
Thanks for all the assistance. I haven't studied the codes above...I'll do that ASAP.
My first problem re the topic before I proceed. Can the code/ indicator I have in mind benefit from and be modified with the Adaptive Lookback? I obviously lack insight. Theoretically it should be possible...I think. Herewith my code.
CODE:
Please log in to see this code.
Size:
Color:
Take a careful look at my code posted earlier today, and don't hesitate playing with the examples and modifying them. The concept is so simple and well illustrated, so I don't see any reason for lack of insight.
Size:
Color:
Thanks, you have answered my last question before I have asked it... when you offered the example codes.
Sorry for the long delay. I'll be back as soon as possible..
Size:
Color: