NexusFi: Find Your Edge


Home Menu

 





EasyLanguage ADXVMA Indicator


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one Big Mike with 5 posts (18 thanks)
    2. looks_two swisstrader with 5 posts (0 thanks)
    3. looks_3 syxforex with 2 posts (0 thanks)
    4. looks_4 thatguy with 2 posts (0 thanks)
    1. trending_up 15,122 views
    2. thumb_up 32 thanks given
    3. group 8 followers
    1. forum 15 posts
    2. attach_file 3 attachments




 
Search this Thread

EasyLanguage ADXVMA Indicator

  #11 (permalink)
 
Serger's Avatar
 Serger 
Quebec
 
Experience: Intermediate
Platform: Multicharts 64 +VolProfile
Broker: Interactive Brokers
Trading: Ym, Es
Posts: 74 since Oct 2010
Thanks Given: 64
Thanks Received: 25

Hello Mike
I have import thie Adxvma S/R im my chart .. is in red dots ..
I just have supports not resistance ? normal or ?
is a TF graph for Apr 21
Thank you
Serger

Attached Thumbnails
Click image for larger version

Name:	ADXVMA_SR.png
Views:	412
Size:	83.0 KB
ID:	37140  
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Any futures traders in Texas looking to give back to tho …
Traders Hideout
ZombieSqueeze
Platforms and Indicators
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Diary of a simple price action trader
20 thanks
My NQ Trading Journal
17 thanks
Coding money management strategies.
14 thanks
Just another trading journal: PA, Wyckoff & Trends
12 thanks
Daytrading ES & NQ
9 thanks
  #12 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


Big Mike View Post
Here is the ADXVMA function and indicator for EasyLanguage - TradeStation/MultiCharts. I am unsure of the original author, this is a conversion from NinjaTrader.

I've built it as a function so you can use it in signals easily. The attached .pla MultiCharts file is both the function and the indicator.

Hm, there's something weird about this function. I've double checked it with two NinjaTrader ADXVMA indicators from the forum here, but although the code from NinjaTrader and MultiCharts is the same, the results are wildly different:



Anyone knows what can cause this difference?


Little update February 16th:
Though Mike coded the function correctly (thanks Mike ) and my converted function works the same, the code from the NinjaTrader indicator is somewhat sloppy and I wouldn't be surprised if NinjaTrader used some other calculation method than MultiCharts.

