Simple Tradestation coding help, Please

whirl

Newbie
Messages
5
Likes
0
Hello all. Hope all is well.

I am using the ADX indicator. On some packages like Esignal, Ameritrade StrategyDesk, stockcharts.com, there is a place to enter 2 variables: length and smoothing.

However, on Tradestation, they only let you enter the length variable, but not the smoothing. Is there anyone that knows how to code this in TS please? All I need is to take the existing ADX indicator, and allow the smoothing to be added in addition to the length.

I found the formula to implement the smoothing. Apparently it's not just a simple moving average. If anyone could be so kind as to help me code it, since I'm not a programmer.

I got the formula from this webpage: http://www.linnsoft.com/tour/techind/adx.htm

ADXi = [(ADX(i-1) * (n - 1)) + DXi] / n
where n = Smoothing Period
DX = [ 100 * ABS( (+DI) - (-DI) ) ] / ( (+DI) + (-DI) )


This is the formula for the ADX. Notice, there are 2 variables, that can be input:
i: the length (this is something that standard TS and MC can be entered)
n: the smoothing. This is the variable that I wanted to put in that some software allows, but TS and MC's ADX's indicator formula doesn't give a place to enter.

Is there anyone that can code this that can allow both variables to be input? i and n? The standard ADX on TS only allows i.

Much appreciated or if anyone can forward to someone that knows how.
Thanks in advance
 
The ADX in TS is already in a smoothed state based upon the value of Length and is done similar to an exponential average
 
The ADX in TS is already in a smoothed state based upon the value of Length and is done similar to an exponential average

Yes, and no. Yes, the formula itself smooths the DMI. However, it is smoothed only to its own same interval. In other software, they allow you change the smoothing of the ADX to customize it to the one you want.

I don't want the default ADX settings, but to change it. In the formula, they allow a smoothing variable, that I can enter quite easily on something like Esignal, they ask how many periods, and how much to smooth.
But on TS, it only asks the length(period) and don't give you the option of changing the smoothing.
 
oADX = oADX[1] + SF * ( oDMI - oADX[1] ) ;

This is an exponential smoothing of the ADX within the ADX function set. It does use the original length input, but that original input is designed to smooth the last value of the oADX before it is returned to the ADX function so the end result is a smoothed ADX value.

If you want to smooth the ending value of the ADX then, in whatever code you are wishing, simply do

Aver
inputs:
ADX_SmoothLen( 20 ) ;

Average( ADX, ADX_SmoothLen ) ; // Simple
or
XAverage( ADX, ADX_SmoothLen ) ; // Exponential

This would have the effect of double smoothing the ADX value.

I won't charge you $500 for that either. Feel free to take it for free.

If you would like to modify the function itself so that the ADX smoothing used in the function is not the same length as that used in the rest of the equation then this is a very simple 5 minute fix also.
 
Hi SratOpt,

Thanks a lot for your feedback I appreciate it. I will look at your formula and experiment w/ it over the next few months to see how it goes as I do testing.

The thing is, I already been experimenting, backtesting ideas using the standard ADX, with different lengths, and smoothing on other software that allows it. So when I tried using TS, I was surprised they didn't allow me to change the smooting variable. I really need the original ADX to continue my testing, just need to be able to input the smoothing variable

Here's the standard ADX formula agan:
ADXi = [(ADX(i-1) * (n - 1)) + DXi] / n
where n = Smoothing Period
DX = [ 100 * ABS( (+DI) - (-DI) ) ] / ( (+DI) + (-DI) )

Since, the ADX formula is already programmed in TS, I don't think much work needs to be done. Just need to add n as an input variable. I wish I could program myself. A little assistance with this hopefully "quick" fix is much appreciated.
thank you
 
The formula that TS uses is just different. Whenever I use formulas from different sources then one of the first things I will do is plot the differences between the two so that I can get an idea if the results are similar enough to warrant being used in my strategy idea without modifications.

I can change the formula for you that will allow you to pick the smoothing length for the last part of the function. the code in the TS ADX that smooths the ADX value is what I posted above. This calulation shown is what an exponential average does. The only thing is that the smoothing is created as a function of the length ( N ) that creates an Alpha based on 2 / ( N + 1 ). N is determined by the input of Length that is also used in the ADX function wherever a length is needed.

To create a unique length for the final ADX can be done as simply as creating a "new" ADX and adding one input for the length and then down in the function you change the line of code to an xAverage with you new smoothing length and then verify the function and call it in your code. I do not know if that will be what your end needs are, but it really is that simple to do and a person can do that within 5 minutes of programming time. I am not sure where you are in the world, but if we can pick a time where we can connect in a GoToMeeting session, I will show you the whole process of converting this function and you will see for yourself in first person just how fast it can be done.
 
Hi StratOpt,
Again, thank you for responding. I was not aware the formula TS uses is a different formula. I just grabbed the "standard" ADX formula that I found on various websites. I also calculated it by hand to get matching results to what TS shows.

Here is a link that compared Esignal to TS. It shows basically the same #s for the ADX (assuming the same smoothing). The value of ADX in this example is 19.60 for both. http://forum.esignalcentral.com/showthread.php?threadid=24076

One way to test the formula, is to use the default settings for both. If you enter ADX of 14 on TS, it should be the equivalent of 14 length, 14 smoothing. Ergo, in the formula, if you enter 12 length,12 smoothing, it should equal TS input of 12 length and so on. So when creating the new code, the best way to test it is to use the same smoothing #.

Once that "test" is passed, we can try a different setting. For the daily chart of the SPY close Aug,23 we get a close of 18.24 on the ADX(14,14). But if we keep the length, and change the smoothing to say (14,10), I get a value of 18.42 (coincidence opposite of .24, hehe). Hopefully if we can get these numbers to match for reference, then hopefully the formula works.
I am in the states, but never used gotomeeting before. Yes, I hope it's just a simple thing that can be done easily. Looking towards your feedback
thanks very much again
 
Check first to see if you are getting the expected values and then worry about changing and modifying. Are you also a member of the TradeStation forums ?
 
Yes, I can get the standard ADX on both, but I can't get the smoothing on TS because they don't allow me to enter the smoothing input. Sorry I'm not on TS forum as I'm using multicharts not TS.
 
Well, I don't work with MultiCharts, but I am a TradeStation expert. let me know if you can't get it figured out at some point.
 
Top