Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

A little transformation

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

    #46
    Hello Arthur,

    Thank you for your response.

    This is possible, the syntax would be the following:
    Code:
    Add(string instrumentName, PeriodType periodType, int period, MarketDataType marketDataType)
    For information on Add() and the MarketDataType please visit the following link: http://www.ninjatrader.com/support/h...s/nt7/add3.htm

    Please let me know if I may be of further assistance.

    Comment


      #47
      Hello Patrick,


      Would it be possible to get volume data series of any added instrument then?


      Thank a lot,
      Arthur

      Comment


        #48
        Hello FxInception,

        Thank you for your post.

        You can use Volume[barsAgo Index] and if using multiple time frames and/or instruments you can use Volumes[barsSeries Index][barsAgo Index].

        For information on Volume please visit the following link: http://www.ninjatrader.com/support/h...t7/volume2.htm
        For information on Volumes please visit the following link: http://www.ninjatrader.com/support/h...t7/volumes.htm

        Please let me know if I may be of further assistance.

        Comment


          #49
          Patrick-


          What is wrong with this code then?

          string fullName = Instrument.FullName ;
          Print (fullName) ;
          Add(fullName, PeriodType.Minute,
          1, MarketDataType.Ask);
          Add(
          new Plot(new Pen(Color.Blue, 2), PlotStyle.Bar, "Volume"));
          Add(
          new Line(Color.DarkGray, 0, "Zero line"));
          }
          ///<summary>
          /// Called on each bar update event (incoming tick)
          ///</summary>
          protectedoverridevoid OnBarUpdate()
          {
          Value.Set(Volumes[
          1][0]-Volumes[0][0]);
          }
          }
          }

          Thank you,
          Arthur

          Comment


            #50
            Hello Arthur,

            Thank you for your response.

            Is something unexpected occurring with this code? Are you receiving any error messages? If so, what do they report?

            I look forward to your response.

            Comment


              #51
              Patrick-


              It states below that the name "Volume" does not exist in current context, providing the lines from generated code..


              Thanks,
              Arthur

              Comment


                #52
                Hello Arthur,

                Thank you for your response.

                Can you attach the indicator file to your response so I may investigate this matter further?

                I look forward to your response.

                Comment


                  #53
                  Patrick-


                  This indicator is meant to be on Bid chart and subtract its volume from Ask data series volume.


                  Thank you,
                  Arthur
                  Attached Files

                  Comment


                    #54
                    Hello Arthur,

                    Thank you for your response.

                    Volume will not pull for the Bid or Ask Data Series. You could just use the following and apply to a Last - Price Based On chart:
                    Code:
                    Value.Set(GetCurrentAskVolume(1)-GetCurrentBidVolume(0));
                    Please let me know if I may be of further assistance.

                    Comment


                      #55
                      Patrick-


                      I still have that strange error and it's not compiling..

                      Any other suggestions?


                      Thank you,
                      Arthur

                      Comment


                        #56
                        Hello Arthur,

                        Thank you for your update.

                        Can you attach the updated indicator file to your response so I may investigate this matter further?

                        I look forward to your response.

                        Comment


                          #57
                          Patrick-


                          Thanks a lot, I sorted it out, I missed one thing..

                          But here is another issue...

                          GetCurrentAskVolume(1)-GetCurrentBidVolume(0) work as it should. But since I want to divide these values instead of subtract - it doesn't calculate the bars precisely and some bars are missing..
                          Also, would it be possible to get double values instead of whole ones, at least to two decimal places when we divide it?


                          Thank you,
                          Arthur
                          Last edited by FxInception; 11-07-2013, 07:20 PM.

                          Comment


                            #58
                            FxInception,

                            When dividing these two numbers you may come across a scenario where the bottom division number is 0 which you cannot divide by zero mathematically.
                            This could be the case in what you are seeing and why Patrick suggest using subtract

                            Additionally, you will need to override the FormatPriceMarker to show the double values -
                            http://www.ninjatrader.com/support/h...ricemarker.htm

                            Let me know if this the answer you were looking for
                            Cal H.NinjaTrader Customer Service

                            Comment


                              #59
                              Hello guys,


                              Thanks Cal, now I see that the problem is that it divides a lower value by higher value when bid volume is higher and therefore, it shows 0.

                              Could you please correct me what I'm doing wrong here? I think I have to have a return function I guess at least, but not sure about all of it.

                              protectedoverridevoid OnBarUpdate()
                              double CorrectVol();
                              {
                              if (GetCurrentAskVolume(1) >= GetCurrentBidVolume(0))
                              CorrectVol = (GetCurrentAskVolume(
                              1)/GetCurrentBidVolume(0));
                              else CorrectVol = (GetCurrentBidVolume(0)/GetCurrentAskVolume(1));
                              Value.Set(CorrectVol);
                              }
                              }
                              }


                              Many thanks,
                              Arthur

                              Comment


                                #60
                                The check looks fine but you would want to move the variable declaration to after the first {.

                                {
                                double CorrectVol;

                                .....
                                Cal H.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                599 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                345 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                103 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                558 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                558 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X