indiTraders - Forum for the Active Indian Trader  

Go Back   indiTraders - Forum for the Active Indian Trader > Trading > Beginners Section

Beginners Section For those new to Trading

FXPrimus
Reply
 
Bookmark and Share LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-04-2015, 01:43 PM
nTP's Avatar
nTP nTP is offline
Flash Crash
 
Join Date: Dec 2013
Location: kolkata
Posts: 2,130
Thanks: 7,967
Thanked 2,395 Times in 1,421 Posts
nTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud of
Default NwMA -- IFTA 2012 -- Mov Avg 3.0

hi

We are going to discuss something about lesser lag based Mov Avgs here ...
The interesting part of the document is shared here. looking for a better result.

This mov Avg is generalization of Elher's mov avgs.(possibly).So Elher's version of mov Avg's is a special case of Mov Avg 3.0. WMA has lesser lag than EMA/SMA.So we will try to code it in such direction.



Nyquist Criterion
In signal processing theory, the application of a MA to itself
can be seen as a Sampling procedure. The sampled signal is the
MA (referred to as MA1) and the sampling signal is the MA as
well (referred to as MA2). If additional periodic cycles which are
not included in the price series are to be avoided sampling must
obey the Nyquist Criterion [1, 4].
With the cycle period as parameter, the usual one in
Technical Analysis, the Nyquist Criterion reads as follows:
n1 = λ*n2 , with λ ≥ 2.
n1 is the cycle period of the sampled signal to which a sampling
signal with cycle period n2 is applied. n1 must at least be twice as
large as n2. In Mulloy´s and Ehlers´ approaches (referred to as
Moving Averages 2.0) both cycle periods are equal.
Moving Averages 3.0
Using the Nyquist Criterion there is a relation by which the
application of a MA to itself can be described more precisely. In
figure 2 a price series C (black line), one MA (MA1, red line) with
lag L1 to the price series and another MA with lag L2 to MA1 (MA2,
blue line) are illustrated. Based on the approximation and the
relations described in figure 2 the following equation holds:
(1) D1/D2 = (C – MA1)/(MA1 – MA2) = L1/L2
According to the lag formulas in the introduction L1/L2 can be
written as follows:


α := L1/L2 = (n1 – 1)/(n2 – 1).
In this expression denominator 2 for the SMA and EMA as
well as denominator 3 for the WMA are missing. α is therefore
valid for all three MAs. Using the Nyquist Criterion one gets for
α the following result:
(2) α = λ* (n1 – 1)/(n1 – λ).
α put in (1) and C replaced by the approximation term NMA,
the notation for the new MA, one gets:
NMA = (1 +α) MA1 – α MA2.
In detail, equation (2) reads as follows:
(3) NMA[price/ n1, n2] = (1 + α) MA1[price/ n1 ] – α
MA2[MA1/ n2],
(4) α = λ* (n1 – 1)/(n1 – λ), with λ ≥ 2.

(3) and (4) are equations for a group of MAs (notation: Moving
Averages 3.0). They are independent of the choice of an MA. As
the WMA shows the smallest lag (see introduction), it should
generally be the first choice for the NMA.
n1 = n2 results in the value 1 for α and λ, respectively. Then
equation (3) passes into Ehlers´ formula. Thus Ehlers´ formula
is included in the NMA formula as limiting value. It follows from
a short calculation that the lag for NMA results in a theoretical
value zero.
__________________
thx
nTuple

Disclaimer: I am not a Research Analyst and not registered with any regulating authority. All posts are for educational purpose only.

Consider us a dumb -dumble guy in this analysis, any type of real time example will be quick-learn approach.

Last edited by nTP; 02-04-2015 at 01:48 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 4 Users Say Thank You to nTP For This Useful Post:
  #2 (permalink)  
Old 02-04-2015, 01:47 PM
ashis_ch ashis_ch is offline
Market Lizard
 
Join Date: Oct 2010
Posts: 276
Thanks: 605
Thanked 612 Times in 226 Posts
ashis_ch is a jewel in the roughashis_ch is a jewel in the roughashis_ch is a jewel in the roughashis_ch is a jewel in the roughashis_ch is a jewel in the roughashis_ch is a jewel in the roughashis_ch is a jewel in the rough
Default

please explain the code in simple english then I think it is possible to code it in AMI
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to ashis_ch For This Useful Post:
  #3 (permalink)  
Old 02-04-2015, 01:56 PM
nTP's Avatar
nTP nTP is offline
Flash Crash
 
Join Date: Dec 2013
Location: kolkata
Posts: 2,130
Thanks: 7,967
Thanked 2,395 Times in 1,421 Posts
nTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud of
Default

Originally Posted by ashis_ch View Post
please explain the code in simple english then I think it is possible to code it in AMI

This doc follows abit different language which is very near to pascal possibly equilla language
__________________
thx
nTuple

Disclaimer: I am not a Research Analyst and not registered with any regulating authority. All posts are for educational purpose only.

Consider us a dumb -dumble guy in this analysis, any type of real time example will be quick-learn approach.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to nTP For This Useful Post:
  #4 (permalink)  
Old 02-04-2015, 02:16 PM
ashis_ch ashis_ch is offline
Market Lizard
 
Join Date: Oct 2010
Posts: 276
Thanks: 605
Thanked 612 Times in 226 Posts
ashis_ch is a jewel in the roughashis_ch is a jewel in the roughashis_ch is a jewel in the roughashis_ch is a jewel in the roughashis_ch is a jewel in the roughashis_ch is a jewel in the roughashis_ch is a jewel in the rough
Default

To code this you need to understand the logic first. The logic for this indicator is incomprehensible for me from this document. The kind of notations and mathematical operators they used are not so familiar by me , hence I requested for the logic in plain English.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to ashis_ch For This Useful Post:
  #5 (permalink)  
Old 02-04-2015, 06:42 PM
nTP's Avatar
nTP nTP is offline
Flash Crash
 
Join Date: Dec 2013
Location: kolkata
Posts: 2,130
Thanks: 7,967
Thanked 2,395 Times in 1,421 Posts
nTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud of
Default

Originally Posted by ashis_ch View Post
To code this you need to understand the logic first. The logic for this indicator is incomprehensible for me from this document. The kind of notations and mathematical operators they used are not so familiar by me , hence I requested for the logic in plain English.

https://www.bigmiketrading.com/germa...tml#post128971
__________________
thx
nTuple

Disclaimer: I am not a Research Analyst and not registered with any regulating authority. All posts are for educational purpose only.

Consider us a dumb -dumble guy in this analysis, any type of real time example will be quick-learn approach.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-04-2015, 09:52 PM
nTP's Avatar
nTP nTP is offline
Flash Crash
 
Join Date: Dec 2013
Location: kolkata
Posts: 2,130
Thanks: 7,967
Thanked 2,395 Times in 1,421 Posts
nTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud of
Default

got the dll but may not be loaded if others do not have the dependencies
Attached Files
File Type: zip NWMA.alpha.zip (19.4 KB, 2 views)
__________________
thx
nTuple

Disclaimer: I am not a Research Analyst and not registered with any regulating authority. All posts are for educational purpose only.

Consider us a dumb -dumble guy in this analysis, any type of real time example will be quick-learn approach.

Last edited by nTP; 02-04-2015 at 09:58 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 03-04-2015, 02:29 PM
rmike rmike is offline
Regulars
 
Join Date: May 2010
Posts: 126
Thanks: 263
Thanked 390 Times in 120 Posts
rmike has a spectacular aura aboutrmike has a spectacular aura aboutrmike has a spectacular aura aboutrmike has a spectacular aura aboutrmike has a spectacular aura aboutrmike has a spectacular aura about
Default

Hi nTuple (sumana.m )

IMHO, any type of moving average is sufficient for development of a trading strategy, if one knows how to apply it effectively. Without this understanding, the whole exercise is likely to become a never ending quest for the 'BEST' moving average!!!

......Still, for the benefit of intellectual investigation, ....here is NWMA (acronym for New Weighted Moving Average - 3rd Generation) concept demonstrated in ami on a weekly chart of ALBK as on last traded date, vis-a-vis a similar period (20 Period) SMA. The NWMA is coloured SkyBlue and the SMA is coloured Yellow

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to rmike For This Useful Post:
  #8 (permalink)  
Old 03-04-2015, 02:33 PM
nTP's Avatar
nTP nTP is offline
Flash Crash
 
Join Date: Dec 2013
Location: kolkata
Posts: 2,130
Thanks: 7,967
Thanked 2,395 Times in 1,421 Posts
nTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud of
Default

Originally Posted by rmike View Post
Hi nTuple (sumana.m )

IMHO, any type of moving average is sufficient for development of a trading strategy, if one knows how to apply it effectively. Without this understanding, the whole exercise is likely to become a never ending quest for the 'BEST' moving average!!!

......Still, for the benefit of intellectual investigation, ....here is NWMA (acronym for New Weighted Moving Average - 3rd Generation) concept demonstrated in ami on a weekly chart of ALBK as on last traded date, vis-a-vis a similar period (20 Period) SMA. The NWMA is coloured SkyBlue and the SMA is coloured Yellow


T3 is smiler but it was on EMA and this one is on WMA.I had a idea to change it to SWMA instead of WMA.
__________________
thx
nTuple

Disclaimer: I am not a Research Analyst and not registered with any regulating authority. All posts are for educational purpose only.

Consider us a dumb -dumble guy in this analysis, any type of real time example will be quick-learn approach.

Last edited by nTP; 03-04-2015 at 02:37 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to nTP For This Useful Post:
  #9 (permalink)  
Old 03-04-2015, 02:52 PM
rmike rmike is offline
Regulars
 
