Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

My market analyzer is not working with this indicator

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

    My market analyzer is not working with this indicator

    Hi,

    Not sure what I did wrong in this code but it is not returning +1, 1 or 0 in my market analyzer. I am using 200 bars as look back. Any help is appreciated.

    Part of code below:

    Code:
    protected override void OnBarUpdate()
            {
                if (CurrentBar<3)
                    return;
                
                int dist=1;
                if(TickSize == .01)
                    dist = 20;
                else
                    dist = 2;
                
                
                
                
                if(EMA (Close,20)[0]<WMA (Close,40)[0] && SMA (Close,10)[0]<WMA(Close,40)[0] && SMA (Close,13)[0]<WMA(Close,40)[0] && (EMA (Close,20)[1]>WMA (Close,40)[1] || SMA (Close,10)[1]>WMA(Close,40)[1] || SMA (Close,13)[1]>WMA(Close,40)[1])
    )
                
                {
                    if(soundon)
                        {
                            if (!Historical)
                                PlaySound(soundFile1);
                                
                        }
                    tcdown.Set(-1);
                    DrawText("short"+CurrentBar.ToString(),false, "D", 0, High[0] + (dist * TickSize),10, dnColor, new Font("Wingdings",8f), StringAlignment.Center, Color.Transparent, Color.Transparent, 0);
                }
                
                
                if(EMA (Close,20)[0]>WMA (Close,40)[0] && SMA (Close,10)[0]>WMA(Close,40)[0] && SMA (Close,13)[0]>WMA(Close,40)[0] && (EMA (Close,20)[1]<WMA (Close,40)[1] || SMA (Close,10)[1]<WMA(Close,40)[1] || SMA (Close,13)[1]<WMA(Close,40)[1])
    )
                
                {
                    if(soundon)
                        {
                            if (!Historical)
                                PlaySound(soundFile2);
                                
                        }
                    tcup.Set(1);
                    DrawText("long"+CurrentBar.ToString(),false, "C", 0, Low[0] - (dist * TickSize),-10, upColor, new Font("Wingdings",8f), StringAlignment.Center, Color.Transparent, Color.Transparent, 0);
                }
    
                else
                tcdown.Set(0);
                tcup.Set(0);
                
            }
    Attached Files
    Last edited by wxtrox7; 12-08-2012, 09:33 PM.

    #2
    Hello,

    Could you please further clarify your desired results? Have you set your Plot value under the indicator section of the Market Analyzer to your desired plot?

    I've attached an image of what my market analyzer looks like with the default settings, is this not what you are seeing?

    I look forward to assisting you further.
    Attached Files
    LanceNinjaTrader Customer Service

    Comment


      #3
      No, it is not working as intended. It is only returning value of 0. Should be returning a value of 1 upon thumbs up and a value of -1 on thumbs down. I tested this via replay and it just stays at zero. I also didn't set plot value. I used SET.

      Comment


        #4
        Hello,

        I would suggest you start by simplifying your code down and adding Print() statements along the way to ensure you are getting the results you expect.

        When using your custom data series and removing your logic I was able to print out the correct results (see attached image)

        Also note, your else statement is not formatted properly, you will need brackets if you wish to have both of these tied to the else

        Code:
        else
        {
          tcup.Set(0);
          tcdown.Set(0);
        }
        Please let me know if I can be of further assistance.
        Attached Files
        LanceNinjaTrader Customer Service

        Comment


          #5
          Is there a way to use them together? One column showing tcdown and tcup instead of two as shown in your picture?

          thanks

          Comment


            #6
            Hello,

            You could create a plot which draws a line at 1,0, or -1 and then have it display that number in the MA window.


            The ATR indicator is just one of many indicators that provides a good example of how you can do this.

            Please let me know if I can be of further assistance.
            LanceNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            595 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            343 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            103 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            556 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            554 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X