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 zstheorist, Today, 07:52 PM
    0 responses
    3 views
    0 likes
    Last Post zstheorist  
    Started by pmachiraju, 11-01-2023, 04:46 AM
    8 responses
    149 views
    0 likes
    Last Post rehmans
    by rehmans
     
    Started by mattbsea, Today, 05:44 PM
    0 responses
    5 views
    0 likes
    Last Post mattbsea  
    Started by RideMe, 04-07-2024, 04:54 PM
    6 responses
    33 views
    0 likes
    Last Post RideMe
    by RideMe
     
    Started by tkaboris, Today, 05:13 PM
    0 responses
    5 views
    0 likes
    Last Post tkaboris  
    Working...
    X