Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CrossAbove/Below methods - help please...

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

    CrossAbove/Below methods - help please...

    Hi,
    Please help. I tried to post this under programming but did not get any help. I'm not C# programmer. I'm trying to write simple logic for Stoch indicator to play sounds when it crosses from below to above 20 or from above to below 80 lines.
    Long example:

    If (CrossAbove(k, 20, 1)... then play alert. The problem is it plays the sound when k <= 20. I expect this to work differently - if %k equals or above 20, e.g. crosses the 20 line from below up then play sound... In perfect world I would like to play the sound only if %k is between 15 and 21, e.g. when %k>15 but %k<22 when long, and no sounds when %k < 15 or %k >22. But I do not know how to write this and having problems with simpler idea of playing sound only when %k crosses 20 from below up... Any ideas and help please? Maybe you have some examples? Ninja support does not open my eyes so to speak, not enough info... Is there any other way to make this work? Is there other method I can use to write this simple logic?
    And another thing. I also try to put the marker on the chart at the same time when alert plays. But for some reason DrawArrowUp/Down stopped working. It worked then it stopped... Maybe there is some conflict in that logic I wrote...???
    Thank you very much.

    #2
    Hello Art09,

    In the future, please don't create a new thread for the same topic.

    If you are not a programmer, the strategy wizard is a good place to help you generate the conditions in a point and click interface. If you'd like NinjaTrader support to help with what you're doing, please click the View Code button and copy and paste your efforts into a post. Include a description of what you think it should be doing and what it's doing instead.

    If you'd like professional coding help, please consider a 3rd party NinjaScript consultant who can be hired to develop your strategy according to your specifications.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      This is not help. The question was about the confusion of Cross methods and I do not see a big deal for any of you to answer this question instead of referring me to strategy and such. IT is simple question: why this does not work as expected? The 3-rd party consultants will not answer this question. What's the point of referring me to them? To get rid of? At least provide some examples for creating strategies for more then MA crossovers in help and support... I tried creating the strategy but one must select the Stoch on the right and on the left, which means the Stoch will cross another Stoch which is nonsense. Try it yourself and see. And all it will write the same CrossAbove/Below methods which simply does not work as expected and this was the question. And if I get help the first time I would not post it again.
      Thanks.

      Comment


        #4
        Art,

        You haven't given us much to work with.

        If (CrossAbove(k, 20, 1)...
        Doesn't work because there's a capital I in the if statement. k is not defined anywhere else. I don't know what it is.

        There are many examples you can refer to for crossing conditions and help constructing these types of statements in the condition builder.


        Not starting a new thread is for your benefit. When you create a new thread, then we start over and can't advantage of the dialog needed to work through this stuff.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          It works fine, but not how I'd expect it. The question was why CrossAbove() gives me signals when it crosses below as well as above the 20 line but not only when above 20 line as expected if I write
          if CrossAbove(...20...)? The English is my second lang. and above means above to me, e.g. above 20... more then 20. Does this require more logic and using only CrossAbove/Below not good enough? This is what I was asking hoping for some examples if available...
          The condition builder will use CrossAbove/Below methods for crossovers which work fine for simple crossovers such as one MA crossing another MA.
          If you cannot help that's fine. But I cannot ask 3-rd party consultants about it for sure.
          Thank you.

          Comment


            #6
            CrossAbove requires that the crossing value is first lower and then crosses above the crossed value. It compares two bars to identify this crossing condition.

            If you're looking to evaluate more or less than, then you use > or < operators for this.

            If you're looking for help with technical analysis concepts, please refer to a site such as www.investopedia.com

            If you post code snippets that don't compile, our assumption is that you need syntax help. If you're looking for help with a particular block of code: Post simple and valid code snippets, let us know what you think the code should be doing, and what it's doing instead.
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by RubenCazorla, Today, 09:07 AM
            2 responses
            11 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by i019945nj, 12-14-2023, 06:41 AM
            7 responses
            81 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by timmbbo, 07-05-2023, 10:21 PM
            4 responses
            158 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by tkaboris, Today, 08:01 AM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by Lumbeezl, 01-11-2022, 06:50 PM
            31 responses
            819 views
            1 like
            Last Post NinjaTrader_Adrian  
            Working...
            X