Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Convert TradeStation XAverage function to Sierra code
The entire code i posted is the XAverage function itself.
I have no idea if its an Exponential Moving Average or not.
If the sierra Exponential Moving Average returns the exact same value with the same given input then i guess that would work.
However the the function appears to call itself at least twice with its previous value XAverage [1]
and I have no idea how to do that.
The SC sc.ExponentialMovAvg() takes in arrays and spits out arrays.
The Tradestation XAverage function does not appear to deal with arrays.
As my calling code in my TS indicator is:
Var1 = (HIGH[2] - LOW[4]) ; //one single value not array
Var2 = HIGH - Var1 ; // one single value not array
Var4 = XAverage (Var2, 6) ; // XAverage returns one single value not an array
I`m guessing that converting the Tradestation function to a SC function must be a very difficult task, since no one has tried.
If someone could take 60 seconds to post a custom created function as a sample template and tell me in where or what file i need to place it in to be able to call it from my indicator code.
I will tackle the difficult task of converting the XAverage to SC code.
In Tradestation if I want a variable.
Variables: Var4(1) ;
Var4 = 1;
If I want to create an Array in Tradestation.
Array: int Var4[2];
Var4[0] = 1
Var4[1] = 2
If tradestation is converting a single created variable into a one dimensional array behind the scenes then i didn't know about that.
I tried to use Var4 as an input to the sc.ExponentialMovAvg and it chocked since Var4 wasn't a manual created array.
Thanks for the code you posted, but it isn't in in the form of a callable function since the XAverage function even calls itself several times.
The code i previous posted is the entire XAverage function itself and i need the converted code to be in the form of a function.
Since I will need to call the converted function several times in my current indicator code and future indicators I need to convert to SC
Do anyone know how to create a SC function that takes 2 inputs an array and an Integer?
Also what file do I place the function in to be able to call it via a indicator or another function?