Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom Indicator in Market Analyzer

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

    Custom Indicator in Market Analyzer

    Hello.

    I have a custom indicator that draws chart arrows based on a set of relationships in the code. How do I define a special condition to have Market Analyzer notify me of those signals? The sample videos refer to numeric values. Like CCI > 30, etc. My indicator signals are not based on a numeric relationship.

    It is more like this ..

    if( Direction == 2 && _arrowDir != "up" ) Then DrawArrowUp ..

    How do I set up special conditions under MA to capture this relationship?

    #2
    Hello rcsingleton,

    Thanks for your post.

    What you would do is to add a transparent plot to your indicator that you could then select in the market analyzer.

    The plot would be set to some value that you can then relate to the logic used. For example:

    if( Direction == 2 && _arrowDir != "up" )
    {
    DrawArrowUp(...);
    Value.Set(1); // set the plot to + 1 for this condition
    }

    For the down condition you could set -1 and for no condition you could set 0. If you have other conditions then you can make them any value such as -2 or 3, etc.

    In the Market analyzer then when you add the indicator, you would select the transparent plot and then set your \cell condition to look for the +1, 0, -1 conditions and react accordingly.

    For a simple example of this, look at the code of the CandleStickPattern indicator. It will produce a +1 on a transparent plot when the pattern selected is found, otherwise a 0 (zero)
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply.

      What if I have more than one Plot in the indicator? In "CandleStickPattern" the transparent plot is the only one. But what is the proper syntax for Value.Set(1) if the transparent Plot is the second one?

      In other words, how do I make sure that the Value for the transparent Plot is the one updated?

      Comment


        #4
        Hello rcsingleton,

        Thanks for your reply.

        When you only have one plot then it would use Value. When you have multiple plots then you would use Values[n] where n is the plot number. The plots are number by the order they are listed/ added. so the first plot would be Value, the next plot added would relate to Values[1], then Values[2], etc.

        Take a look at the Bollinger indicator code for an example of a multi plot indicator coding. Observe the order that the plots are added. Note that in the region "properties" that Values[n] is used to get/set the public dataseries with the plot name. In the OnBarUpdate section, the plot is actually set by the dataseries name, using the Bollinger code as an example here are how the three plots are set:

        Upper.Set(smaValue + NumStdDev * stdDevValue); // Values[0] (or could be just Value)
        Middle.Set(smaValue); // Values[1]
        Lower.Set(smaValue - NumStdDev * stdDevValue); // Values[2]

        So in your indicator, you would add a plot with a name and a color of transparent. In the OnBarUpdate you would set the value to the name of the plot dataseries. In the properties region you could have the plot name linked to Values[1] if this is the 2nd plot.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          I think I've got it.

          protected override void Initialize()
          {
          Add(new Plot(Color.Transparent, "Signal Found"));
          }

          ..

          if( condition is met )
          {
          Signal.Set(1);
          }

          Thanks.

          Comment


            #6
            Hello rcsingleton,

            Thanks for your reply.

            Almost. The plot name must match in all three areas and must be one name.

            protected override void Initialize()
            {
            Add(new Plot(Color,Red, "OriginalPlot"));
            Add(new Plot(Color.Transparent, "SignalFound")); // this is the new plot
            }

            ..

            if( condition is met )
            {
            SignalFound.Set(1);
            }
            ...

            #region Properties

            [Browsable(false)]
            [XmlIgnore()]
            public DataSeries SignalFound // this is the new plot
            {
            get { return Values[1]; }
            }
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Belfortbucks, Today, 09:29 PM
            0 responses
            3 views
            0 likes
            Last Post Belfortbucks  
            Started by zstheorist, Today, 07:52 PM
            0 responses
            7 views
            0 likes
            Last Post zstheorist  
            Started by pmachiraju, 11-01-2023, 04:46 AM
            8 responses
            150 views
            0 likes
            Last Post rehmans
            by rehmans
             
            Started by mattbsea, Today, 05:44 PM
            0 responses
            6 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
             
            Working...
            X