Discussions
»
Product and Service Development
»
Formula Assistance
»
Help for Exploration of ATR Trading Bands by Chande
Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 5/1/2009(UTC) Posts: 2
|
Hello: I am trying to create a couple of Explorations for the following formula:
ADJUSTABLE TRADING BANDS by TUSHAR CHANDE
{Upper Band}
Prd1a:=Input("ATR Period",5,20,5);
Prd2a:=Input("Period for Highest High Value",5,20,10);
(HHV(LLV(L,Prd1a)+ATR(Prd1a),Prd2a));
{Lower Band}
Prd2b:=Input("Period for Lowest Low Value",5,20,10);
(LLV(HHV(H,Prd1a)-ATR(Prd1a),Prd2b));
One exploration would return stocks that have moved from below the lower band to above the lower band. Possible start of uptrend.
The other exploration would return stocks that have moved from below the upper band to above the upper band. Possible continuation of uptrend.
I have been able to create an Expert Advisor symbol that shows when these situations occur but get erroneous results when I try and run the Explorer using the same criteria.
The other solution I have tried but am unable to do is create two separate indicators. One for the lower band and one for the upper band. The ATR period I am using is 6 with a HHV and LLV look back period of 18.
Thanks for any help,
Dave
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi Dave
Stop using the Minimum Records setting for the Explorer and set to somewhere in the range of 100 up to the number of bars you load for each chart.
Here's a list of functions that require 5 to 10 times as much data than is suggested by the Periods parameter of the affected function. If you use Minimum records incorrect results are a certainty. This list is not complete (and probably includes a couple of innocents) but it indicates the extent of the problem.
ADX
ADXI
ADXR
ATR
BBANDTOP EA method
BBANDBOT EA method
BUYP
DEMA
DI
DMI
INERTIA
MACD
MASS
MDI
MOV E method
MOV VAR method
PDI
QSTICK
RMI
RSI
RVI
SELLP
STOCH EMA smoothing
TEMA
TRIX
VOL
WILDERS
Roy
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 5/1/2009(UTC) Posts: 2
|
Hi Roy
Thank you for the reply. I did not have the minimum number of records set but I did increase the number of records to load. Seems to have done the trick.
Thanks again
Dave
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 5/13/2005(UTC) Posts: 715 Location: Midwest, USA
Was thanked: 1 time(s) in 1 post(s)
|
Roy,
If accuracy was always paramount, would it be best to just set records to, say, 10,000 and leave it there?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi Johnathan
Loading way more bars than are needed could slow execution times excessively and possibly isn't the best option. A general setting of somewhere between 200 to 500 bars would probably give sufficient accuracy in most situations. Obviously code with a 200 day EMA would be more accurate with say 1000 bars.
Many MS functions force about 1.3 times the highest Periods parameter number of bars to load with the Minimum Records setting, and they work fine like that. What many (usually newer) users don't understand is that exponential MAs use ALL available data to generate a result, not just the bare minimun number as set by the Periods parameter.
You'll know this but Dave and others might not - the explorer calculates code results in exactly the same ways as a chart, and given the same amount of data it will come up with exactly the same result. All that's different is that only the last-bar value is reported by an exploration, and the calculation result isn't as accessable for other bars as it is with a chart.
Roy
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Discussions
»
Product and Service Development
»
Formula Assistance
»
Help for Exploration of ATR Trading Bands by Chande
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.