logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
pantarhei  
#1 Posted : Wednesday, February 20, 2019 10:43:56 PM(UTC)
pantarhei

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 2/17/2019(UTC)
Posts: 2
Location: Vienna

Was thanked: 1 time(s) in 1 post(s)

Good Day,

I am trying to build a custom indicator using the Adaptive Cycle Toolkit.

I would like to derive the Cybernetic Cycle Period of an instrument and then use that to calculate the Upper and Lower Bollinger Band using the available "ASIBBandBot" and "ASIBBandTop" functions, and then use that to calculate the Adaptive PercentB Indicator:

Code:
pr:=C;

periods:=ExtFml("ADSI.CyclePeriod", pr, 0.28, 0.10, 1.05);

lower:=ExtFml("ASI.BBandBot",pr,periods/2, 1);

upper:=ExtFml("ASI.BBandTop",pr,periods/2, 1);

percb:=( C-lower)/( upper-lower)*100;

percb;

When I insert this indicator into a chart, I am getting the following error message:

"The following math errors occured during the calculation of _DML_ADSI_BPercent Division by zero: 46"

'_DML_ADSI_BPercent' is the name I chose for this custom indicator.

The strange thing is, that the indicator is still drawn. However I am not able to use this formula for example to build a System Test, as it gives me the same error:

"The following runtime errors were encountered while executing the Buy Signal formula: 46 Divide By Zero Errors"

Furthermore, the same formula works, if I instead derive the Homodyne Cycle period and use it to calculate the Upper and Lower Bollinger Band and then the PercentB Indicator:

Code:
pr:=C;

periods:=ExtFml("ADSI.HomodyneCyclePeriod", pr);

lower:=ExtFml("ASI.BBandBot",pr,periods/2, 1);

upper:=ExtFml("ASI.BBandTop",pr,periods/2, 1);

percb:=( C-lower)/( upper-lower)*100;

percb;

This creates no 'Divide by Zero' errors.

Any help would be much appreciated.

Has anybody else tried to build custom indicators using the Adaptive Cycle Toolkit so far?

I would also be interested in a more extensive Fomular Guide with explanations of the various functions and custom indicators available in the Adaptive Cycle Toolkit. I have downloaded the "ACT Summary Manual" and the "ACT Formula Primer", however that is only a very short Guide of just 8 pages with some minimal examples, and "ACT Summary Manual" mentions a more extensive "ASI and ADSI Manual" which should be available?

Kind regards, Michael

Edited by user Wednesday, February 20, 2019 10:54:36 PM(UTC)  | Reason: Not specified

MS Support  
#2 Posted : Thursday, February 21, 2019 7:06:53 PM(UTC)
MS Support

Rank: Advanced Member

Groups: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Posts: 1,960

Thanks: 92 times
Was thanked: 155 time(s) in 150 post(s)

Hello,

I believe the additional manual references were ultimately added to the Help file. Check out the following sections in the F1 MetaStock Help (assuming you have MetaStock 16) to see if they provide you with additional information:

Home > More Systems and Tools > Adaptive Cycle Toolkit (ACT) > Formula Building with ASI

Home > More Systems and Tools > Adaptive Cycle Toolkit (ACT) > Analyzing the Market with ASI & ADSI

As for the divide by zero errors, if you break down the individual elements of the formula, the problem occurs at the beginning of the price chart where there is likely a wind-up period for the minimum number of data points required (46 in this case). When you look at the plots individually, you will see that the indicator starts plotting after the first 46 bars of the chart. When you mathematically combine these outputs, it appears to change this to a 0 value and hence the divide by zero errors.

This doesn't necessarily indicate a problem with the indicators over the full chart, but just that you are deriving no values at the beginning of the chart. Sometimes there are ways to avoid these divide by zero errors by substituting some other output for the 0 output (i.e. using an IF statement to change a 0 value to 0.1 or some other non-zero value).

pantarhei  
#3 Posted : Friday, February 22, 2019 12:01:49 AM(UTC)
pantarhei

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 2/17/2019(UTC)
Posts: 2
Location: Vienna

Was thanked: 1 time(s) in 1 post(s)

Thanks, that makes sense!

Yes, I can see now how the indicator zero's out during the first 46 bars and then starts plotting. I just didn't bother to scroll back far enough in my chart :-p

Now, if I want to use this indicator in a system test, I can of course do what you suggest and just manually set it to a non zero value if the calculations for the upper and lower bollinger bands return zero. In addition, I would need to make sure that if I want to use certain values of the BPercent indicator to derive buy or sell conditions, that this value is excluded there.

Alternatively, would there be another easy way to tell the buy, sell, etc. conditions in a system test that it should just skip the first XYZ number of bars (46 in tis case)?

Thanks also for pointing me to the Help file. Yes, I have Metastock 16 and found the relevant sections there. Finally I can find more information about all these indicators added with the Adaptive Cycle Toolkit in Metastock 16, great!

Kind regards, Michael

thanks 1 user thanked pantarhei for this useful post.
MS Support on 2/22/2019(UTC)
Users browsing this topic
Guest (Hidden)
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.