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
Sma formula with ninjatrader 7 and anomolies
Collapse
X
-
Thank you.
Last question is what is
What is Value[1]; ???
What is Input[0]; ???
Leave a comment:
-
Hello ballboy11,
Thank you for your note.
The calculation to get the SMA is the same.
I'm not sure what you are trying to achieve through writing your own SMA method vs using Ninja's however I would suggest you add print statements to your for loop to identify your mistake.
Please let us know if you need further assistance.
Leave a comment:
-
Sma formula with ninjatrader 7 and anomolies
I am programming an indicator for a client and I need to know a few things.
Did ninjatrader change the SMA algorithm ever?
I have an indicator that was made years ago to get SMA information and plot it out. It looks very close but there are a couple of spike anomolies. If indicator on the top is reading an SMA indicator from ninjatrader and the indicator on the bottom is reading and SMA indicator from ninjatrader How can I get different information.
secondly i tried to manually make an sma algorithm to see if it gives the same information.
double FindSMA(int nPeriod)
{
double dSMA = 0;
for(int x= 0; x< nPeriod; x++)
{
dSMA = dSMA + Close[nPeriod];
}
dSMA = (double)dSMA/ nPeriod;
return dSMA;
}
This gives totally different information than what Ninjatrader shows. My charts are not the same.
Lastly what are these parameters
double last = Value[1] * Math.Min(CurrentBar, Period);
if (CurrentBar >= Period)
Value.Set((last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period));
else
Value.Set((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
What is Value[1]; ???
What is Input[0]; ???
If the pictures below are both Ninjatrader SMA indicators then why is the plotting anomalies exist
Formula SMA(120)[0];Last edited by ballboy11; 10-09-2017, 08:07 AM.Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by cmtjoancolmenero, Yesterday, 03:58 PM
|
2 responses
19 views
0 likes
|
Last Post Today, 07:24 AM | ||
Started by Stanfillirenfro, Today, 07:23 AM
|
0 responses
2 views
0 likes
|
Last Post Today, 07:23 AM | ||
Started by olisav57, Yesterday, 07:39 PM
|
1 response
9 views
0 likes
|
Last Post Today, 07:23 AM | ||
Started by cocoescala, 10-12-2018, 11:02 PM
|
7 responses
942 views
0 likes
|
Last Post
by Jquiroz1975
Today, 07:21 AM
|
||
Started by oviejo, Today, 12:28 AM
|
1 response
12 views
0 likes
|
Last Post Today, 07:20 AM |
Leave a comment: