Indicator Problem - Question - futures io
futures io futures trading



Indicator Problem - Question


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one mk77ch with 3 posts (2 thanks)
    2. looks_two Tasker_182 with 1 posts (0 thanks)
    3. looks_3 Zondor with 1 posts (4 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 988 views
    2. thumb_up 6 thanks given
    3. group 3 followers
    1. forum 5 posts
    2. 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)

 
Search this Thread
 

Indicator Problem - Question

(login for full post details)
  #1 (permalink)
Switzerland
 
Experience: Advanced
Platform: NinjaTrader
Broker: Dorman
Trading: Currency Futures, ES
 
mk77ch's Avatar
 
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

Attached Files
Register to download File Type: zip fxuTsiMacd.zip (8.1 KB, 5 views)
Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
Neurological explanations for trading Success
Psychology and Money Management
COTbase for quant trading?
Elite Algorithmic NinjaTrader Trading
Second Entry Indicator (Looking for testers/feedback)
NinjaTrader
Which kind of Blockvolume is visible? - order processing
Emini and Emicro Index
SimplerOptions
Trading Reviews and Vendors
 
 
(login for full post details)
  #3 (permalink)
Cedar Rapids, iowa
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Ninjatrader - Continuum
Trading: 6E, TF, 6J
 
Tasker_182's Avatar
 
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>.

Reply With Quote
 
(login for full post details)
  #4 (permalink)
Switzerland
 
Experience: Advanced
Platform: NinjaTrader
Broker: Dorman
Trading: Currency Futures, ES
 
mk77ch's Avatar
 
Posts: 85 since Oct 2010
Thanks: 14 given, 78 received


Tasker_182 View Post
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

Attached Files
Register to download File Type: zip fxuTsiMacd.zip (8.1 KB, 22 views)
Started this thread Reply With Quote
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
 
Zondor's Avatar
 
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
Attached Files
Register to download File Type: cs fxuTsiMacd.cs (11.3 KB, 33 views)
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
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
 
mk77ch's Avatar
 
Posts: 85 since Oct 2010
Thanks: 14 given, 78 received


Zondor View Post
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

Started this thread Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Indicator Problem - Question


Last Updated on April 6, 2013


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts