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 frslvr, 04-11-2024, 07:26 AM
              5 responses
              96 views
              1 like
              Last Post caryc123  
              Started by algospoke, 04-17-2024, 06:40 PM
              6 responses
              49 views
              0 likes
              Last Post algospoke  
              Started by arvidvanstaey, Today, 02:19 PM
              4 responses
              11 views
              0 likes
              Last Post arvidvanstaey  
              Started by samish18, 04-17-2024, 08:57 AM
              16 responses
              61 views
              0 likes
              Last Post samish18  
              Started by jordanq2, Today, 03:10 PM
              2 responses
              11 views
              0 likes
              Last Post jordanq2  
              Working...
              X