NexusFi: Find Your Edge


Home Menu

 





Help - how can I use Dataseries wich are calulate by an other Indicator?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Fat Tails with 6 posts (3 thanks)
    2. looks_two Trendseek with 5 posts (1 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 gunsnmoney with 1 posts (0 thanks)
    1. trending_up 6,009 views
    2. thumb_up 4 thanks given
    3. group 3 followers
    1. forum 12 posts
    2. attach_file 5 attachments




 
Search this Thread

Help - how can I use Dataseries wich are calulate by an other Indicator?

  #11 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103

You are right, I have not answered your original question.

So let us assume that you have a Bollinger indicator BollingerIND that uses a moving average and you want to call this moving average from within your standard deviation indicator StdDevIND. That is pretty simple, just call it:

 
Code
 
double average = BollingerIND(1, Period).Middle[0];
 
// 1 stands for numStdDev which is not required for the average, 
// but expected as input by the method
I had to modify the original Bollinger Band indicator, because for unknown reasons for each of the properties there is a line preventing serialization, so the StdDevIND indicator could not be exported.

 
Code
 
[XmlIgnore()]
Indicators and chart attached.

Attached Thumbnails
Click image for larger version

Name:	StdDevIND.jpg
Views:	191
Size:	90.7 KB
ID:	19503  
Attached Files
Elite Membership required to download: StdDevIND.zip
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
REcommedations for programming help
Sierra Chart
ZombieSqueeze
Platforms and Indicators
What broker to use for trading palladium futures
Commodities
 
  #12 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103

Learned something new:


[The XmlIgnore()] has an impact on exporting indicators. If you leave this command in front of a property, the indicator will not be automatically called, when it is exported.

Example: The Bollinger indicator has the [XmlIgnore()] command set for all its DataSeries, as shown below

 
Code
 
/// <summary>
/// Get the middle value.
/// </summary>
[Browsable(false)]
[XmlIgnore()]
public DataSeries Middle
{
get { return Values[1]; }
}
If another indicator calls Bollinger.Middle, this indicator cannot be exported via File -> Utilities -> Export NinjaScript,

unless

you select Bollinger manually and add it to the file list to be exported.

This behaviour is caused by [XmlIgnore()] for whatever reasons. Referencing of other indicators that do not contain this command is no problem, NinjaTrader will add them automatically when exporting.

File below could be exported by adding Bollinger manually.

Attached Files
Elite Membership required to download: StdDevIND.zip
Reply With Quote
Thanked by:
  #13 (permalink)
 Trendseek 
Leipzig / Germany
 
Experience: Intermediate
Platform: NT / TS, MC and Clones
Broker: Interactive Broker
Trading: Futures, Forex
Posts: 28 since Aug 2009
Thanks Given: 46
Thanks Received: 36


Hallo Fat Tails
thanks again for your last .cs - files.

this thread become more and more interesting for me....
checking your files gives me some new ideas and questions about visability and accessibility of DataSeries


Your last Indicator (StdDevIND) would be perfect, if I could put the desired Moving-Average-Dataseries in the Statement, which calls the modified StdDev. Something like:

double StdDevValue = StdDevInd(maseries, period);


For my customized Bollinger-Band I use a special Method for that purpose:

 
Code
//Calculate the StdDev for a specific MA-Series
        private double sdvalue (DataSeries maseries, int period)
        {
            if (CurrentBar < period)return 0;            
            double sum = 0;
              //for (int count = 0; count < period  ; count++)
            for (int count = period-1; count >= 0; count --)
            {                    
                double diff = Math.Abs(Input[count] - maseries[0]);
                sum += diff * diff;
            }
            return (Math.Sqrt(sum / period));
        }
Unfortunaly the StdDev shows unexpected behavior:
The Chart shows the "StdDev-Bands" for a SMA (the orange-one) and a "faster" MA (the yellow-one).
I suppose, that the differences between Datas and the MA becomes smaller, by using a faster MA. The opposite is true!

It is nice to playing around with that new anaBollinger - but I personaly think, that the SMA is more or less the best choice for playing with the Bands.


Best
Trendseek

Attached Thumbnails
Click image for larger version

Name:	mad bollinger.jpg
Views:	158
Size:	90.9 KB
ID:	19657  
Started this thread Reply With Quote




Last Updated on September 3, 2010


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts