Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MA doesn't like my indicator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    MA doesn't like my indicator

    Hi all!

    Here's my scenario:
    I have 4 custom indicators that work just fine on the charts, however, when I add them to MA all I get back is the last price of the stock. I'm not certain if I'm adding them wrong to the MA or if my indicators need to be tweaked to work within MA? the indicators are an EMA 8 crossover and their follow up confirmations. I've copied the code for one of them below.

    Thanks in advance!

    Brandon~

    if (CurrentBar < 1) return;

    // Crossover Up Indicator
    if(Close[1] <= EMA(8)[1] && Close[0] > EMA(8)[0])
    {
    DrawTriangleUp(CurrentBar.ToString(), true, 0, (1.02 * (High[0] + TickSize)), Color.LimeGreen);
    }

    #2
    Hello lilzenbca,

    Thanks for your post.

    The Market analyzer will only show dataseries.

    If i understand correctly, in the example, you want the market analyzer to show an indication when the condition if(Close[1] <= EMA(8)[1] && Close[0] > EMA(8)[0]) occurs.

    What you will need to do is create a dataseries and expose that so that the market analyzer will be able to use it in the "plot" selection of the market analyzer.

    There are 4 steps to code the process. For the example I will name the dataseries xup.

    In the region variables:
    private DataSeries xup ; // will hold the +1 signal for cross

    in the initialize section:

    xup = new DataSeries (this) ;

    In the onbarUpdate section:
    if(Close[1] <= EMA(8)[1] && Close[0] > EMA(8)[0])
    {
    DrawTriangleUp(CurrentBar.ToString(), true, 0, (1.02 * (High[0] + TickSize)), Color.LimeGreen);
    xup.Set(+1); // Set the signal for a cross
    }
    else xup.Set(0); // otherwise 0 = no signal

    In the region Properties:

    [Browsable (false)]
    public DataSeries Xup // note capital
    {
    get { return xup;} // note lower case and ;
    }

    Once you have successfully compiled then you can add the indicator to the Market Analyzer. You will find that you can select the dataseries "Xup" in the plot section. So at this point all that will show is 1 or 0. You can then set the market analyzers cell conditions to provide a color and or text display based on the cell = 1.

    Please let me know if I can be of further assistance.
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Segwin, 05-07-2018, 02:15 PM
    14 responses
    1,789 views
    0 likes
    Last Post aligator  
    Started by Jimmyk, 01-26-2018, 05:19 AM
    6 responses
    837 views
    0 likes
    Last Post emuns
    by emuns
     
    Started by jxs_xrj, 01-12-2020, 09:49 AM
    6 responses
    3,293 views
    1 like
    Last Post jgualdronc  
    Started by Touch-Ups, Today, 10:36 AM
    0 responses
    13 views
    0 likes
    Last Post Touch-Ups  
    Started by geddyisodin, 04-25-2024, 05:20 AM
    11 responses
    63 views
    0 likes
    Last Post halgo_boulder  
    Working...
    X