If it's easy or something could someone post one?
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Volume Weighted EMA?
Collapse
X
-
Originally posted by GGAG33 View PostI spent 10+ hours trying to make one or figure it out and just couldn't figure out what I was doing wrong.
If it's easy or something could someone post one?
Have you tried our regular VWMA? This is like a normal SMA, but weighted by volume.
Do you mind sharing any references you have for the Vol Weighted EMA you are talking about?
Thanks!BertrandNinjaTrader Customer Service
-
Can you at least translate it into how Ninjatrader calculates it for me?
Here's the formula.
VWEMA(t-1) + (K * [Price(t) * Volume(t) - VWEMA(t-1])
------------------------------------------------------
VWEMA(t-1) (K * [Volume(t) - VWEMA(t-1)
So can anyone translate into something that Ninjatrader would understand?
Comment
-
As a last resort you can try one of the 3rd party NinjaScript Consultants here: http://www.ninjatrader.com/webnew/pa...injaScript.htmJosh P.NinjaTrader Customer Service
Comment
-
Originally posted by mrlogik View PostGGA,
Can you post the code.
In order to translate this, we would need to know what
- t is
- K is
T - 1 is the past bar
K is 2 / (Period + 1)
And I have nothing worthy of posting because its just 20+ errors in them + I can't figure out how the hell Ninjatrader calculates a EMA because it looks nothing like the real equation...
This is Ninjatraders : Input[0] : Input[0] * (2.0 / (1 + Period)) + (1 - (2.0 / (1 + Period))) * Value[1]
Normal: EMA(t - 1) + (K x [Price(t) - EMA(t - 1)]
I suggest you guys change it, because all the other platforms I have tried besides this one is self explanatory. Most of the time it takes me like 10-15 minutes.
Comment
-
Originally posted by NinjaTrader_Josh View PostGGAG33,
That is standard C# code. NinjaTrader is not built on a simple scripting language. You have the full power of a true programming language at your finger tips.
It says nothing about it.
Comment
-
Originally posted by NinjaTrader_Josh View Post
Look right?
Comment
-
GGAG33,
You will have to test the accuracy of the code yourself. We are not experts on the format you are trying to convert from and as such we are not in a position to advise you. Please see this tip on debugging that you can use to help determine if you are getting accurate values: http://www.ninjatrader-support.com/v...ead.php?t=3418Josh P.NinjaTrader Customer Service
Comment
-
Okay you guys I'm having a problem...
This is happening, but it only happens if I have the Volume[0] added to the regular EMA equation.
Any suggestions on how I can fix it.
Value.Set(CurrentBar == 0 ? Input[0] : Input[0] * Volume[0] * (2.0 / (1 + Period)) + (1 - (2.0 / (1 + Period))) * Value[1]);
Comment
-
Originally posted by GGAG33 View PostThis is happening, but it only happens if I have the Volume[0] added to the regular EMA equation.
That first formula you posted in this thread isn't even correct. A volume-weighted average is simply
(average of price*volume) / (average volume).
It doesn't matter if you calculate the 'average' as simple average, exponential average, or some other smoothing method. In your case, you want EMA(price*volume)/EMA(volume).
Once you understand what the indicator means, it becomes clear how to implement it. I'd do it something like this:
Code:(variables) private DataSeries pv; (initialization) pv = new DataSeries(this); (onbarupdate) pv.Set(Input[0] * Volume[0]); double vema = EMA(Volume,period)[0]; if (vema == 0.0) vema=1.0; Value.Set(EMA(pv,period)[0] / vema);
-AlexLast edited by anachronist; 10-08-2008, 10:52 AM.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by fx.practic, 10-15-2013, 12:53 AM
|
5 responses
5,404 views
0 likes
|
Last Post
by Bidder
Today, 12:22 AM
|
||
Started by Shai Samuel, 07-02-2022, 02:46 PM
|
4 responses
95 views
0 likes
|
Last Post
by Bidder
Today, 12:11 AM
|
||
Started by DJ888, Yesterday, 10:57 PM
|
0 responses
8 views
0 likes
|
Last Post
by DJ888
Yesterday, 10:57 PM
|
||
Started by MacDad, 02-25-2024, 11:48 PM
|
7 responses
159 views
0 likes
|
Last Post Yesterday, 10:23 PM | ||
Started by Belfortbucks, Yesterday, 09:29 PM
|
0 responses
8 views
0 likes
|
Last Post
by Belfortbucks
Yesterday, 09:29 PM
|
Comment