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 giulyko00, Yesterday, 12:03 PM
              3 responses
              12 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by habeebft, Today, 07:27 AM
              1 response
              14 views
              0 likes
              Last Post NinjaTrader_ChristopherS  
              Started by AveryFlynn, Today, 04:57 AM
              1 response
              12 views
              0 likes
              Last Post NinjaTrader_Erick  
              Started by Max238, Today, 01:28 AM
              4 responses
              39 views
              0 likes
              Last Post Max238
              by Max238
               
              Started by r68cervera, Today, 05:29 AM
              1 response
              10 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X