Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Tick Counter 2 Alert

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

    Tick Counter 2 Alert

    Hi. I am incredibly dense with Ninja script.

    To my great surprise I managed to paste in an alert command into the Tick Counter 1 last week. It worked!! Now I still couldn't figure out how to get the number of ticks left that trigger the alarm into a menu panel so that you can change it in the Indicator menu when you change tick charts or markets, but at least it worked.

    So I tried pasting in the same code into the TickCounter2 but it just won't compile and I have no idea what to do having played around with various things.

    I wonder if anyone would like to take a crack at it?

    My insert into TickCounter1 (which I copied in from someone else's code for something else) was:

    // Plot the tick count message to the lower right hand corner of the chart
    if (Bars.Period.Id == PeriodType.Tick)
    {
    double tickCount = ShowPercent ? CountDown ? (1 - Bars.PercentComplete) * 100 : Bars.PercentComplete * 100 : CountDown ? Bars.Period.Value - Bars.TickCount : Bars.TickCount;
    graphics.DrawString((CountDown ? " Ticks remaining = " + tickCount : "Tick count = " + tickCount) + (ShowPercent ? "%" : ""), ChartControl.Font, textBrush, bounds.X + bounds.Width - textWidth, bounds.Y + bounds.Height - textHeight, stringFormat);
    // Generates an alert
    if (tickCount<=5)
    {Alert("TickBarAlert", NinjaTrader.Cbi.Priority.High, "Tick Bar End", "Alert1.wav", 2, Color.Black, Color.Yellow);
    }

    The part that I inserted begins with // Generates an alert ...... ends with that last }.

    But it won't go into the TickCounter2 code which is somewhat different because of all the nifty new things that have been added to it.

    Thxs.

    Ash.

    #2
    Ash,

    I am not sure what TickCounter2 is. It sounds like a 3rd party custom indicator. You may want to try and contact the original author of it to see if there are any caveats you should be aware of and guidance in general with their script.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      TickCounter is the indicator that comes with Ninja. TickCounter2 is a new version recently put out by MJT and now available in the File Sharing area at


      The indicator link for download is:



      It is not a 3rd Party Custom Indicator as far as I understand it although in going back to the page I now realise that it looks like you guys did not put it out officially to replace the first one that comes with the program.
      Last edited by cclsys; 02-09-2009, 11:23 AM.

      Comment


        #4
        cclsys,

        Anything created by a community member and posted to the file sharing section is a 3rd party indicator. You will need to contact the original author for support on this.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Josh, I haven't come on the forum much because I am no good at Ninja coding (obviously). But do I understand from your reply that the forum is not a place for people to work on little problems like this? I figured that somebody might like to do this simple thing (for those that know how). All I'm talking about is adding an alert line to the code that's already out there. It's not exactly 'support for a third party indicator'.

          Comment


            #6
            How about if I do it this way?:

            I have some code here that works as part of an Indicator that counts the ticks remaining in a tick chart bar.

            // calculate the tick count value
            double tickCount = ShowPercent ? CountDown ? (int)((1 - Bars.PercentComplete) * 100) : (int)(Bars.PercentComplete * 100) : CountDown ? Bars.Period.Value - Bars.TickCount : Bars.TickCount;
            // Generates an alert
            ///if (tickCount <= 5)
            /// {Alert("TickBarAlert", NinjaTrader.Cbi.Priority.High, "Tick Bar End", "Alert1.wav", 2, Color.Black, Color.Yellow}


            In the last three lines beginning // Generates and alert ...... down to Color.Yellow }

            I tried to add in an alert but it just won't 'take' even though the same lines worked fine in another code. I suspect it has something to do with the word 'tickCount' but just can't figure it out.

            Can anyone help me with this so I can get an alert to work in there?

            The full code is linked in a couple of posts earlier for anyone who wants/needs to look at the whole thing.

            Comment


              #7
              cclsys,

              The forums is a place to ask questions, but when you are trying to modify someone elses script there is no way we can offer you support in this regard. We just don't have the bandwidth to be going through every forum member's code and figuring out how it works to be able to assist in modifications to their indicators. You would need to ask the original author. Thank you for understanding.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                So I gather from your answer then that you cannot use the forum for getting help with coding problems? I can understand if you have a company policy at Ninja not to help people but does that go for everyone in the Ninja community as well?

                Frankly, I don't understand. Why call it a 'support forum' when support is disallowed and the forum is not used for people to pool ideas and resources as a 'forum' literally is supposed to do. Strange approach.

                But if that's the way it is, so be it.

                Comment


                  #9
                  As mentioned, we can help with coding problems. You are asking for help on how to modify another persons indicator. I cannot assist you in modifying other people's code. We do not have the bandwidth to assess what other people are doing in their code and as such are not qualified to answer any questions regarding their 3rd party code. You need to contact the original author for how their code works.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_Josh View Post
                    cclsys,

                    The forums is a place to ask questions, but when you are trying to modify someone elses script there is no way we can offer you support in this regard. We just don't have the bandwidth to be going through every forum member's code and figuring out how it works to be able to assist in modifications to their indicators. You would need to ask the original author. Thank you for understanding.
                    I was replying whilst you were posting this which is confusing so I put this last one in quotes above.

                    Frankly, I don't really understand.

                    First, it is not really so much 'modifying somebody else's script' as trying to learn how to put in an alert. I pasted in the snippet from the help menu and it worked in one code, but now I can't get it to work. Mystery.

                    Second, I understand that Ninja staff can't help with putting in an alert code if that is your policy for some reason, but it seems you feel your job is to reply to every post saying 'we can't help'.

                    My point is: maybe other members of the forum who are NOT Ninja employees would like to take a crack at this, in which case you don't have to keep replying saying 'we don't help with this.' Just say nothing and let the thread maybe solve the problem or not.

                    Unless your reply is also saying: 'we do not want anyone asking questions about coding on this 'Ninja Support Forum'' because of bandwidth.

                    Is that really how you want the forum to be? If you do, of course I can accept that, but I do feel that it is unnecessarily restrictive in that it hinders people learning more skills in relation to your platform thereby making it more popular.

                    But if you insist that people can't use the forum as a resource to work with coding issues, especially given how hard Ninja is to work with for those new to it, as I said before:

                    so be it!

                    For some reason it has taken me a while to figure out that you shouldn't think of the Ninja Forum as a place to work on coding problems.

                    Comment


                      #11
                      cclsys,

                      You copied code to our system indicator. It worked. If it didn't work we could assist because we know what variables and how things work in the system indicator. You try and copy it to another person's code. It doesn't work. I do not have the bandwidth to be opening everyone's code and analyzing it to figure out why it doesn't work for you. If it doesn't work there could be a whole host of reasons as to why it didn't work, all of which stem from the author's modifications. I do not know what the author modified and as such am not qualified to answer your questions. You need to contact the original author. You need to outline what you are trying to achieve and ask the author as to where in their code is the most appropriate place to insert such changes. NT support staff cannot evaluate these situations for you.

                      When I say we do not have the bandwidth it means support staff cannot assist you in trying to comprehend another member's code. By no means does this mean other forum members cannot assist you.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        cclsys,
                        If you copy your alert code from your first post, and insert it after line 112, it should work OK. That places your new code immediately after the tick count is performed.

                        Comment


                          #13
                          MJT. Thanks for yr reply and msg.

                          That's exactly where I have it and it doesn't work, hence why I am mystified.

                          Here is the section with my insert:

                          // calculate the tick count value
                          double tickCount = ShowPercent ? CountDown ? (int)((1 - Bars.PercentComplete) * 100) : (int)(Bars.PercentComplete * 100) : CountDown ? Bars.Period.Value - Bars.TickCount : Bars.TickCount;
                          /// Generates an alert
                          /// if (tickCount <= 5)
                          /// {Alert("TickBarAlert", NinjaTrader.Cbi.Priority.High, "Tick Bar End", "Alert1.wav", 2, Color.Black, Color.Yellow}

                          // draw the text

                          I included down to the last line 'draw the text' above so you can see where mine ends.

                          Now it looks to me like 'tickCount' is the variable/double so if you say 'if tickCount < 5, alert etc.' it should work. But for some reason it doesn't. It is looking for a ) and a 'statement' in line 114; I had put it all on one line so moved it back to how it is above:

                          I also note that if I make it all into one line or move the last bracket down one line to line up with the first one that there are different error messages even though the code is the same. Tricky lingo eh?!

                          Comment


                            #14
                            /// if (tickCount <= 5)
                            /// {Alert("TickBarAlert", NinjaTrader.Cbi.Priority.High, "Tick Bar End", "Alert1.wav", 2, Color.Black, Color.Yellow}

                            You have the lines commented out.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #15
                              Josh wrote:
                              "When I say we do not have the bandwidth it means support staff cannot assist you in trying to comprehend another member's code. By no means does this mean other forum members cannot assist you."

                              OK, but from your initial replies it appeared to me that you were also saying:
                              'you are at the wrong place; this is not a place to work with coding issues'.

                              Now I understand that Ninja staff cannot get involved with coding they have not written themselves but that other people on the forum are welcome to share ideas and coding problems even if you cannot get involved because of company policy.

                              I think part of the reason this is so hard for me to understand is the same problem I have with these little coding issues (I am never going to try anything complicated like writing a real system or anything, not in this language which is beyond me!) in that I learned system coding on Tradestation and it has taken me a while to realise how totally different Ninja script environment is and that any little phrase you use is far more dependent on many of the other routines and Wizards all over the place elsewhere in the code rather than having more standalone linquistic procedures. This is not a criticism. It's just hard for someone 'raised' in a totally different environment to understand the nature of the problem.

                              For example, you would think it would not be hard to code in a simple paintbar that changes color when it is an inside bar. Took me forever yesterday, whereas in Tradestation I could write that out in 15 seconds tops and be done with it. I never did figure out how to make it so that I can get the color to change in the panel, I have to do it in the code only.

                              In this case, because I recently bought a strategy that I might use as an auto-trading platform on Ninja, that strategy when applied prints out blurb on the bottom right of the screen which is where I had the TickCount indicator. I had added an alert for manual trading and found it very helpful. So when the new addition came out with the ability to move the location of the text (very helpful in my case with the strategy blurb problem) I was just trying to get the alert to work with the new version as well. As usual, what I thought was a simple thing has taken many hours, thus far without success. It's not a big deal since really the only reason I like this is a) for manual trading and b) so that I don't have to change the templates or select different panels etc. when I switch workspaces, strategy-trading versus manual trading etc. A small convenience. And should be a simple affair.

                              But it isn't. And I guess that's how it goes when you don't know a programming language and support is not allowed. Learning is almost non-existent. The good news for me is that once I get this done, I will once again vanish from Ninja script for a while since the learning curve is so abysmal - at least in my case!

                              All best Josh, Ash.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by lorem, Today, 09:18 AM
                              0 responses
                              2 views
                              0 likes
                              Last Post lorem
                              by lorem
                               
                              Started by hazylizard, Today, 08:38 AM
                              4 responses
                              11 views
                              0 likes
                              Last Post hazylizard  
                              Started by geddyisodin, Today, 05:20 AM
                              2 responses
                              19 views
                              0 likes
                              Last Post geddyisodin  
                              Started by Max238, Today, 01:28 AM
                              5 responses
                              47 views
                              0 likes
                              Last Post Max238
                              by Max238
                               
                              Started by giulyko00, Yesterday, 12:03 PM
                              3 responses
                              13 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Working...
                              X