NexusFi: Find Your Edge


Home Menu

 





ADX using EMA rather than Wilder's formula


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Azrael with 4 posts (0 thanks)
    2. looks_two Fat Tails with 3 posts (6 thanks)
    3. looks_3 kaan with 3 posts (0 thanks)
    4. looks_4 cactus363 with 1 posts (0 thanks)
    1. trending_up 6,682 views
    2. thumb_up 6 thanks given
    3. group 5 followers
    1. forum 10 posts
    2. attach_file 0 attachments




 
Search this Thread

ADX using EMA rather than Wilder's formula

  #11 (permalink)
 cactus363 
Haslemere, United Kingdom
 
Experience: Intermediate
Platform: Sierra Charts
Broker: CQG
Trading: CL,ES,NQ,KC
Posts: 7 since Oct 2013
Thanks Given: 7
Thanks Received: 1

Hi,
I've been trying to create this indicator (ADX using EMA) for Multicharts and the only helpfull information I've found is in this thread.
I take my hat off to Fat Tails for creating the Ninja version, I dont have ninja but been looking at Fat Tails code trying to reverse engineer and my head hurts

I wonder if Fat Tails or anyone else could help and look at the easylanguage code bellow (this is the standard DMI indicator in multicharts) and hint what values I'd need to change to calculate the ADX using EMA rather than Willder's avarage?
Thanks

 
Code
inputs: 
	PriceValueH( numericseries ), 
	PriceValueL( numericseries ), 
	PriceValueC( numericseries ), 
	Len( numericsimple ),                                             
	oDMIPlus( numericref ), 
	oDMIMinus( numericref ), 
	oDMI( numericref ), 
	oADX( numericref ), 
	oADXR( numericref ),
	oVolty( numericref ) ;

variables:
	var0( 0 ), 
	var1( 0 ), 
	var2( 0 ), 
	var3( 0 ),
	var4( 0 ), 
	var5( 0 ), 
	var6( 0 ), 
	var7( 0 ), 
	var8( 0 ), 
	var9( 1 / Len ),                     
	var10( 0 ) ;

if CurrentBar = 1 then
	begin
	for Value1 = 0 to Len - 1 
		begin
		var0 = 0 ;
		var1 = 0 ;
		var2 = PriceValueH[Value1] - PriceValueH[ Value1 + 1 ] ;
		var3 = PriceValueL[ Value1 + 1 ] - PriceValueL[Value1] ;
		condition1 = var2 > var3 and var2 > 0 ;
		if condition1 then
			var0 = var2
		else 
		begin
		condition1 = var3 > var2 and var3 > 0 ;
		if condition1 then
			var1 = var3 ;
			end;
		var4 = var4 + var0 ;
		var5 = var5 + var1 ;
		var6 = var6 + TrueRangeCustom( PriceValueH, PriceValueL, PriceValueC )[Value1] ;
		end ;
	var7 = var4 / Len ;
	var8 = var5 / Len ;
	oVolty = var6 / Len ;
	end 
else
	begin
	var0 = 0 ;
	var1 = 0 ;
	var2 = PriceValueH - PriceValueH[1] ;
	var3 = PriceValueL[1] - PriceValueL ;
	condition1 = var2 > var3 and var2 > 0 ;
	if condition1 then
		var0 = var2
	else 
	begin 
	condition1 = var3 > var2 and var3 > 0 ;
	if condition1 then
		var1 = var3 ;
		end;
	var7 = var7[1] + var9 * ( var0 - var7[1] ) ;
	var8 = var8[1] + var9 * ( var1 - var8[1] ) ;
	oVolty = oVolty[1] + var9 * ( TrueRangeCustom( PriceValueH, PriceValueL, PriceValueC ) 
	 - oVolty[1] ) ;
	end ;

if oVolty > 0 then
	begin
	oDMIPlus = 100 * var7 / oVolty ;
	oDMIMinus = 100 * var8 / oVolty ;
	end 
else
	begin
	oDMIPlus = 0 ;
	oDMIMinus = 0 ;
	end ;

var10 = oDMIPlus + oDMIMinus ;
if var10 > 0 then
	oDMI = 100 * AbsValue( oDMIPlus - oDMIMinus ) / var10 
else
	oDMI = 0 ;

condition1 = CurrentBar <= Len and CurrentBar > 0 ;
if condition1 then
	begin
	oADX = Cum( oDMI ) / CurrentBar ;
	                                                                              
	                                                                               
	                                                                 
	                                                                           
	                               
	oADXR = ( oADX + oADX[ CurrentBar - 1 ] ) * .5 ;
	                                                                                 
	end
else
	begin
	oADX = oADX[1] + var9 * ( oDMI - oADX[1] ) ;
	oADXR = ( oADX + oADX[ Len - 1 ] ) * .5 ;
	end ;

DirMovement = 1 ;

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
MC PL editor upgrade
MultiCharts
Trade idea based off three indicators.
Traders Hideout
About a successful futures trader who didnt know anythin …
Psychology and Money Management
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 




Last Updated on October 21, 2016


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts