ADXVMA Questions - NinjaTrader Programming | futures io social day trading
futures io futures trading


ADXVMA Questions
Updated: Views / Replies:16,314 / 52
Created: by max-td Attachments:12

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 12  
 
Thread Tools Search this Thread
 

ADXVMA Questions

  #11 (permalink)
Elite Member
Florida
 
Futures Experience: Intermediate
Platform: NT7
Favorite Futures: CL, NQ, NG
 
Posts: 456 since Jun 2009
Thanks: 1,359 given, 383 received

Peter,

Great detective work!

so what's the next step? If you change that line and recompile, does NT just put it back in as before?

up til now when I've had the problem, I just use the setting of 2 instead of 1.

It's appearance is slightly different but it appears to be working

Kirk

Reply With Quote
 
  #12 (permalink)
Elite Member
Brisbane; Australia
 
Futures Experience: Intermediate
Platform: NT
Broker/Data: IB/TDA needing new broker
Favorite Futures: Futures, Forex, Stocks
 
Peter's Avatar
 
Posts: 97 since Jun 2009
Thanks: 91 given, 101 received

My way is just importing the ADXVMA via the JMAPaint.zip (to retain it for the future I saved that locally on a separate place). Apparently if I import it via that ZIP the ADXVMA does not recompile like when copying in only the .cs file and compile.
Don't ask me why ... but it works (for me). ADXVMA @2 is also a way.

My guess is that everybody who runs a new NT version and edit/compiles the ADXVMA will ruin his ADXVMA for use in DMAPaint @setting 1.
I think the working ADXVMA might just be a version from somebody who did not yet update to a newer NT version.

Anyway, I am glad I finally found a difference. As you can read in the DMAPaint thread it was bugging me seriously and driving me mad I couldn't find the cause. It didn't make sense.


I think that if this code change can be confirmed by more users is to ask NT if they changed anything in their compiler over the last NT version. But don't hold your breath. As ADXVMA is not a standard NT indicator they will probably not investigate.


Apparently I was not clear ... I added step by step to make it easier:
DO use .......Utilities..... Import NinjaScript.... find the JMAPaintBar.zip ... Open ... say 'Yes" to ADXVMA to replace existing file...(the others is your choice) ...then NT will start importing and you see the hour glass .... then NT says it successfully imported all indicators ..bla bla ... click OK

Addition: I now made a correct ADXVMAv3.ZIP which contains only a good ADXVMA (with RJay mod)
... see couple posts below


That is all ... you are ready ... Do NOT copy the ADXVMA.cs file in and compile. I don't know why it works via importing the ZIP but with me it does.

What I meant with saving the JMAPaint.zip somewhere locally, was to keep the JMAPaint.zip that is currently in the download section at a save place. In an update it might inadvertently be updated with an ADXVMA that you like less.


Last edited by Peter; July 2nd, 2009 at 04:36 AM.
Reply With Quote
 
  #13 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,218 received



Peter View Post
The COBC is different but that is not the problem. As mentioned before my good ADXVMA gets problematic by just opening the indicator editor and then compiling (without any changes).


I just compared your ADXVMA with my good ADXVMA. Next to the COBC and version stuff I found a difference in the NT generated code.
It is the same difference that I also find (as only difference) after opening and closing my good ADXVMA that turns bad after opening&recompiling.

To be sure I replicated it again as follows:
I loaded again the good ADXVMA via ZIP from JPaint (and copied it to my desktop... it is the version in left top in the pic) and I checked that it worked with ADXVMA at 1 in the DMA.
I then opened this working ADXVMA indicator with the editor and closed without editing .... again I got a flatlline. I then opened this recompiled ADCVMA file in DiffDoc (left top of panel)

DiffDoc found a difference in the NT generated code. It is the only difference it found.

To me it looks again that NT itself is the culprit.

Peter, great job here. I am wondering if this phenomenon is self-contained to just your workstation, or others. Have you tried deleting your Ninja cache?

I suppose that there is really no point in further talking about ADXVMA. The answer seems clear. Since you know better than anyone, why don't you just go remove any instances of the "bad" ADXVMA from the forum, delete the attachments from the posts, etc, because clearly this has been a headache for you (and all of us). I would do this but I am afraid I would make things worse.

As for the files in the download section with the wrong version, if it is my stuff then you have permission to change out the file or if you'll tell me which ones are the offending ones I will do it.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following user says Thank You to Big Mike for this post:
 
  #14 (permalink)
Elite Member
Australia
 
Futures Experience: Intermediate
Platform: Ninja
 
vast's Avatar
 
Posts: 167 since Jun 2009
Thanks: 154 given, 59 received

Thanks Peter for your guide.
Maybe once it is fixed, we should post a new thread with all the correct indicators in it. Maybe also name the indicators with a unique name and this will not cause it to over write the previous ones. Just a thought

Reply With Quote
 
  #15 (permalink)
Elite Member
Brisbane; Australia
 
Futures Experience: Intermediate
Platform: NT
Broker/Data: IB/TDA needing new broker
Favorite Futures: Futures, Forex, Stocks
 
Peter's Avatar
 
Posts: 97 since Jun 2009
Thanks: 91 given, 101 received

Right, I finally succeeded tricking NT to export a good ADXVMA (edited outside NT in Notepad).
The trick:
If you need to edit this ADXVMA.... make a copy to your desktop ... edit that one in Notepad ... save in Notepad ....overwrite the original in the NT indicator directory .... immediately export to a ZIP .... and then import the ZIP and accept overwriting.
BTW Any editing of this ADXVMA and compile will on my system generate the code switch as shown before and cause flatlining.

The following ZIP contains only the ADXVMA
- I named it ADXVMA3.0 (shows up as such when adding indicators)
- I included the suggestion of RJay (see in this thread earlier)

In my system this ADXVMA will cure a flatline

Attached Files
Register to download File Type: zip ADVVMAv3.zip (2.9 KB, 180 views)

Last edited by Peter; July 2nd, 2009 at 08:12 AM.
Reply With Quote
The following 3 users say Thank You to Peter for this post:
 
  #16 (permalink)
Elite Member
Brisbane; Australia
 
Futures Experience: Intermediate
Platform: NT
Broker/Data: IB/TDA needing new broker
Favorite Futures: Futures, Forex, Stocks
 
Peter's Avatar
 
Posts: 97 since Jun 2009
Thanks: 91 given, 101 received

Vast, it is a good idea to go for a special name, but then we also need to add that name to the DMAInternal.cs file of the DMA and DMAPaint ... otherwise you cannot use it via the pulldown list with MAs.
I might do that if this v3 proves to work with other people too.


I would like first to have some conformation that:
- they too see the code switch depicted earlier after opening/compiling
- and that this ADXVMAv3 will work for others to solve the flatline
So pls. .... some feedback

If it indeed works I'll remove/adapt the older files and file compilations.


Last edited by Peter; July 3rd, 2009 at 01:59 AM.
Reply With Quote
The following 2 users say Thank You to Peter for this post:
 
  #17 (permalink)
Just starting out...
Rocky Mountains
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: ZenFire
Favorite Futures: ES
 
systrader's Avatar
 
Posts: 19 since Jun 2009
Thanks: 17 given, 35 received


Peter View Post
Vast, it is a good idea to go for a special name, but then we also need to add that name to the DMAInternal.cs file of the DMA and DMAPaint ... otherwise you cannot use it via the pulldown list with MAs.
I might do that if this v3 proves to work with other people too.


I would like first to have some conformation that:
- they too see the code switch depicted earlier after opening/compiling
- and that this ADXVMAv3 will work for others to solve the flatline
So pls. .... some feedback

If it indeed works I'll remove/adapt the older files and file compilations.

Peter,

Your post really helped - thank you! While renaming the branch of indicators for Sharky I experienced the exact same thing as you. For some reason NT was compiling a renamed ADXVMA differently than the original (per your diff post). I edited the .cs file in notepad per your instructions and it worked. Not much to add other than your "fix" works and that I don't think this is machine dependent; eg. it's an internal issue w/ NT.

Reply With Quote
 
  #18 (permalink)
Elite Member
Brisbane; Australia
 
Futures Experience: Intermediate
Platform: NT
Broker/Data: IB/TDA needing new broker
Favorite Futures: Futures, Forex, Stocks
 
Peter's Avatar
 
Posts: 97 since Jun 2009
Thanks: 91 given, 101 received

Thanks Systrader for confirming that the issue was not related to my machine.

Will ask NT if they are aware.

Reply With Quote
 
  #19 (permalink)
 Vendor: www.innovative-trading-solutions-online.com 
Hartford, CT. USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: AMP/CQG, Kinetick
Favorite Futures: TF
 
RJay's Avatar
 
Posts: 677 since Jun 2009
Thanks: 726 given, 740 received

I have to ask, I noticed the following code,

----------------------------------------------------------------------

