Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Fibonacci Retracements in strategy

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

    Fibonacci Retracements in strategy

    I made this indicator so that I could access fibonacci retracement values from within a strategy, and although everything seems to plot correctly, the "start time" variable seems to be causing a problem in both the condition builder and in manual coding.


    Any ideas on whats causing the problem?

    ref:
    Support for the development of custom automated trading strategies using NinjaScript.
    Attached Files
    Last edited by Elliott Wave; 11-16-2008, 09:32 PM.

    #2
    Hello,


    Within the Wizard, it is mostlikely due to the variable type as Josh mentions in the post your referenced below.

    For the manual trading part, what exactly is the issue you are having and we will try to assist you.
    DenNinjaTrader Customer Service

    Comment


      #3
      My issue is that I can't seem to use this indicator in any strategies without programming errors.

      I merely added plots to an existing indicator (which appear to return the correct result), but now there is an issue with the date format which I didn't change at all.

      If the date format is the problem I would appreciate advice on how to correctly format it so that it works.


      A few other things:
      In the NinjaScript editor, insert condition seems to use a different format than the wizard, but both cause errors.

      Code:
      if (Close[0] < FibonacciRetracements([B]20081116[/B], 0, true).R61[0])
      {
            ExitLong("", "");
      }
      Code:
      if (FibonacciRetracements([B]11/16/2008 12:00:00 AM[/B], 0, true).High[0] == Close[0])
      {
      EnterLong(DefaultQuantity, "");
      }
      I think you may be the original developer of this indicator, so perhaps you may have better insight as to what is causing the problem.

      Code:
      Initial Developer:  SBG Trading Corp., Ben Letto, [email protected] February 2, 2008

      Comment


        #4
        Ben Letto is a different user. You are getting errors because both of those are likely being confused as something else instead of DateTime variables. What you will need to do is something like this.

        Code:
        myDateTime = new DateTime(fill in whichever overload method you want to use);
        
        if (FibonacciRetracements(myDateTime, 0, true)....)
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Thanks for the suggestion. I'll see if I can get it to work. If not, I'll try contacting the original author.

          Comment


            #6
            I think I made a bit of progress.

            It seemed the DateTime was being converted to an integer for some reason.

            What I did is change the user parameter for the indicator from a DateTime variable to a string and then parse that into a DateTime variable. The indicator works in strategies now, and trades are triggered, the problem is that it seems to ignore the startTime I specify and will use the start of the chart.

            Another issue is I have a strategy parameter (string) for the startTime, but the condition builder doesn't give me the option to select user defined variables for the indicators startTime parameter.

            I now officially give up on this, I've spent way too many hours for something that should probably take 5 minutes. I'll post this as is, and if anyone else thinks fibonacci levels would be useful for strategy development (stops and targets etc) they can pick up where I got stuck.
            Attached Files
            Last edited by Elliott Wave; 11-17-2008, 01:50 PM.

            Comment


              #7
              Thanks for the contribution Elliott Wave.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Mate you are doing a great job thanks for all your hard graft

                Originally posted by Elliott Wave View Post
                I think I made a bit of progress.

                It seemed the DateTime was being converted to an integer for some reason.

                What I did is change the user parameter for the indicator from a DateTime variable to a string and then parse that into a DateTime variable. The indicator works in strategies now, and trades are triggered, the problem is that it seems to ignore the startTime I specify and will use the start of the chart.

                Another issue is I have a strategy parameter (string) for the startTime, but the condition builder doesn't give me the option to select user defined variables for the indicators startTime parameter.

                I now officially give up on this, I've spent way too many hours for something that should probably take 5 minutes. I'll post this as is, and if anyone else thinks fibonacci levels would be useful for strategy development (stops and targets etc) they can pick up where I got stuck.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by bortz, 11-06-2023, 08:04 AM
                47 responses
                1,611 views
                0 likes
                Last Post aligator  
                Started by jaybedreamin, Today, 05:56 PM
                0 responses
                9 views
                0 likes
                Last Post jaybedreamin  
                Started by DJ888, 04-16-2024, 06:09 PM
                6 responses
                19 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by Jon17, Today, 04:33 PM
                0 responses
                6 views
                0 likes
                Last Post Jon17
                by Jon17
                 
                Started by Javierw.ok, Today, 04:12 PM
                0 responses
                22 views
                0 likes
                Last Post Javierw.ok  
                Working...
                X