• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

block orders in analyzer

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

    block orders in analyzer

    I want to display block orders in the market analyzer.



    if ( e.Volume >= BlockSize )
    {
    PriceAlert.Set(e.Volume);
    }


    It is showing the current price and so is interfering with the conditions I am trying to use in the analyzer.

    #2
    Hello,

    You would need to ensure you are setting a default value for the plot being used.
    If you are seeing the Current price, that would indicate no default value was set.

    Generally for indicators specific to the MA, you would need to set an initial value for the plot in the top of OnBarUpdate before conditions.

    Here would be an example:

    Code:
    PriceAlert.Set(0);
    
    if ( e.Volume >= BlockSize )
    {
    PriceAlert.Set(e.Volume);
    }
    Could you check and confirm if this is the problem?


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Yes now shows 0 but is not showing the block trade amounts.

      Comment


        #4
        Hello,

        Yes this would correct the default price showing, but if your logic does not persist the last value it would only report the block size for a split second while that tick is processed. Upon the next tick a zero would be reported again replacing the value.

        You would likely need to implement a variable to "remeber" what the last block was.

        Here is a simple example:

        Code:
        private int lastValue = 0;
        protected override void OnBarUpdate()
        {
            PriceAlert.Set(lastValue);
        
            if ( e.Volume >= BlockSize )
            {
                 PriceAlert.Set(e.Volume);
                 lastValue = PriceAlert[0];
            }
        }
        Because the MA is generally used with CalculateOnBarClose = false, in some cases if you want a display that persists you would need to do that using logic.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          It says cannot convert double into int

          lastValue = PriceAlert[0];


          error referring to "PriceAlert"

          Comment


            #6
            Hello,

            This was my mistake, You would need a Cast in this case:

            lastValue = (int)PriceAlert[0];

            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by johnnybegoode, Today, 11:35 AM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_ChrisL  
            Started by NickyD, Today, 09:07 AM
            3 responses
            14 views
            0 likes
            Last Post NickyD
            by NickyD
             
            Started by 7robert, Today, 06:46 AM
            3 responses
            62 views
            0 likes
            Last Post NinjaTrader_ChrisL  
            Started by ElMagoR, Today, 07:49 AM
            4 responses
            31 views
            0 likes
            Last Post NinjaTrader_ChrisL  
            Started by Nabil, 09-13-2019, 11:44 AM
            5 responses
            35 views
            0 likes
            Last Post Nabil
            by Nabil
             
            Working...
            X