There are some 'weird' things in the code, like using the constant i value of 0 for serializing (what's the point of that?), or code like:
 
Code
if (DI_Sum>0)
    Out.Set(DI_Diff/DI_Sum);//Factional, near zero when PDM==MDM (horizonal), near 1 for laddering.
else
    Out.Set(0);

Out.Set(((WeightDX-1)*Out[i+1] + Out[i])/WeightDX);
I don't see the point in setting the value of Out twice this way, but that's perhaps that due to me not using NinjaTrader extensively.

Perhaps I made a mistake, and by the way, I'm not saying that the MultiCharts function cannot be used or gives wrong signals. Just that the results are different from the NinjaTrader version.

Reply With Quote
  #13 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


I have revisited the NinjaTrader code for the ADXVMA, and found it extremely dirty with a number of bugs and inconsistencies. As somebody wanted to use it, I took the challenge to clean it up. I am posting the code here,

- because the Easy Language version is already much cleaner than all NinjaTrader versions
- because it helps to understand what the indicator actually does


Here is the code. k is a smoothing constant of an exponential moving average based on Wilder's average ( that is the 1/n method as opposed to the 2/(n+1) method later used as a result of the assimilation between SMA and EMA). The various periods ADXperiod, weight DX etc. are replaced with a single period. The useless parameter i is dropped (as for the MultiCharts version). Double variables are not compared to zero but to the value double.Epsilon to take into account the error term. For the initialization of the first value for the ADXVMA 0 has been replaced with Input(0). The version now allows for calculating the ADXVMA from other values than the Close series.

Clean code for comparison with the Easy Language version is here:

 
Code
double currentUp = Math.Max(Input[0] - Input[1], 0);
double currentDown = Math.Max(Input[1] - Input[0], 0);
up.Set ((1-k)*up[1] + k*currentUp);
down.Set((1-k)*down[1] + k*currentDown);
double sum = up[0] + down[0];
double fractionUp = 0.0;
double fractionDown = 0.0;
if(sum > double.Epsilon)
{
	fractionUp = up[0]/sum;
	fractionDown = down[0]/sum;
}
ups.Set((1-k)*ups[1] + k*fractionUp);
downs.Set((1-k)*downs[1] + k*fractionDown);

double normDiff = Math.Abs(ups[0] - downs[0]);
double normSum = ups[0] + downs[0];
double normFraction = 0.0;
if(normSum > double.Epsilon)
	normFraction = normDiff/normSum;
index.Set((1-k)*index[1] + k*normFraction);

hhv = MAX(index,period+1)[0];
llv = MIN(index,period+1)[0];
double vDiff = hhv-llv;
double vIndex = 0;
if(vDiff > double.Epsilon)
	vIndex = (index[0] - llv)/vDiff;
ADXVMA.Set((1 - k*vIndex)*ADXVMA[1] + k*vIndex*Input[0]);

The indicator can be downloaded here:


Reply With Quote
  #14 (permalink)
 
kinkeadfx's Avatar
 kinkeadfx 
Amarillo, Texas, USA
 
Experience: Advanced
Platform: Ninjatrader, Multicharts
Broker: Amp Futures/CQG
Trading: YM 6E CL GC
Posts: 29 since Oct 2010
Thanks Given: 11
Thanks Received: 1

Where can i find the signal that works with this indicator for use in automated trading?

Thanks!

Reply With Quote
  #15 (permalink)
 nick32 
Boston
 
Experience: Beginner
Platform: TradeStation
Trading: YM
Posts: 2 since Dec 2013
Thanks Given: 0
Thanks Received: 0


Jura View Post
Hm, there's something weird about this function. I've double checked it with two NinjaTrader ADXVMA indicators from the forum here, but although the code from NinjaTrader and MultiCharts is the same, the results are wildly different:



Anyone knows what can cause this difference?

Here is the updated version of ADXVMA. I think it should work similar to the NinjaTrader version, can you please check?

 
Code
// Big Mike Trading https://nexusfi.com
// April 17 2010
// Converted from NinjaTrader version, original author unknown
// Function

inputs:     
    Price (NumericSeries),
    Length (NumericSimple);

vars:
    TR(0),
    DI_Diff(0),
    DI_Sum(0),
    ma(0),
    pdm(0),
    mdm(0),
    pdi(0),
    mdi(0), 
    DI_Factor(0), 
    VI(0), 
    diff(0), 
    HHV(0), 
    LLV(0),
    WeightDM(Length), 
    WeightDI(Length), 
    WeightDX(Length),
    ChandeEMA(Length),
    output(0);

once ma=Price;    

if(Price>Price[1]) then begin
	pdm=Price-Price[1];
	mdm=0;
end else begin
	mdm=Price[1]-Price;
	pdm=0;
end;

pdm=((WeightDM-1)*pdm[1] + pdm)/WeightDM;//ema.
mdm=((WeightDM-1)*mdm[1] + mdm)/WeightDM;//ema.

TR=pdm+mdm;

if (TR>0) then begin    
	pdi=pdm/TR; 
	mdi=mdm/TR; 
end else begin
    pdi=0;
    mdi=0;
end;

pdi=((WeightDI-1)*pdi[1] + pdi)/WeightDI;//ema.
mdi=((WeightDI-1)*mdi[1] + mdi)/WeightDI;//ema.
DI_Diff=pdi-mdi;
 
if (DI_Diff<0) then  DI_Diff= -DI_Diff;//Only positive momentum signals are used.

DI_Sum=pdi+mdi;

DI_Factor=0;//Zero case, DI_Diff will also be zero when DI_Sum is zero.

if (DI_Sum>0) then output=DI_Diff/DI_Sum else output=0;

output=((WeightDX-1)*output[1] + output)/WeightDX;

HHV = HighestFC(output,Length+1);
LLV = LowestFC(output,Length+1);

diff = HHV - LLV;
VI=0;

if (diff>0) then  VI=(output-LLV)/diff;

ma=((ChandeEMA-VI)*ma[1]+VI*Price)/ChandeEMA;//Chande VMA formula with ema built in.
ADXVMA = ma;

Reply With Quote
  #16 (permalink)
appleinvestor
Sharon, MA USA
 
Posts: 1 since Dec 2010
Thanks Given: 0
Thanks Received: 0


Big Mike View Post
I believe in laymens terms it uses a VMA and ADX together to plot the MA. The MA is primarily based on the VMA of price but uses the ADX values to determine volatility, adjusting the VMA by the volatility.

As I am not the original author I can't say for sure, but that is what I see from glancing at the code.

Mike

ADX is a strength of direction indicator. It does not indicate direction. Typically it is used to determine whether a breakout is valid, or the converse, that a break may be about to occur because of the lack of directional strength.

Reply With Quote




Last Updated on October 29, 2014


© 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