Join Date: May 2010
Posts: 126
Thanks: 263
Thanked 390 Times in 120 Posts
rmike has a spectacular aura aboutrmike has a spectacular aura aboutrmike has a spectacular aura aboutrmike has a spectacular aura aboutrmike has a spectacular aura aboutrmike has a spectacular aura about
Default

Customarily, no show can ever end till the 'fat lady sings'

So here's the code
Code:
/*________________________________________________________________________________________________________________
CREDITS -

Concept - Third Generation Moving Averages by Dr. Manfred G. Dürschner
Amibroker Implementation for Concept Demonstration - rmike.
Intellectual Copyright - Dr. Manfred G. Dürschner (Concept), rmike (AFL Coding)

WEB RESOURCE - http://ifta.org/public/files/journal/d_ifta_journal_12.pdf
			     Article - Moving Averages 3.0

AFL VERSION & RELEASE DATE - V1.0, 03 Apr 15. For IndiTraders Forum Members.

WARNING - This AFL may be used for personal educational puposes only.
The right to re-package and/ or commercialize/ market this AFL in any way
is NOT granted to any user. This AFL may be distributed for free (without modifications)
with due acknowledgement of credit to concept & coder. 

DISCLAIMER -

1. This AFL is for educational purposes only as per the ideas described in the web resource.
This is a concept demonstrator for the Third Generation Moving Average. The chosen sampling
periods are non optimized. No backtested results for this AFL are provided.

2. The coder neither makes any claim as to the efficacy of this Indicator for usage in live trading,
nor wishes to incite/ induce anyone (either implicitly OR explicitly) to engage in live trading.

3. You are hereby FOREWARNED that the usage of this AFL for live trading will be entirely at
YOUR OWN discretion and risk.
________________________________________________________________________________________________________________*/

_SECTION_BEGIN("NWMA");
P = ParamField("Price field",-1);
av = ParamList("Average Type", "WMA|EMA|MA");
Lambda = Param("Lambda", 2, 1, 9, 1);
n1_per = Param("Sampling Period", 40, 2, 200, 1);

function NWMA(P, n1_per)
{
n2_per = n1_per/Lambda;

av1 = 0;
av2 = 0;

if( av == "MA" )     av1 = MA( P, n1_per ); av2 = MA( av1, n2_per ); 
if( av == "EMA" )   av1 = EMA( P, n1_per ); av2 = EMA( av1, n2_per ); 
if( av == "WMA" )  av1 = WMA( P, n1_per ); av2 = WMA( av1, n2_per );

alpha = (Lambda * (n1_per - 1))/(n1_per - Lambda);
return ((1 + alpha)*av1) - (alpha*av2);
}
Plot(MA(P, n1_per), "MA", colorYellow, styleThick);
Plot(NWMA(P, n1_per), "NWMA", colorSkyblue, styleThick);
Plot(C, "Close", colorWhite, styleCandle);
_SECTION_END();
The same is also attached to avoid 'copy-paste' misadventures

This is a concept demonstrator for similar period NWMA & SMA comparison


The parameters enable the choice to use SMA, EMA or WMA (defaulted to WMA as it has the least lag) with choice of Lambda (defaulted to 2 as being the most efficient) and the sampling periods (i.e periods of first/ reference moving average (defaulted to 40). The choice to use any price field e.g close, high, low etc has also been provided (defaulted to close).



If Average Type is chosen as SMA/ EMA with Lambda as 1 then the output will be 2nd Generation Moving Average (Ehler)

Note: If function is stored as an include file then NWMA can be invoked in any AFL by using #include<> function without the need for copying the complete function.

I'll leave it to you to figure out the IFT application to NWMA of Aroon, StochRSI OR whatever it is that you are after

P.S - Advice to users - Now that you have the NWMA, don't just start chasing after the 'best-fit' optimized settings It will then truly become never ending
Attached Files
File Type: zip NWMA.zip (1.2 KB, 4 views)

Last edited by rmike; 03-04-2015 at 06:40 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to rmike For This Useful Post:
  #10 (permalink)  
Old 03-04-2015, 02:54 PM
rmike rmike is offline
Regulars
 
Join Date: May 2010
Posts: 126
Thanks: 263
Thanked 390 Times in 120 Posts
rmike has a spectacular aura aboutrmike has a spectacular aura aboutrmike has a spectacular aura aboutrmike has a spectacular aura aboutrmike has a spectacular aura aboutrmike has a spectacular aura about
Default

Originally Posted by nTuple View Post
T3 is smiler but it was on EMA and this one is on WMA.I had a idea to change it to SWMA instead of WMA.

Have a look at the code, its fairly simple to include SWMA amongst the 'Average Types', if you so desire

Last edited by rmike; 03-04-2015 at 02:57 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to rmike For This Useful Post:
Reply

indiTraders - Forum for the Active Indian Trader > Trading > Beginners Section


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


FXPrimus

All times are GMT +5.5. The time now is 07:57 AM.


vBulletin Copyright by vBulletin

Content Relevant URLs by vBSEO 3.3.2