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

Drawing Problem

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

    Drawing Problem

    Hi guys,

    I need your help! I want to draw an object which uses the volume as a param.
    I use protected override void OnMarketData(MarketDataEventArgs e) statement to get real-time volume and public override void Plot(..) statement to draw and fill a rectangle.

    Code:
    		protected override void OnMarketData(MarketDataEventArgs e) 
    		{ 
    			if (CurrentBar < 0)
    				return;
    			if (e.MarketDataType == MarketDataType.Bid){
    				BidPrices[0] = e.Price;
    			}
    			
    			else if (e.MarketDataType == MarketDataType.Ask){
    				AskPrices[0] = e.Price;
    			}
    vol=e.Volume;
    Print(“OMD vol:  “+vol);
    
    		}
    		public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
    		{
    			Print(“Plot vol:   “+vol);
    			graphics.DrawRectangle(myPen,ChartControl.Right-225, y1,100, 16);
    			graphics.FillRectangle(myBrush, ChartControl.Right-225, y1, vol, 16);
    		}
    In order to check the value of each volume, I write it to the output window. But unfortunately I don’t get back all values.
    The results are here:

    OMD vol: 3 Plot vol: 3
    OMD vol: 3
    OMD vol: 1
    OMD vol: 1 Plot vol: 1
    OMD vol: 1 Plot vol: 1
    OMD vol: 3

    #2
    Hello CuriProgrammer,

    The override Plot method is not something that we support in NinjaTrader 7.

    What you may want to try to use is the "ChartControl.Refresh()" method which is another unsupported method to be able to accomplish what you are looking for.
    JCNinjaTrader Customer Service

    Comment


      #3
      Many thanks for your answer.

      Should I take this ChartControl.Refresh() into the Plot() method?
      You said this is unsupported method. Could you offer me any other solution beyond the Plot() method?

      Comment


        #4
        Hello CuriProgrammer,

        For ChartControl.Refresh() you may want to try to put this inside of your OnMarketData event. For example:

        if (e.MarketDataType == MarketDataType.Bid){
        BidPrices[0] = e.Price;
        if(ChartControl != null) ChartControl.Refresh();
        }


        As for a supported method to do this you may use the a Plot and change the style to a Bar plot do something like the same for this. A good example is the "BuySellVolume" indicator that comes loaded inside of NinjaTrader.

        Let me know if that works for you.
        JCNinjaTrader Customer Service

        Comment


          #5
          This ChartControl.Refresh() method is perfect for me!

          Thank you very much for your help!!!

          Comment


            #6
            Hi

            Hi am new to ninjatrader.... i want to creat buy and sell signal based on sma bt i dont know how to start pls help me

            Comment


              #7
              Originally posted by ranjithslm89 View Post
              Hi am new to ninjatrader.... i want to creat buy and sell signal based on sma bt i dont know how to start pls help me
              Welcome to the world of NinjaTrader. It sounds like you want to spend some time using the strategy wizard to create a strategy of buy/sell on the sma. The wizard makes this relatively simple but like all things you have to start at the beginning. NinjaTrader's help guide can direct you through the process. In NinjaTrader's control center, click on the help menu and select "help". Once the help guide opens, click on "Operations" then find "Strategy Wizard" and select that. Once there read the whole thing for a comprehensive understanding.

              Good luck with your learning journey.

              Comment


                #8
                Hello ranjithslm89,

                We also have a recorded video that you may watch that goes over the basics of the Strategy Wizard at the link below.

                JCNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by CortexZenUSA, Today, 12:53 AM
                0 responses
                1 view
                0 likes
                Last Post CortexZenUSA  
                Started by CortexZenUSA, Today, 12:46 AM
                0 responses
                0 views
                0 likes
                Last Post CortexZenUSA  
                Started by usazencortex, Today, 12:43 AM
                0 responses
                2 views
                0 likes
                Last Post usazencortex  
                Started by sidlercom80, 10-28-2023, 08:49 AM
                168 responses
                2,262 views
                0 likes
                Last Post sidlercom80  
                Started by Barry Milan, Yesterday, 10:35 PM
                3 responses
                10 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Working...
                X