PDA

View Full Version : Using current indicator for development of new one


maggiej12
02-27-2011, 03:46 PM
Hi -
If i create a new indicator and call it "WilliamsAccumDist" is there i way i can use the indicator by that name in the development of a more complex indicator?
I know for example if i wanted to use the simple moving average when developing a new indicator i can just use its name "SMA" to refer to it in my code.
Is it the same when you use an indicator you develop? or would i need to write out the entire formula for it in my new code?

koganam
02-27-2011, 03:54 PM
Hi -
If i create a new indicator and call it "WilliamsAccumDist" is there i way i can use the indicator by that name in the development of a more complex indicator?
I know for example if i wanted to use the simple moving average when developing a new indicator i can just use its name "SMA" to refer to it in my code.
Is it the same when you use an indicator you develop? or would i need to write out the entire formula for it in my new code?

You just use the name, like you would any other shipping system indicator.

double newValue = WilliamsAccumDist(ParameterList)[0];

gives you the current value

maggiej12
02-27-2011, 04:35 PM
I added the code under my variables and i'm getting an error message:

the name 'ParameterList' does not exist in the current context

eDanny
02-27-2011, 05:36 PM
Maggie, please don't use the sample verbatim. Substitute "ParameterList" with the parameters needed for that indicator ie something like (whatever your indicator needs):
double newValue = WilliamsAccumDist(Close, 7, 14)[0];

maggiej12
02-27-2011, 08:34 PM
thanks, yeah i figured it out

maggiej12
02-27-2011, 08:45 PM
Hi-

I'm am almost done developing my indicator & i have one little thing that needs changed.
I want to take the 30 day Moving Average of my indicator MyWAD. But WAD sometimes can return a negative value and sometimes positive. When i take the moving average of WAD, i dont want the negative to be in the formula. So if WAD for a day is '-15', i just want to use the value '15'. What can i add to this equation to always use WAD as a positive value?
Can anyone help? Thanks

MovAvg.Set(SMA(MyWAD(1), 3)[0]) ;

NinjaTrader_Austin
02-27-2011, 08:52 PM
Maggie, you can use the absolute function value to make any number positive.

double negnumber = -15;
double posnumber;
posnumber = Math.Abs(negnumber);

koganam
02-27-2011, 08:58 PM
Hi-

I'm am almost done developing my indicator & i have one little thing that needs changed.
I want to take the 30 day Moving Average of my indicator MyWAD. But WAD sometimes can return a negative value and sometimes positive. When i take the moving average of WAD, i dont want the negative to be in the formula. So if WAD for a day is '-15', i just want to use the value '15'. What can i add to this equation to always use WAD as a positive value?
Can anyone help? Thanks

MovAvg.Set(SMA(MyWAD(1), 3)[0]) ;

You will have to create a new DataSeries, for example, absWAD; populate it with the absolute values of WAD, then take the SMA of absWAD.

maggiej12
02-27-2011, 09:16 PM
Ok, here's what i have:


MovAvg.Set(SMA((Math.Abs(MyWAD(1)), 3)[0]) ;

I'm getting error messages though saying invalid argument CS1502 & cannot convert from method group to sbyte CS1503.


The other option i came up with is:

double PosWAD;
PosWAD = Math.Abs(MyWAD);

MovAvg.Set(SMA(PosWAD(1), 3)[0]) ;

Error message when i do this is: PosWAD is a variable but is used like a method, Math.Abs has invalid arguments, and cannot convert MyWAD to sbyte.

I dont know what any of this means, can anyone give me any assistance?
Thanks

NinjaTrader_RyanM
02-28-2011, 10:12 AM
Hi maggiej12,

If you want to pass this in as input for SMA, then it must be custom data series as koganam indicates.

We have a sample available on creating your own data series here:
http://www.ninjatrader.com/support/forum/showthread.php?t=7299

Import that sample and then edit to see the structure needed for data series.

maggiej12
02-28-2011, 11:18 AM
Thanks everyone for your help!! I got everything set up & working now!