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

block size

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

    block size

    I am trying to extract the block size like the time and sales how can I extract data of the block size number and if it was an ask or bid?

    #2
    Hello Ballboy11,

    Thank you for your note.

    The following code in an indicator/strategy which CalculateOnBarClose set to false so it updates on each tick, would compare if the last trade was at the Current Ask or Bid, and if so would print the time, Ask/Bid, Price, and Volume.

    Code:
    if(Close[0] == GetCurrentBid())
    	{
    		Print(Time[0].ToString() + ".." + "Bid" + "..."+Close[0].ToString() +".."+ Volume[0]);
    		
    	}
    if(Close[0] == GetCurrentAsk())
    	{
    		Print(Time[0].ToString() + ".." + "Ask" + "..."+Close[0].ToString() +".."+ Volume[0]);
    	}
    See GetCurrentAsk section of our helpguide,


    See GetCurrentBid section of our helpguide,


    See Volume section of our helpguide,


    Please let us know if you need further assistance.
    Last edited by NinjaTrader_AlanP; 03-31-2017, 08:05 AM.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      almost but not yet

      I tried the information and it shows the total contracts at close[0] by the time frame used.what I am trying to do is to catch the block sizes like the T & S displays. I want to create an algorithm that will paint a horizontal line on the price point if a certain block size is reached.

      for example

      if block is over 100 contracts at 50.05 then paint a horizontal line at 50.05

      thank you

      Comment


        #4
        Hello Ballboy11,

        When you applied the code, did you have calculate on bar close set to false? If so, you should see the output window reflect what the time and sales window is showing, each trade.

        To have a horizontal line painted when more than 100 contracts trade at 1 time, you would have to write an if statement which would check if Volume[0] was greater than 100, if so, do something.

        For example,

        Code:
        if(Volume[0]>100)
        {
        Print(“Volume over 100”);
        }
        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        26 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 02-22-2024, 01:11 AM
        5 responses
        32 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, Yesterday, 09:53 PM
        2 responses
        49 views
        0 likes
        Last Post wzgy0920  
        Started by Kensonprib, 04-28-2021, 10:11 AM
        5 responses
        192 views
        0 likes
        Last Post Hasadafa  
        Started by GussJ, 03-04-2020, 03:11 PM
        11 responses
        3,235 views
        0 likes
        Last Post xiinteractive  
        Working...
        X