Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 wzgy0920, 02-22-2024, 01:11 AM
            5 responses
            32 views
            0 likes
            Last Post wzgy0920  
            Started by wzgy0920, Yesterday, 09:53 PM
            2 responses
            49 views
            0 likes
            Last Post wzgy0920  
            Started by Kensonprib, 04-28-2021, 10:11 AM
            5 responses
            191 views
            0 likes
            Last Post Hasadafa  
            Started by GussJ, 03-04-2020, 03:11 PM
            11 responses
            3,230 views
            0 likes
            Last Post xiinteractive  
            Started by andrewtrades, Today, 04:57 PM
            1 response
            14 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Working...
            X