NexusFi: Find Your Edge


Home Menu

 





Showing a boolean series in the Market Analyzer


Discussion in NinjaTrader

Updated
    1. trending_up 2,230 views
    2. thumb_up 5 thanks given
    3. group 2 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread

Showing a boolean series in the Market Analyzer

  #1 (permalink)
Overview
California
 
Posts: 40 since Dec 2010
Thanks Given: 14
Thanks Received: 4

Hi All

I am trying to get the output of a trendline crossing indicator (i.e. whether a line has been breached) to show up as a 1 or a 0 in the Market Analyzer. If I do it the usual way then the Analyzer thinks the trendline indicator is a normal one that just calculates without any human intervention. I think there may be a way around this by creating a Boolean data series in a primary indicator, and then using a second indicator to read in the Boolean series from the first indicator and converrt it to a plot. Is this doable or is there a smarter way ?

Thanks !!

Overview

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
MC PL editor upgrade
MultiCharts
Cheap historycal L1 data for stocks
Stocks and ETFs
Better Renko Gaps
The Elite Circle
REcommedations for programming help
Sierra Chart
 
  #3 (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



Overview View Post
Hi All

I am trying to get the output of a trendline crossing indicator (i.e. whether a line has been breached) to show up as a 1 or a 0 in the Market Analyzer. If I do it the usual way then the Analyzer thinks the trendline indicator is a normal one that just calculates without any human intervention. I think there may be a way around this by creating a Boolean data series in a primary indicator, and then using a second indicator to read in the Boolean series from the first indicator and converrt it to a plot. Is this doable or is there a smarter way ?

Thanks !!

Overview


There is definitely a smarter way.

The Market Analyzer (and the Strategy Builder) can only read PlotSeries. So what you need to do is to create an additional plot within your indicator. Please set that plot to Color.Transparent because you do not want to see the output on your chart. If you use Color.Transparent NinjaTrader will also not use the plot for the AutoScale property. If the plot is set to Color.Empty, the plot will not be shown, but it will affect the AutoScale properties.

The PlotSeries contains objects of type double. This is a bit luxurious for a BoolSeries, but it will solve our problem.


Attributing values to the PlotSeries

For a trendline cross you would like to know when a signal has occured. So you could for example use the following values:

-> bullish cross = 2.0 (first bar after the fast line has crossed above the slow line)
-> bullish fillter = 1.0 (all other bars when the fast line is above the slow line)
-> bearish cross = -2.0 (first bar after the fast line has crossed below the slow line)
-> bearish filter = -1.0 (all other bars when the fast line is below the slow line)

These values will not be plotted, but they can be accessed via the Market Analyzer.


Accessing the values via the Market Analyzer

I have often made bad experiences when I have checked a double for a specific value. I am only using conditions such as
 
Code
if (x == 2)
{  ; // do something}

when x is an integer. Many NinjaTrader system indicators use the formula
 
Code
if (Math.Abs (x -2) < double.Epsilon)
{  ; // do something}

instead. But this is no solution, as the error can be larger than double.Epsilon, depending on which calculations were performed. In our case we have set the value of the DataSeries field to 2, so there should be no problem checking for 2, but as a general habit, when working with objects of the data type double, I would rather check for the value being greater than 1.5, as this is not affected by any rounding error.

Reply With Quote




Last Updated on September 7, 2012


© 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