log in     sign up for free
 
My percentage of winners is only about 50/50, because I cut my losers very quickly. The maximum loss I allow is 7 percent, and usually I am out of a losing stock a lot quicker. I make my money on the few stocks a year that double and triple in price.
David Ryan
 
 
Home
systems (285)
 
 
Special offer: buy AmiBroker and EOD+Real-Time Data
 

Buy

MetaStock

     (special offer)
 
 
 

Buy

EOD data for MetaStock

     (special offer)
 
 
 

Buy

Realtime data for MetaStock

     (special offer)
 
 
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

Exponential Moving Average - Trade-Adjusted

Formula for: MetaStock

indicator

 

 

Views:  3983

Added: June 26, 2007
 
Rate this code:  Rate: 1 Rate: 2 Rate: 3 Rate: 4 Rate: 5
This formula has not been rated yet
 

email this link

 
 
Tags: MetaStock, indicator
 


Self-adjusting Exponential Moving Average, adjusts periodicity to trade frequency - with multiple output choice.

 

 



Code:

Exponential Moving Average - Trade-Adjusted

{ 6-loop trade-adjusted EMA }
{ Adjusts EMA periodicity to trade frequency }

{ (c) Copyright 2005 Jose Silva
The grant of this license is for personal use
only - no resale or repackaging allowed.
All code remains the property of Jose Silva.
http://www.metastocktools.com }

{ User inputs }
avg:=Input("Crossover trades per year",2,1000,12);
plot:=Input("[1]EMA, [2]Signals, [3]EMA periods",1,3,1);

{ Base EMA periods }
pds:=21;

{ Year count }
yCount:=
LastValue(Year()-ValueWhen(1,Cum(1)=1,Year()));

{ Loop 1 }
signal:=Cross(C,Mov(C,pds,E));
pds:=Int(Cum(signal)/yCount/avg*pds+.5);
pds:=LastValue(If(pds<2,2,pds));

{ Loop 2 }
signal:=Cross(C,Mov(C,pds,E));
pds:=Int(Cum(signal)/yCount/avg*pds+.5);
pds:=LastValue(If(pds<2,2,pds));

{ Loop 3 }
signal:=Cross(C,Mov(C,pds,E));
pds:=Int(Cum(signal)/yCount/avg*pds+.5);
pds:=LastValue(If(pds<2,2,pds));

{ Loop 4 }
signal:=Cross(C,Mov(C,pds,E));
pds:=Int(Cum(signal)/yCount/avg*pds+.5);
pds:=LastValue(If(pds<2,2,pds));

{ Loop 5 }
signal:=Cross(C,Mov(C,pds,E));
pds:=Int(Cum(signal)/yCount/avg*pds+.5);
pds:=LastValue(If(pds<2,2,pds));

{ Loop 6 }
signal:=Cross(C,Mov(C,pds,E));
pds:=Int(Cum(signal)/yCount/avg*pds+.5);
pds:=LastValue(If(pds<2,2,pds));

{ Final output }
EMA:=Mov(C,pds,E);
long:=Cross(C,EMA);
short:=Cross(EMA,C);

{ Plot EMA on price chart }
If(plot=1,EMA,If(plot=2,long-short,pds))


 





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

 



Author: Jose Silva
Source: http://www.metastocktools.com

 

View similar (indicator for MetaStock):

ATR Based Stops
Linear Regression Slope
Volatility Breakout System - Returns Profit
Advance/Decline Divergence Oscillator
AMA Binary Wave
Kurtosis Indicator
Offset RSI & MACD
Price Volume Trend Stochastic
Cycle Indicator
Advance/Decline Line with Negative Volume
...
 
 
all formulas for MetaStock
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