[Description("ADXVMA")]
[Gui.Design.DisplayName(
"ADXVMA")]
publicclass ADXVMA : Indicator
{
#region Variables
// Wizard generated variables
privateint aDXPeriod = 6;
// User defined variables (add any user defined variables below)
private DataSeries PDI;
private DataSeries PDM;
private DataSeries MDM;
private DataSeries MDI;
private DataSeries Out;
privatedouble WeightDM;
privatedouble WeightDI;
privatedouble WeightDX;
privatedouble ChandeEMA;
privatedouble HHV = double.MinValue;
privatedouble LLV = double.MaxValue;
#endregion

-----------------------------------------------------------

Why is HHV assigned MinValue and LLV Assigned Maxvalue???

Logically, shouldn't it be the other way around??

RJay

Reply With Quote
 
  #20 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,599 received
Forum Reputation: Legendary

ADXVMA Update


I am trying not create a new thread, as there are already lot of ADXVMA threads in that forum. Recycling this thread now.

I have had a look at the various ADXVMA indicators for NinjaTrader. All of them are coded in a very dirty and inconsistent way. Other than the false initialization already detected by @RJay, there are a number of other problems, which need to be fixed.

Also the try{} catch{} brackets show that the authors are not sure of what they are doing. The period for the indicator is stored 4 times in different redundant variables. Also the code contains a completely useless variable "i", which is set to 0 all the time. This variable points to the MetaTrader origin of the indicator, as it is required for MetaTrade code, if you want to shift the indicator. Ninjatrader does not require that approach and does not make sense to carry that "i" through OnBarUpdate().

Let us say that the code works, but it is clear that probably nobody ever had understood what it is actually doing.

Old ADXVMA code:
 
Code
try
{
	int i = 0;
	PDM.Set( 0 );
	MDM.Set( 0 );
	if(Close[i]>Close[i+1])
		PDM.Set( Close[i]-Close[i+1] );//This array is not displayed.
	else
		MDM.Set( Close[i+1]-Close[i] );//This array is not displayed.
	
	PDM.Set(((WeightDM-1)*PDM[i+1] + PDM[i])/WeightDM);//ema.
	MDM.Set(((WeightDM-1)*MDM[i+1] + MDM[i])/WeightDM);//ema.
	
	double TR=PDM[i]+MDM[i];
	
	if (TR>0)
	{
		PDI.Set(PDM[i]/TR);
		MDI.Set(MDM[i]/TR);
	}//Avoid division by zero. Minimum step size is one unnormalized price pip.
	else
	{
		PDI.Set(0);
		MDI.Set(0);
	}
	
	PDI.Set(((WeightDI-1)*PDI[i+1] + PDI[i])/WeightDI);//ema.
	MDI.Set(((WeightDI-1)*MDI[i+1] + MDI[i])/WeightDI);//ema.
		double DI_Diff=PDI[i]-MDI[i];  
	if (DI_Diff<0)
		DI_Diff= -DI_Diff;//Only positive momentum signals are used.
	double DI_Sum=PDI[i]+MDI[i];
	double DI_Factor=0;//Zero case, DI_Diff will also be zero when DI_Sum is zero.
	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);
	
	if (Out[i]>Out[i+1])
	{
		HHV=Out[i];
		LLV=Out[i+1];
	}
	else
	{
		HHV=Out[i+1];
		LLV=Out[i];
	}
	for(int j=1;j<Math.Min(ADXPeriod,CurrentBar);j++)
	{
		if(Out[i+j+1]>HHV)HHV=Out[i+j+1];
		if(Out[i+j+1]<LLV)LLV=Out[i+j+1];
	}
	
	
	double diff = HHV - LLV;//Veriable reference scale, adapts to recent activity level, unnormalized.
	double VI=0;//Zero case. This fixes the output at its historical level. 
	if (diff>0)
		VI=(Out[i]-LLV)/diff;//Normalized, 0-1 scale.
	
	  
							
	ADXVMAPlot.Set(((ChandeEMA-VI)*ADXVMAPlot[i+1]+VI*Close[i])/ChandeEMA);//Chande VMA formula with ema built in.
}
catch( Exception ex )
{
	Print( ex.ToString() );
}

Recoded (basic version):
 
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]);

I have then added a feature to color the moving average and added paint bars. The direction of the ADXVMA (up, down, neutral) is exposed and can be accessed by other indicators as a trendfilter. The indicator can also applied to any other input series.


The indicator can be downloaded here:

https://futures.io/download/ninjatrader-7/indicators/1198-download.html


Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


Last edited by Fat Tails; June 5th, 2012 at 06:39 PM.
Reply With Quote
The following 16 users say Thank You to Fat Tails for this post:

Reply



futures io > > > > > ADXVMA Questions

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with ADXVMA Optimization hunter548 NinjaTrader Programming 3 July 31st, 2011 04:49 PM
ADXVMA raw code jtrade NinjaTrader Programming 1 March 16th, 2011 10:32 AM
ADXVMA into Tradestation daytrader4 TradeStation 3 January 6th, 2011 04:10 PM
ADXVMA Fibodol NinjaTrader 4 September 21st, 2010 03:37 AM
ADXVMA with Alerts keepdchange Traders Hideout 8 April 12th, 2010 10:27 AM


All times are GMT -4. The time now is 08:57 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-11 in 0.21 seconds with 20 queries on phoenix via your IP 54.83.122.227