log in     sign up for free
 
The trading rules I live by are: 1. Cut losses. 2. Ride winners. 3. Keep bets small. 4. Follow the rules without question. 5. Know when to break the rules.
Ed Seykota
 
 
Home
systems (285)
 
 
Special offer: buy MetaStock (try for free)   |   Reuters QuoteCenter Real-Time Data (get a free month)   |   EOD Data
Formula Library
 
AmiBroker
MetaTrader
MetaStock
TradeStation
Wealth-Lab
NinjaTrader
 
add your formula
System Library
 
 
Account login
Your email:
Password:
 
Log in
New to s4t? Sign up.
If you forgot your password click here.
Search the Web
 
Custom Search

Stochastics

Formula for: TradeStation

indicator

 

 

Views:  1670

Added: August 01, 2008
 
Rate this code:  Rate: 1 Rate: 2 Rate: 3 Rate: 4 Rate: 5
This formula has not been rated yet
 

email this link

 
 
Tags: TradeStation, indicator
 


This month in Traders' Tips we take a look at stochastics as defined in this issue's article "Stochastics" by Stuart Evens. The calculation of the %K line, as defined in the article, is identical to the way in which it is calculated in EasyLanguage. The %D line, though, differs slightly. With this in mind, I have presented the calculation for the %K and %D, using both the regular and slow calculations. In addition, I have included two EasyLanguage indicators, one that plots the regular version of the pair and one that plots the slow version of the pair.
We begin by creating functions for each of the %K and %D calculations. Obviously, the calculations are not very complex, but I still chose to create them as user functions. The reason for creating them as functions is that it provides the versatility of using these calculations in any of my own custom studies without having to recreate the calculations each time. The EasyLanguage for each of the four functions is as follows:



Type: Function, Name: StochKreg
Input: Length(Numeric);
Variables: HH(0), LL(0);
HH = Highest(High, Length);
LL = Lowest(Low, Length);
StochKreg = 100 * ((Close - LL) / (HH - LL));





Type: Function, Name: StochDreg
Inputs: Length(Numeric), SlowPeriod(Numeric);
Variables: HH(0), LL(0);
HH = Highest(High, Length);
LL = Lowest(Low, Length);
StochDreg = 100 * (Summation(Close - LL, SlowPeriod) / Summation(HH - LL, SlowPeriod));






Type: Function, Name: StochKslow
Inputs: Length(Numeric), SlowPeriod(Numeric);
StochKSlow = StochDreg(Length, SlowPeriod);





Type: Function, Name: StochDslow
Input: Length(Numeric), SlowPeriod(Numeric);
StochDSlow = Average(StochDreg(Length, SlowPeriod), SlowPeriod);




The indicators for creating the regular stochastic lines and the slow stochastic lines would be written in the PowerEditor using the EasyLanguage as follows:


Type: Indicator, Name: Stoch - Reg
Inputs: Length(5), SlowLen(3);
Plot1(StochKreg(Length), "%K-reg");
Plot2(StochDreg(Length, SlowLen), "%D-reg");





Type: Indicator, Name: Stoch - Slow
Inputs: Length(5), SlowLen(3);
Plot1(StochKSlow(Length, SlowLen), "%K-Slow");
Plot2(StochDSlow(Length, SlowLen), "%D-Slow");






The indicators above appear best when they are scaled to "User Defined -- Maximum = 100 and Minimum = 0."
This EasyLanguage code is also available from Omega Research's Website. The name of the file is STOCH.ELS. Note that all Traders' Tips posted at the Omega Research Website can be utilized by both TradeStation and SuperCharts. When possible, the posted analysis techniques will include both QuickEditor and PowerEditor formats.

-- Gaston Sanchez, Omega Research Inc.

800 422-8587, 305 270-1095
Internet: http://www.omegaresearch.com

 

 



Code:

Type: Function, Name: StochKreg
Input: Length(Numeric);
Variables: HH(0), LL(0);
HH = Highest(High, Length);
LL = Lowest(Low, Length);
StochKreg = 100 * ((Close - LL) / (HH - LL));



Type: Function, Name: StochDreg
Inputs: Length(Numeric), SlowPeriod(Numeric);
Variables: HH(0), LL(0);
HH = Highest(High, Length);
LL = Lowest(Low, Length);
StochDreg = 100 * (Summation(Close - LL, SlowPeriod) / Summation(HH - LL, SlowPeriod));



Type: Function, Name: StochKslow
Inputs: Length(Numeric), SlowPeriod(Numeric);
StochKSlow = StochDreg(Length, SlowPeriod);





Type: Function, Name: StochDslow
Input: Length(Numeric), SlowPeriod(Numeric);
StochDSlow = Average(StochDreg(Length, SlowPeriod), SlowPeriod);



Type: Indicator, Name: Stoch - Reg
Inputs: Length(5), SlowLen(3);
Plot1(StochKreg(Length), "%K-reg");
Plot2(StochDreg(Length, SlowLen), "%D-reg");





Type: Indicator, Name: Stoch - Slow
Inputs: Length(5), SlowLen(3);
Plot1(StochKSlow(Length, SlowLen), "%K-Slow");
Plot2(StochDSlow(Length, SlowLen), "%D-Slow");


 





Code to difficult? Find somebody to help you with coding here.

 



Author: Stuart Evens
Source: http://www.traders.com

 

View similar (indicator for TradeStation):

RAVI II
Macd RS Ratio
Honey Baked
Osc Normalization
Color on MACD Histogram II
Hilbert Transform
Adaptive Moving Average
Bull and Bear Balance Indicator
Dunn's Density Indicator
VIDYA Variation
...
 
 
all formulas for TradeStation
all formulas

 

 

Email to friend

Top

 

     
However we try to maintain hiqhest possible level of service - most formulas, oscillators, indicators
and systems are submitted by anonymous users.
Therefore S4T™ does not take any responsibility for it's quality.
If you use any of this information, use it at your own risk. You are responsible for your own trading decisions.
Be sure to verify that any information you see on these pages is correct, and is applicable to your particular trade.
In no case will S4T™ be responsible for your trading gains or losses.
PayPalSecure payments by PayPal S4T™ is a part of TAURO EDUCATION NETWORK
 
Privacy note | (c) copyrights systems4trading.com 2006-2009