Trading Articles
Article Categories
Article Tools
Indicator Problem - Question
Updated April 6, 2013
Top Posters
looks_one
mk77ch
with 3 posts (2 thanks)
looks_two
Tasker_182
with 1 posts (0 thanks)
looks_3
Zondor
with 1 posts (4 thanks)
looks_4
Quick Summary
with 1 posts (0 thanks)
trending_up
988 views
thumb_up
6 thanks given
group
3 followers
forum
5 posts
attach_file
3 attachments
Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
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 and simple.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Indicator Problem - Question
(login for full post details)
#1 (permalink )
Switzerland
Experience: Advanced
Platform: NinjaTrader
Broker: Dorman
Trading: Currency Futures, ES
Posts: 85 since Oct 2010
Thanks: 14 given,
78
received
Hello,
Im new to Ninjatrader Programming and today i tried to convert a MetaTrader 4 Indicator to Ninjatrader 7.
When i attach the indicator to a chart, it looks good but with each new bar the values getting wrong.
The MT4 Source Code can be found here: TSI MACD - MQL4 Code Base (TSI_MACD_true, scroll down)
I attached the NT Indicator i made.
I guess the problem is located in the definition of the current bar [0] and [-1] but i really dont know what exactly is wrong.
Code
rawMtmBuffer[0] = MACD(fast,slow,signal)[0] - MACD(fast,slow,signal)[-1];
absMtmBuffer[0] = Math.Abs(rawMtmBuffer[0]);
emaRawMtmBuffer[0] = EMA(rawMtmBuffer,first_R)[0];
emaAbsMtmBuffer[0] = EMA(absMtmBuffer,first_R)[0];
ema2RawMtmBuffer[0] = EMA(emaRawMtmBuffer,second_S)[0];
ema2AbsMtmBuffer[0] = EMA(emaAbsMtmBuffer,second_S)[0];
if(ema2AbsMtmBuffer[0] != 0.0)
{
tsiBuffer[0] = -100.0 * (ema2RawMtmBuffer[0] / ema2AbsMtmBuffer[0]);
}
signalBuffer[0] = WMA(tsiBuffer,signalPeriod)[0];
TsiMacd.Set(tsiBuffer[0]);
TsiSignal.Set(signalBuffer[0]);
it would be great if somebody of you could give me a hint how i could fix this.
thank you!
mike
Can you help answer these questions from other members on futures io?
Best Threads (Most Thanked) in the last 7 days on futures io
(login for full post details)
#3 (permalink )
Cedar Rapids, iowa
Experience: Intermediate
Platform: Ninjatrader
Broker: Ninjatrader - Continuum
Trading: 6E, TF, 6J
Posts: 593 since Aug 2009
Thanks: 430 given,
1,142
received
Zero refers to the current bar, 1 refers to the previous bar, -1 refers to a future bar. Are you trying to predict the future? <grin>.
(login for full post details)
#4 (permalink )
Switzerland
Experience: Advanced
Platform: NinjaTrader
Broker: Dorman
Trading: Currency Futures, ES
Posts: 85 since Oct 2010
Thanks: 14 given,
78
received
Tasker_182
Zero refers to the current bar, 1 refers to the previous bar, -1 refers to a future bar. Are you trying to predict the future? <grin>.
thank you very much that fixed the problem ;-)
i attach the working indicator here so maybe someone find it useful.
cheers,
mike
The following 2 users say Thank You to mk77ch for this post:
(login for full post details)
#5 (permalink )
Portland Oregon, United States
Experience: Beginner
Platform: Ninjatrader®
Broker: CQG, Kinetick
Trading: Gameplay Klownbine® Trading of Globex
Posts: 1,347 since Jul 2009
Thanks: 1,245 given,
2,721
received
I made some changes that will tremendously improve its performance.
There is information about efficient coding in this thread.
"If we don't loosen up some money, this sucker is going down." -GW Bush, 2008
“Lack of proof that something is true does not prove that it is not true - when you want to believe .” -Humpty Dumpty, 2014
“The greatest shortcoming of the human race is our inability to understand the exponential function.” Prof. Albert Bartlett
The following 4 users say Thank You to Zondor for this post:
(login for full post details)
#6 (permalink )
Switzerland
Experience: Advanced
Platform: NinjaTrader
Broker: Dorman
Trading: Currency Futures, ES
Posts: 85 since Oct 2010
Thanks: 14 given,
78
received
Zondor
I made some changes that will tremendously improve its performance.
There is information about efficient coding in this thread.
thank you very much!
as im new to ninjatrader coding this helps a lot!
cheers,
mike
Last Updated on April 6, 2013
Right now
Ongoing
Right now
March
Register to Attend
Elite only
Coming soon
April