Registered User Joined: 12/24/2004 Posts: 12

I am reading the book "Trading Using DiNapoli Levels". In this book, the stochastics is calculated in the following way: %K (of the slow stochastic) = %D (of the fast stochastic) %D (of the slow stochastic) = 3 period MAV of %K (of the slow stochastic) where MAV = MAV(t1) + ((P  MAV(t1))/n, where: MAV is the current modified Moving Average value MAV(t1) is the previous modified Moving Average value P is the current price n is the number of periods Basically, instead of smoothing the %K and %D lines using simple or exponential moving averages, the book recommends smoothing using the modified moving averages (MAV) as defined above. According to the TC2000 helpfile, the moving average used to smooth the %K and %D in "Stochastics" is the simple moving average. Can you let me know how I can go about "modify or customize" this to smooth using the MAV (as defined above)? Thank you.


Worden Trainer
Joined: 10/7/2004 Posts: 62,474

TeleChart's Stochastic indicator is a Full Stochastic that takes three parameters (Period, SK, SD) and outputs two lines (SK, SD). Full Stochastics can be used to reproduce both Fast and Slow Stochastics.
Full Stochastic (8,1,3) = Fast Stochastic (8,3) Full Stochastic (8,3,3) = Slow Stochastic (8,3)
The Modified Moving Average Value appears to be the same as Wilder's Smoothing (which has been discussed fairly extensively in the forums). To adjust Wilder's Smoothing to Exponential, you need to multiply it by two and substract one. A 27Period Exponential Smoothing is the same as a 14Period Wilder's Smoothing. You can use this method to adjust the Moving Average periods when plotting Stochastics on the charts. It's not clear to me from your description if you would use an Exponential Stochastic (8,3,5) or an Exponential Stochastic (8,5,5) to create a DiNapoli Stochastic (8,3). The first seems consistent with the initial description that only mentions MAV once while the second is consistent with the claim that the %K and %D lines both use MAV.
The STOC function in the Personal Criteria Formula Language uses Simple Moving Averages. The SK value of an Exponential Stochastic can be created determined using the XAVG() function, but the SD value requires an expansion of the second Exponential Moving Average. You may wish to review the following:
Understanding Stochastics Exponential moving averages of formulas in pcfs Stochastic %K < %D Stochastics crossing MA moving up
I tried to choose topics that I thought would provide some insight on how this could be accomplished, but there are a lot more topics that can be found using a search:
Learn how to use the forums: post a new topic, reply, Search existing topics
If you provide the settings of the charted Stochastic that most accurately represent the DiNapoli Stochastic of interest, I should be able to write a Personal Criteria Formula that would return the values of interest:
 Period: ?  SK Period: ?  SD Period: ?  Average Type: (Probably Exponential)
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 12/24/2004 Posts: 12

Thanks Bruce for the prompt response. Sorry for the html distorting my post above.
Basically, DiNapoli seems to use the following calculations:
LANE (RAW) STOCHASTIC:
%K = 100 * [(CLn) / (HnLn)] where: C is the latest close Ln is the lowest low for the last n days Hn is the highst high for the last n days
FAST STOCHASTICS: %D = 3 period MAV (not simple, not exponential) of %K
This is what I'm looking to setup in Telechart:
SLOW (PREFERRED STOCHASTICS): %K (of the slow stochastic) = %D (of the fast stochastic) %D (of the slow stochastic) = 3 period MAV of %K (of the slow stochastic)
where MAVt = MAV(t1) + ((Pt  MAV(t1))/n, where:
MAVt is the current modified Moving Average value MAV(t1) is the previous modified Moving Average value Pt is the current price n is the number of periods
So I'm not looking for exponential or simple smoothing. I need to smooth the %K using the 3 period MAV defined above to get %D.
The periods are: 1. 8 periods for consideration 2. 3 periods or smoothing the fast line 3. 3 periods for smoothing the slow line 4. "MAV" for the type of Moving Average to accomplish the desired smoothing.
Hope this clarifies. Thanks in advance for your help.


Worden Trainer
Joined: 10/7/2004 Posts: 62,474

Here's how you would plot a DiNapoli Slow Stochastic (8,3) in TeleChart:
Select Chart Template  Add Indicator  Stochastics.  Period: 8  SK Period: 5  SD Period: 5  Average Type: Exponential
If you need to use the DiNapoli Slow Stochastic (8,3) as a sort or EasyScan condition, you may use the following Personal Criteria Formulas:
Raw DiNapoli Stochastic 8 (Fast SK):
STOC8.1
Slow DiNapoli Stochastic (8,3) SK:
XAVG(STOC8.1,5)
Slow DiNapoli Stochastic (8,3) SD:
.333559032545198 * (XAVG(STOC8.1,5) + 4 / 6 * (XAVG(STOC8.1.1,5) + 4 / 6 * (XAVG(STOC8.1.2,5) + 4 / 6 * (XAVG(STOC8.1.3,5) + 4 / 6 * (XAVG(STOC8.1.4,5) + 4 / 6 * (XAVG(STOC8.1.5,5) + 4 / 6 * (XAVG(STOC8.1.6,5) + 4 / 6 * (XAVG(STOC8.1.7,5) + 4 / 6 * (XAVG(STOC8.1.8,5) + 4 / 6 * (XAVG(STOC8.1.9,5) + 4 / 6 * (XAVG(STOC8.1.10,5) + 4 / 6 * (XAVG(STOC8.1.11,5) + 4 / 6 * (XAVG(STOC8.1.12,5) + 4 / 6 * (XAVG(STOC8.1.13,5) + 4 / 6 * (XAVG(STOC8.1.14,5) + 4 / 6 * (XAVG(STOC8.1.15,5) + 4 / 6 * (XAVG(STOC8.1.16,5) + 4 / 6 * (XAVG(STOC8.1.17,5)))))))))))))))))))
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 12/24/2004 Posts: 12

thanks, Bruce..


Worden Trainer
Joined: 10/7/2004 Posts: 62,474

You're welcome.
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 3/23/2006 Posts: 5

Hello, Im trying to create DiNapoli Stochastics on TC as an indicator simply but creating the %K and %D separately. After looking at the above solution why are you using a 5day average when the stochastic is based on a 8 day stochastic with a 3 day average?
Also since %K (of the slow stochastic) = %D (of the fast stochastic) and %D (of the fast stochastic) = 3 period Modified Moving Average (not simple, not exponential) of %K can you explain XAVG(STOC8.1,5) as your solution?
I'm a bit confused?


Worden Trainer
Joined: 10/7/2004 Posts: 62,474

QUOTE (lastchance) After looking at the above solution why are you using a 5day average when the stochastic is based on a 8 day stochastic with a 3 day average? If I'm understanding it correctly (which isn't guaranteed), the Modified Moving Average used in DiNapoli Stochastics actually is a type of Exponential Moving Average that just uses a different ratio between terms for any given period. This allows the use of TeleChart's built in Exponential Moving Average functions by multiplying the DiNapoli period by two and subtracting one (as explained above).
QUOTE (lastchance) Also since %K (of the slow stochastic) = %D (of the fast stochastic) and %D (of the fast stochastic) = 3 period Modified Moving Average (not simple, not exponential) of %K can you explain XAVG(STOC8.1,5) as your solution? In a Fast Stochastic, the %K is simply the Raw Stochastic. In a Fast Stochastic, the %D is a Moving Average of the Raw Stochastic. In a Slow Stochastic, the %K is a Moving Average of the Raw Stochastic. In a Slow Stochastic, the %D is a Moving Average of a Moving Average of the Raw Stochastic. A period of 5 is used because it is (2 * 3)  1.
QUOTE (lastchance) Im trying to create DiNapoli Stochastics on TC as an indicator simply but creating the %K and %D separately. I need to warn you against creating the Slow DiNapoli Stochastic SK and Slow DiNapoli Stochastic SD as separate Custom Indicators. They will plot on their own independent scales. You should create a Custom Indicator for the Slow DiNapoli Stochastic SK and add a Moving Average as a Child Indicator to create the Slow DiNapoli Stochastic SD instead. Is there a reason you don't want to use the built in Stochastics Indicator?
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 3/23/2006 Posts: 5

Thanks bruce for the explanation. I believe the built in stochastic uses a simply moving average instead of the modified version as you outlined.
Thanks also for the tip about creating the custom indicator using a child indicator. I didn't know you can have a parent/child relationship with the indicators.


Worden Trainer
Joined: 10/7/2004 Posts: 62,474

The built in Stochastic Indicator uses either a Simple or Exponential Moving Average depending on which option is selected (and so does a DiNapoli Modified Moving Average when using the Exponential option and modifying the period as described).
The built in Personal Criteria Formula function for Stochastics is Simple, but the Exponential version can be created by applying the XAVG() function to a 1Period Stochastic for SK and expanding the second Exponential Moving Average to create the SD (with appropriate modifications to the period to create a DiNapoli Modified Moving Average).
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 3/23/2006 Posts: 5

QUOTE (Bruce_L) I need to warn you against creating the Slow DiNapoli Stochastic SK and Slow DiNapoli Stochastic SD as separate Custom Indicators. They will plot on their own independent scales. You should create a Custom Indicator for the Slow DiNapoli Stochastic SK and add a Moving Average as a Child Indicator to create the Slow DiNapoli Stochastic SD instead. Is there a reason you don't want to use the built in Stochastics Indicator?
How would i do this? Add a child indicator?


Registered User Joined: 1/28/2005 Posts: 6,045

lastchance
After you create an indicator.
Click on it and choose "add indicator".
(for example a moving average)
This will apply the indicator to the indicator you created.
Thanks


Worden Trainer
Joined: 10/7/2004 Posts: 62,474

lastchance, The directions from diceman are correct. If you decide you want a more detailed tutorial an the subject, you may wish to review the following:
Adding, removing and saving indicators to a chart template
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 5/20/2007 Posts: 25

I was able to create a custom indicator
XAVG(STOC9.1,3)
to replicate the SD line of the following Telechart function:
Select Chart Template  Add Indicator  Stochastics.
 Period: 9
 SK Period: 1
 SD Period: 3
 Average Type: Exponential
I then added a child indicator of "7 period simple moving average" to the custom indicator and get the line I wanted.
Can you help me write a PCF that will give me the "7 period SMA of the XAVG(STOC9.1,3)"?
I have went through the various links on Stochastics but was unable to figue out the answer. Thank you for your help.


Worden Trainer
Joined: 10/7/2004 Posts: 62,474

wilbert9237,
Please try the following:
XAVG(STOC9.7,3)
The Indicator and Function used to construct this have the following syntax (the 7 can be used to add the 7Period Simple Moving Average because the Stochastic Indicator built into the Personal Criteria Formula Language is a Simple Stochastic).
PCF Formula Descriptions
Indicators:
STOCx.y.z > Simple Stochastic
Functions:
XAVG(w,x) > Exponential moving Average
Where w is the Number or Indicator to which a Function is applied.
 w cannot be a formula or function for XAVG()
Where x is the Period of the Indicator or Function.
Where y is a the Period of an additional Simple Moving Average.
Where z is the number of Periods Ago.
 z can also be a date. May 3, 2007 would be (single quotes required): '05/03/07'
The arguments in indicators are separated by periods while the arguments in functions are separated by commas.
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 5/20/2007 Posts: 25

Thanks, Bruce.
The shape is correct but the scaling seems to be a little off.
If I am looking for a crossover with XAVG(STOC5,3), will they be on the same scale or do I need to normalize them to 0100 scale in the PCF?


Worden Trainer
Joined: 10/7/2004 Posts: 62,474

wilbert9237,
You indicated you wanted a Personal Criteria Formula to represent an already Plotted Exponential Stochastic with a Simple Moving Average applied as a Child Indicator (which is the correct way to Plot this). If you are attempting to Plot these as individual Custom Indicators, the scaling will not match and this should generally not be done (this was discussed above).
You don't need to make any adjustments for the Personal Criteria Formula however as it is not being Plotted (so scaling doesn't matter).
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 5/20/2007 Posts: 25

Understood. Thank you very much for your help.


Worden Trainer
Joined: 10/7/2004 Posts: 62,474

wilbert9237,
You're welcome.
Bruce Personal Criteria Formulas TC2000 Support Articles


Guest1 