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

Using drawing tool as input for indicator

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

    Using drawing tool as input for indicator

    Is it possible to add a line (F2) and pull the start and end value into an indicator?

    #2
    Unfortunately this is not supported.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Will this be supported in the future?

      Thanks for the reply. Will this be supported in the future?

      Currently I have an indicator that I have written that has two inputs, a high of your choice and a low of your choice. My problem is that I would like to know what bar the 2 inputs come from. Is there an onclick scenario/solution that could be used? Or do you have any other ideas?

      Comment


        #4
        It can be done in C#, but is beyond the level of support we can offer. This is on our list of future considerations.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Thx, last question/s ...for today anyway ...

          Is there another way to plot something x bars from the begining of the chart, rather than "bars ago"?

          Can a variable be used within a Close, Open, Low, High command. For example ...

          private int xbars = 250;

          xbars = (CurrentBar - xbarsInput)

          Plot1.Set(Close[xbars])

          Comment


            #6
            Not sure what you mean. Most [] indexing is on barsAgo. There is no other way. If you wanted the bar at a specific time you want to use GetBar() http://www.ninjatrader-support.com/H...V6/GetBar.html
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              That works, but opens up new questions ...

              Is there a way to get the datetime value based on other criteria. For example ...

              if(low[0] < AValue)
              {
              dateTimeVar = DateTime
              }

              // and then populate the dateTimeVar into new DateTime

              barsAgoX = GetBar(
              new DateTime(dateTimeVar));



              My other question is that I like to have otherdateTimeVar as an input - what type of variable would it be and would I have to (how?) convert it to make it work in ....

              barsAgoA = GetBar(new DateTime(otherdateTimeVar));

              Comment


                #8
                Originally posted by traderT View Post
                Is there a way to get the datetime value based on other criteria. For example ...

                if(low[0] < AValue)
                {
                dateTimeVar = DateTime
                }
                Sure

                if(low[0] < AValue)
                {
                dateTimeVar = Time[0];
                }

                On your second question, create an input of type DateTime. Here is a reference sample on creating user defined inputs.

                RayNinjaTrader Customer Service

                Comment


                  #9
                  Thanks NT_Ray, much appreciated. I tried to apply what you said, but the results I am getting don't seem right...

                  if((BBA ==1)
                  && (Low[
                  0] <= BullB))
                  {
                  BBB = Time[
                  0];
                  barsAgoB = GetBar(BBB);
                  Print(BBB);
                  Print(barsAgoB);
                  }

                  DrawLine("Btag", barsAgoA, High[barsAgoA], (barsAgoB), Low[barsAgoB], Color.Red);


                  The print(bbb) gives me the correct time , but the format of that time is different from what I have seen used with the getbar statement.

                  //Print results
                  05/12/2008 20:23:00
                  0

                  The 0 should actually correspond to the getbar of 20:23, but the output is 0

                  For example, this gives me the correct BarsAgoA result ...

                  barsAgoA = GetBar(new DateTime(2008, 12, 05, 20, 19, 0));
                  The getbar result for this is 22, which is correct.

                  Am I using the getbar incorrectly with the suggestion that you posted? If so, how can I fix it?

                  Comment


                    #10
                    Hi traderT,

                    hard to judge for us with only a snapshot of your custom code present, if GetBar returns a 0 it means you pass in a time that is newer than the last bar...

                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      getbar

                      Thanks for the reply. I have found a different, though not as good way to do things. Currently my code is a mess (well, it's always a mess). However, there is light at the end of the tunnel and I will hopefully post the code either later this week or on the weekend. I am sure that there is a better way to code what I am trying to do and hopefully when I post my code, more suggestions will be forthcoming. Thanks for the help. When I have time I will explain the getbar query better.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by WHICKED, Today, 12:56 PM
                      0 responses
                      4 views
                      0 likes
                      Last Post WHICKED
                      by WHICKED
                       
                      Started by Spiderbird, Today, 12:15 PM
                      2 responses
                      10 views
                      0 likes
                      Last Post Spiderbird  
                      Started by WHICKED, Today, 12:45 PM
                      0 responses
                      7 views
                      0 likes
                      Last Post WHICKED
                      by WHICKED
                       
                      Started by FrazMann, Today, 11:21 AM
                      2 responses
                      6 views
                      0 likes
                      Last Post NinjaTrader_ChristopherJ  
                      Started by rjbtrade1, 11-30-2023, 04:38 PM
                      2 responses
                      80 views
                      0 likes
                      Last Post DavidHP
                      by DavidHP
                       
                      Working...
                      X