log in     sign up for free
 
People avoid looking for good exits because exits do not give them control over the market. However, exits do control something. They control whether you make a profit or a loss, and they control just how big that profit or loss will be. Since they do so much, perhaps they are worthy of a lot more study on the part of most people.
Van K. Tharp
 
 
Home
systems (285)
 
 
Special offer: buy AmiBroker and EOD+Real-Time 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

Moving Average Spread Indicator

Formula for: TradeStation

indicator

 

 

Views:  1496

Added: June 16, 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
 


I have an indicator that consists of 2 moving Averages. I would like to create a new Indicator which would be derived from the spread (distance apart of the MA's) and displayed similar to a RSI indicator only with the RSI 50% line now being a Zero line and the scale ranging from 100% to -100%. That is to say;
When the 2 MA's have the same reading the new (Moving Average Spread Indicator) would be displaying a reading of 0%. When the MA's started to move away from each other the new MAS Indicator would move away from the 0% line as a % to the historically plotted data. So if the furthest the 2 MA's had ever been apart was say 40 points and they were now 40 points apart the new MASI would read 100% and be indicating a likelihood of a correction.

Here is the ELA code for the MA Indicator.

 

 



Code:

Type : Indicator, Name : Moving Average Spread Indicator

{MA Spread Indicator
Plots the difference between a short and long EMA as a percentage of
the maximum difference see over the last LookbackLen bars

ghkramer 10Jan05}

input: Price(Close), ShortMALen(7), LongMALen(13), LookbackLen(50);
var: Sema(0), Lema(0), dema(0), Maxd(0), Spread(0);

Sema = xAverage(Price, ShortMALen);
Lema = xAverage(Price, LongMALen);
dema = Sema - Lema;
MaxD = Highest(AbsValue(dema),LookbackLen);

if (MaxD > 0) then
Spread = 100*(dema/MaxD);

plot1(Spread, "Spread");
plot2(0, "Zero");

if Spread > 90 or Spread < -90 then
setplotcolor(1, Blue)
else
setplotcolor(1, Red);

if Spread >= 90 then begin
if barStatus(1) = 2 then
alert(GetSymbolname + " Spread at High Extreme");
end;

if Spread <= -90 then begin
if barStatus(1) = 2 then
alert(GetSymbolname + " Spread at Low Extreme");
end;


 





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

 


Source: https://www.tradestation.com

 

View similar (indicator for TradeStation):

LMS Predictor
Chande's Momemtum Oscillator
Pivot Bar
Heikin Ashi II
MACD of MFI
Preferred (Slow) Oscillator
Color on MACD Histogram
Symmetrical Shark Indicator
Standard Error Bands
Kaufman Smoothing Constant Part of the Graile
...
 
 
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