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

is EMA+/-(2*ATR) indicator on indicator?

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

    is EMA+/-(2*ATR) indicator on indicator?

    i did the indicator on indicator tutorial and still can't get it to work. i do have it in strategy as

    {
    DrawLine("My line2" + CurrentBar, 1, EMA(21)[1] + (ATR(14)[1]) * (1 + 1), 0, EMA(21)[0] + (ATR(14)[0]) * (1 + 1), Color.Red);

    DrawLine("My line" + CurrentBar, 1, EMA(21)[1] + (ATR(14)[1]) * (1 + -3), 0, EMA(21)[0] + (ATR(14)[0]) * (1 + -3), Color.Green);
    }

    i'd love to turn this into a indicator, but i can't seem to get it to work.

    #2
    Originally posted by JimPunkrockford View Post
    i did the indicator on indicator tutorial and still can't get it to work. i do have it in strategy as

    {
    DrawLine("My line2" + CurrentBar, 1, EMA(21)[1] + (ATR(14)[1]) * (1 + 1), 0, EMA(21)[0] + (ATR(14)[0]) * (1 + 1), Color.Red);

    DrawLine("My line" + CurrentBar, 1, EMA(21)[1] + (ATR(14)[1]) * (1 + -3), 0, EMA(21)[0] + (ATR(14)[0]) * (1 + -3), Color.Green);
    }

    i'd love to turn this into a indicator, but i can't seem to get it to work.
    What error is in the log?

    Comment


      #3
      well if i just cut/paste from strategy to an indicator i get this


      Comment


        #4
        actually i get these errors if i try anything. if i edit a NT indicator and change the name and hit "compile" i get these same error messages. so clearly i have something larger going on here.

        Comment


          #5
          Originally posted by JimPunkrockford View Post
          actually i get these errors if i try anything. if i edit a NT indicator and change the name and hit "compile" i get these same error messages. so clearly i have something larger going on here.
          ?????

          I edit ADL, changed the name to A2DL (got warning "you can not save system indicators", ) and it compiled.

          [Description("The Accumulation/Distribution (AD) study attempts to quantify the amount of volume flowing into or out of an instrument by identifying the position of the close of the period in relation to that period�s high/low range.")]
          public class A2DL : Indicator
          {

          I created a new indicator, cut and pasted ADX into it, compiled as "MyCustomIndicator", OK, changed named to "MyCustomIndicator2", and that was fine too.

          market with low volumes whereas a cross above 20 may indicate the start of a trend (either up or down). If the ADX is over 40 and begins to fall, it can indicate the slowdown of a current trend.")]
          public class MyCustomIndicator2 : Indicator
          {
          #region Variables


          Please provide more detailed steps?

          I'm assuming latest NT7? I'm on 32bit.

          Comment


            #6
            NT 7.0.1000.6 32bit

            i open up ADL do a "save as" change the name and hit "compile" and i get this error

            No overload for method 'Set' takes '6' arguments

            so not as many errors but still wont compile

            Comment


              #7
              Originally posted by JimPunkrockford View Post
              NT 7.0.1000.6 32bit

              i open up ADL do a "save as" change the name and hit "compile" and i get this error

              No overload for method 'Set' takes '6' arguments

              so not as many errors but still wont compile
              bizarre, 32 bit vista . 7.0.1000.7

              I opened up ADL, right clicked in the code to "SAVE AS", changed to A2D, warned me about changing all occurrences of ADL (and it appeared to do it), and I hit the compile and it compiled. no errors.

              I didn't look at the .7 log change to see if anything related to this was fixed/changed.


              /// </summary>
              [Description("The Accumulation/Distribution (AD) study attempts to quantify the amount of volume flowing into or out of an instrument by identifying the position of the close of the period in relation to that period�s high/low range.")]
              public class a2d : Indicator
              {

              Comment


                #8
                well you did what i did, exactly. and i got the error. thanks a bunch for trying that out for me.

                Comment


                  #9
                  Originally posted by JimPunkrockford View Post
                  well you did what i did, exactly. and i got the error. thanks a bunch for trying that out for me.
                  You have multiple errors in what appear to be multiple files. The picture you posted, was a cut off of what you thought was important, and it did not show complete details that could help point you towards a resolution.

                  If I may make a suggestion: you might be better served if you would take things one step at a time, waiting for a response from those who are trying to help. I actually think that your first problem would have been resolved by now, if you had just responded to what was asked, instead of your trying new experiments. In this case, those new experiments may have introduced new nuances into what was originally a single problem.

                  I am not being snide: I really do want to help.

                  Comment


                    #10
                    ok here are more complete looking results here
                    is there something there that shows whats up[

                    and not to be snarky but my fiddling seems to have uncovered that i am having a more comprehensive problem and not a small programming problem

                    Comment


                      #11
                      Originally posted by JimPunkrockford View Post
                      ok here are more complete looking results here
                      is there something there that shows whats up
                      That picture shows that you are editing MyCustomIndicator9, but your errors are all, so far in MyCustomIndicator, which I am going to presume is the first file that you wrote. Double-click on any of the errors, and the editor will open the defective file, at the the site of the error. We can then tackle the correct errant line.

                      and not to be snarky but my fiddling seems to have uncovered that i am having a more comprehensive problem and not a small programming problem
                      That was not snarky, and your conclusion well may be, but in all cases where there is an error in the first file, any extra coding in new files represent new elements that have been introduced into the analysis of the problem.

                      In this case, it appears that it is possible that only the original problem still remains, but it appears to be showing up elsewhere. That is not really the case: NT compiles everything into one assembly, so any errors, no matter where they are, must be resolved before you can get a successful compilation. If you have one error, and you write new files, nothing will compile, and it is easy to think that you have multiple errors, when in fact, you still have the same one. OTOH, as all errors will prevent compilation, new files may have introduced new errors that are not yet showing.

                      Comment


                        #12
                        ok. so i deleted all of the files and started over. first i tried to cut/paste from my working strategy (as in my original post), with the command "draw line", it compiled but would not draw anything on the chart.

                        so next i tried to add "plots" in the indicator generator then paste my declarations and i get this error HERE and when i click on the error code the "plot" is highlighted

                        so if i understand the error code, i don't give enough info to plot my line, is that correct?

                        Comment


                          #13
                          Originally posted by JimPunkrockford View Post
                          ok. so i deleted all of the files and started over. first i tried to cut/paste from my working strategy (as in my original post), with the command "draw line", it compiled but would not draw anything on the chart.

                          so next i tried to add "plots" in the indicator generator then paste my declarations and i get this error HERE and when i click on the error code the "plot" is highlighted

                          so if i understand the error code, i don't give enough info to plot my line, is that correct?
                          Plot() takes a single double as it parameter, so that line tells what the error is.

                          If you want to draw a line, then I go back to the very first question that I asked: "What error is in the log?"

                          Comment


                            #14
                            Originally posted by koganam View Post
                            Plot() takes a single double as it parameter, so that line tells what the error is.

                            If you want to draw a line, then I go back to the very first question that I asked: "What error is in the log?"

                            ah right, sorry, i didn't understand. HERE is the log file

                            Comment


                              #15
                              Originally posted by JimPunkrockford View Post
                              ah right, sorry, i didn't understand. HERE is the log file
                              That tells us that on bar0, we are trying to access the bar just before it, which of course, does not exist. We shall dodge the problem by simply not processing the event until we have enough bars.

                              Try this. Place this line at the beginning of the OnBarUpdate() event handler.
                              Code:
                              if (CurrentBar < 1) return;

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by RookieTrader, Today, 09:37 AM
                              1 response
                              6 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by alifarahani, Today, 09:40 AM
                              0 responses
                              2 views
                              0 likes
                              Last Post alifarahani  
                              Started by Gerik, Today, 09:40 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post Gerik
                              by Gerik
                               
                              Started by KennyK, 05-29-2017, 02:02 AM
                              3 responses
                              1,283 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by AttiM, 02-14-2024, 05:20 PM
                              11 responses
                              184 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Working...
                              X