• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Setup for Long-Buy-Indicator

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

    Setup for Long-Buy-Indicator

    Hallo, I'm trying to programm an indicator which should contain the following contidions:

    Show me stockst whose price is 1.) above the SMA30 and 2.) whose price is at a 3 day low.

    After hours of try and error am I pretty desperate. Can anybody help me?

    Thanks Mike

    #2
    Hello Mike,

    Welcome to the NinjaTrader Support Forums!

    Could you post your code of what you have so far and what you are running into so that we can be of further assistance?
    JCNinjaTrader Customer Service

    Comment


      #3
      Hello JC,

      thanks for your reply. To be true there is no finished codes at the moment. The codes for “SMA30” and “current close price” are working. They show the right result. But with the single code for the “Close price 3 days ago” have I some trouble. There is no problem, if I show 2 days back “Plot0.Set(Close[2]);”. But if I set the „Plot0.Set(Close[3]);“ indicate the MarketAnalyzer as result 0,00.
      The following note can I read in the Output window: “Error on calling 'OnBarUpdate' method for indicator 'CloseXDays' on bar 0: You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
      I have no idea where is my mistake. The code can you see in the file attached. Hope you can bring me one step further.
      Cheers MIKE
      Attached Files

      Comment


        #4
        Hello Mike,

        Thank you for the file.

        The error message you are receiving is saying that the script is not detecting enough data when it first starts.

        To correct this you can use a CurrentBar check to ensure your script has enough data to run on.
        http://www.ninjatrader.com/support/f...ead.php?t=3170
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Hello Cal,

          the code that you recommend helps to find out if enough bars are loaded. But sadly is this not the correct solution for loading more data. How can I change the loaded data in my code?

          Thanks MIKE

          Comment


            #6
            Mike,

            Note that this is possible to do but is unsupported and I do not have any documentation on the matter.

            I will not be able to offer my full assistance with the script.


            You can add more bars or days to load with this code snippet

            ChartControl.BarsArray[0].BarsData.DaysBack = 365;
            Cal H.NinjaTrader Customer Service

            Comment


              #7
              Hallo Cal, it seems as if your first suggestion works. I tested my indicator accidentially with futures and got correct results. Thanks for your fast and competent support.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Barry Milan, Today, 01:33 PM
              2 responses
              7 views
              0 likes
              Last Post marcus2300  
              Started by NW Trader, Today, 03:42 PM
              2 responses
              7 views
              0 likes
              Last Post NW Trader  
              Started by ralett, Today, 01:42 PM
              1 response
              3 views
              0 likes
              Last Post NinjaTrader_ShawnB  
              Started by dkbyond, Yesterday, 04:11 PM
              1 response
              22 views
              0 likes
              Last Post NinjaTrader_ChrisL  
              Started by w0lverine, Yesterday, 08:22 PM
              2 responses
              11 views
              0 likes
              Last Post w0lverine  
              Working...
              X