Normalizing output from Indicators - NinjaTrader Programming | futures io social day trading
futures io futures trading


Normalizing output from Indicators
Updated: Views / Replies:1,637 / 2
Created: by Trader.Jon Attachments:1

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Reply
 
Thread Tools Search this Thread
 

Normalizing output from Indicators

  #1 (permalink)
Elite Member
Near the BEuTiFULL Horse Shoe
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 176 received

Normalizing output from Indicators

Greetings! AND Happy Thanksgiving Day to those celebrating!! Hope you had a wonderful time!!!!

I ran into set of errors in a strategy I was building, and narrowed down the issue to two small sections of code.

The sections are both in the 'short' side of the strategy, and because the indicator generating the code (Empirical Mode Decomposition) has lots of decimals in the output (using ForEx), I modified in the code to compensate, so now I have a more workable (roughly) range of +300 to -300 ... but still have the ' object reference not set to an instance of an object.' when I run the strategy. I am 99.44% sure it is not in the strategy code itself because the same components & calculations are in other lines that work without any problems, and a change as simple as changing '<' to '>' cures the problem, but changes the strategy results

What I would like to accomplish is to 'normalize the data output from the indicator, to have all positive values, without changing the waveform that is currently being produced. I did a bit of google on this, but I cant understand the math involved ... so I am looking for a small assist from somebody more clever :sos:

the .cs of the modified indicator is attached ... it does compile as is in NT7rc1 and charts fine .. the code section that needs modification is
 
Code
                            
     protected override void OnBarUpdate()

        {
            if (
CurrentBar == 0)
            {
                
beta Math.Cos(Math.PI Period);
                
gamma Math.Cos(Math.PI Delta Period);
                
alpha gamma Math.Sqrt(Math.Pow(gamma2) - 1);
            }
            
            if (
CurrentBar 51)
            {
                
BP.Set(0);
                
Peak.Set(0);
                
Valley.Set(0);
                return;
            }

            
BP.Set(0.5 * (alpha) * ((((High[0] + Low[0]) / 2) - ((High[2] + Low[2]) / 2))*1000000) + beta * (alpha) * BP[1] - alpha BP[2]);
            
            
mean jhlEMA(BP2*Period)[0];
            
            
Peak.Set(Peak[1]);
            
Valley.Set(Valley[1]);
            
            if (
BP[1] > BP[0] && BP[1] > BP[2])
                
Peak.Set(BP[1]);
            if (
BP[1] < BP[0] && BP[1] < BP[2])
                
Valley.Set(BP[1]);
            
            
avgPeak jhlEMA(Peak50)[0];
            
avgValley jhlEMA(Valley50)[0];
            
            
UpperBand.Set(avgPeak Fraction);
            
LowerBand.Set(avgValley Fraction);
            
MainPlot.Set(mean);
            
MidLine.Set(((avgPeak Fraction) + (avgValley Fraction))/2);
        } 
the BT.Set calculation is the one that needs to be tamed

Any additional input is always welcome!
TJ

Attached Files
Register to download File Type: cs EMDT.cs (10.1 KB, 21 views)
Reply With Quote
The following 2 users say Thank You to Trader.Jon for this post:
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
 Vendor: www.integrity-traders.com 
East Rochester, NY
 
Futures Experience: Intermediate
Platform: NT
 
eDanny's Avatar
 
Posts: 327 since Jul 2009
Thanks: 17 given, 419 received



Trader.Jon View Post
Greetings! AND Happy Thanksgiving Day to those celebrating!! Hope you had a wonderful time!!!!

I ran into set of errors in a strategy I was building, and narrowed down the issue to two small sections of code.

The sections are both in the 'short' side of the strategy, and because the indicator generating the code (Empirical Mode Decomposition) has lots of decimals in the output (using ForEx), I modified in the code to compensate, so now I have a more workable (roughly) range of +300 to -300 ... but still have the ' object reference not set to an instance of an object.' when I run the strategy. I am 99.44% sure it is not in the strategy code itself because the same components & calculations are in other lines that work without any problems, and a change as simple as changing '<' to '>' cures the problem, but changes the strategy results

What I would like to accomplish is to 'normalize the data output from the indicator, to have all positive values, without changing the waveform that is currently being produced. I did a bit of google on this, but I cant understand the math involved ... so I am looking for a small assist from somebody more clever :sos:

the .cs of the modified indicator is attached ... it does compile as is in NT7rc1 and charts fine .. the code section that needs modification is
 
Code
                            
     protected override void OnBarUpdate()
        {
            if (
CurrentBar == 0)
            {
                
beta Math.Cos(Math.PI Period);
                
gamma Math.Cos(Math.PI Delta Period);
                
alpha gamma Math.Sqrt(Math.Pow(gamma2) - 1);
            }
            
            if (
CurrentBar 2)return; //<=====

           // if (CurrentBar < 51)
           // {
            //    BP.Set(0);
            //    Peak.Set(0);
             //   Valley.Set(0);
             //   return;
             //}

            
BP.Set(0.5 * (alpha) * ((((High[0] + Low[0]) / 2) - ((High[2] + Low[2]) / 2))*1000000) + beta * (alpha) * BP[1] - alpha BP[2]);
            
            
mean jhlEMA(BP2*Period)[0];
            
            
Peak.Set(Peak[1]);
            
Valley.Set(Valley[1]);
            
            if (
BP[1] > BP[0] && BP[1] > BP[2])
                
Peak.Set(BP[1]);
            if (
BP[1] < BP[0] && BP[1] < BP[2])
                
Valley.Set(BP[1]);
            
            if (
CurrentBar 50)return;  //<====

            
avgPeak jhlEMA(Peak50)[0];
            
avgValley jhlEMA(Valley50)[0];
            
            
UpperBand.Set(avgPeak Fraction);
            
LowerBand.Set(avgValley Fraction);
            
MainPlot.Set(mean);
            
MidLine.Set(((avgPeak Fraction) + (avgValley Fraction))/2);
        } 
the BT.Set calculation is the one that needs to be tamed

Any additional input is always welcome!
TJ

I don't know about your original problem but if you make the above changes to the indicator it will be accurate from the beginning of the plots.

Dan

Reply With Quote
The following 3 users say Thank You to eDanny for this post:

Reply



futures io > > > > > Normalizing output from Indicators

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shale Boom in Texas Could Increase U.S. Oil Output kbit News and Current Events 0 May 28th, 2011 07:13 PM
Saudi Slashes Oil Output; Says Market Oversupplied Quick Summary News and Current Events 0 April 17th, 2011 10:10 PM
[NinjaTrader] Calculating the MAE and MFE for output Jura The Elite Circle 11 February 16th, 2011 10:44 AM
Japan Industrial Output Rises For First Time in 6 Months Quick Summary News and Current Events 0 December 27th, 2010 10:30 PM
Redirect Print output to my logger dimkdimk NinjaTrader Programming 1 January 14th, 2010 05:43 AM


All times are GMT -4. The time now is 06:56 PM.

Copyright © 2017 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
Page generated 2017-12-13 in 0.09 seconds with 20 queries on phoenix via your IP 54.90.92.204