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

Gap Scan

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

    Gap Scan

    Good afternoon,

    I have seen a couple of posts of interest in a gap scanner and I am trying to make one myself.

    I would like to scan most stocks on the NYSE and the NASDAQ, this is about 3,000 instruments. I would like to run the scanner at the open and find stocks that are gapping up 5% from yesterdays close, (maybe code a other criteria later). My main issue that I have is the large size of instruments, I first tried coding an indicator, (Open[0] > Close[1] * 1.05), that would create a signal and I could use the market analyzer to show if the signal was created or not, problem was ever with breaking the 3k instruments up into 5 groups the analyzer took 40+ min to load. I have found that If I write a strategy to enter a position if the signal is tripped and then use the strategy analyzer, I can sort by hypothetical positions entered, this a little faster but still 30+ min.

    I need this to be done much faster. Being that I want the results within the first couple minutes of the open I don't think I can use daily time frame, this would make the scan extremely fast and is fine for end of day. But being the daily candle is not closed yet I can’t use that data, I am left with using intraday time frame, like 2min, because I don't want to wait 5 or 10min to start the scan with larger time frame, and now the scan has to run on a lot more candles, 195 of them on each instrument which makes the scan take so long.

    All that said I am wondering if anyone has any input on how to speed this up. I have tried several other things but nothing with significant results.


    Thank you as always for your input, Ryan

    #2
    Hello, thanks for writing in. There are limitations imposed on how many symbols you can view concurrently depending on the broker/data connection you are using e.g. you can upgrade a Kinetick connection to view up to 500 symbols simultaneously. Loading 3000+ symbols will hurt the performance of your PC as there is no strict limit to how many bars request the system can do, so unfortunately this might be the most optimum time for loading this much data.

    Kind regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Chris, Thanks for the reply, Yes I have the 500 symbols from Kinetick. Do you have any input on running the strategy over that many symbols? Is there a way to run a strategy on the daily time frame over 2 days using the open of a candle that has not closed yet? Thanks Ryan

      Comment


        #4
        Hello, thanks for the follow up. The daily bars need to run OnEachTick to detect the open, so it would be similar to using an intrabar series. There is no limitation in the platform to how many symbols one strategy can manage, it is limited by the resource of your PC.

        Kind regards,
        -ChrisL
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Thank Chris, the issue what I run a strategy on the daily timeframe with OnEachTick if (Open[0] > Close[1] * 1.05) { EnterLong("") } It does not enter until the next day so when I run it while the bar is still open I dont' get a trade. Is there a way that I can keep that code and enter intraday? Thank you again for your help. Ryan

          Comment


            #6
            Hello, thanks for the follow up. It will impact performance, but you will need to enable Tick Replay and then use IsFirstTickOfBar to capture the first tick of the daily series.




            Kind regards,
            -ChrisL
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Chris, after enabling Tick Replay the entry is still on the following day.

              if (IsFirstTickOfBar) { if (Open[0] > Close[1] * 1.05) { EnterLong("") } }

              Thank you, Ryan

              Comment


                #8
                Hello, thanks for the follow up. For accurate entries, you will need to use intrabar granularity instead of Tick Replay. I apologize for the oversight. Tick Replay works for price movement and indicator calculation but has no effect on the order fill estimation. See this post for more information:



                Kind regards,
                -ChrisL​
                Chris L.NinjaTrader Customer Service

                Comment


                  #9
                  Hi.
                  My thoughts are not a guide to action, since I do not know your real end goal.
                  ************************************************** ****************************
                  In my humble experience there is such an observation:
                  If a stock appears to have any excessive post/pre-market activity
                  (volume above/below the previous day's close), then there is a high probability of a gap.
                  I don't know if there are premarket prices from your data provider.
                  ************************************************** ****************************
                  Alternatively, you can get this data from online resources using API, a simple request, or a parser.
                  The first thing that comes to mind is the data on the websites of exchanges.
                  Then the matter remains small. Get this data and process it.
                  I think that by using this trick you can significantly reduce the number of shares viewed at a time.
                  From 8000 shares to 30-50 by one request.
                  Advantages:
                  1. You are not constrained by the time frame.
                  2. You don't depend on an instant response.
                  3. You take a little peek into the future.
                  4. You have only one/two request(s).
                  5. Hard work makes other services.
                  6. You save on your energy bills.
                  7. Missing millions of empty cycles of your processor.​
                  Minuses:
                  1. It will not be possible to see the future.
                  2. Perhaps something will pass you by.
                  ************************************************** ****************************
                  For example:
                  1.
                  A couple of minutes before the session opens,
                  the strategy makes an API request for online resources
                  (use as many resources as possible, so the picture will be complete),
                  receives, processes, compares, and saves data,
                  you drink coffee and calmly knead a cigarette
                  while waiting for the strategy to place orders
                  efore/before/after the opening of the session.
                  2.
                  request(s) to the site finviz.com immediately after the opening of the session.
                  have attached the picture. further actions from item 1.
                  minus: it costs money.
                  links:

                  Get the latest pre-market stock market quote data from Nasdaq.






                  https://finviz.com/screener.ashx?v=1...ta_gap_u5&ft=4

                  Click image for larger version  Name:	finviz.png Views:	0 Size:	314.7 KB ID:	1230232
                  Last edited by Danila; 01-07-2023, 04:16 PM.

                  Comment


                    #10
                    Danila, thanks so much for the response. So I us Finviz for other things. In a strategy or indicator I can pull search results from finviz?

                    Or am I miss understanding what you are saying.

                    Thanks so much, Ryan

                    Comment


                      #11
                      Hi Tonkingrf1551
                      Yes, you can get this data.
                      I see no barriers to this.
                      As far as I understand you need an instant response.
                      You can receive real-time data, for example, from finviz, but you need their paid subscription.
                      Perhaps there are other similar free services.
                      In the first seconds of opening a session, you will make a request with the data that matches your condition.
                      If let's say the API does not have the method you need for the request.
                      You can write your own parser, make a request and get a response.
                      here is a short example. it is written in java. https://www.youtube.com/watch?v=T8YMbUqLF1A
                      I wanted to show the idea that in one or two requests you can get already processed data from 8000 tickers.
                      the same code can be written from the ninja trader environment.
                      Only request and data processing be done not from the main flow of the strategy.
                      You can create an addon.
                      Build a window with the ability to change
                      the parameters of your request for financial services (for example, you go to receive a gap of not 5% but 6).
                      The activation button will start the process of sending requests and placing orders.​
                      Last edited by Danila; 01-11-2023, 01:23 PM.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by futtrader, 04-21-2024, 01:50 AM
                      4 responses
                      41 views
                      0 likes
                      Last Post futtrader  
                      Started by Option Whisperer, Today, 09:55 AM
                      1 response
                      11 views
                      0 likes
                      Last Post bltdavid  
                      Started by port119, Today, 02:43 PM
                      0 responses
                      7 views
                      0 likes
                      Last Post port119
                      by port119
                       
                      Started by Philippe56140, Today, 02:35 PM
                      0 responses
                      7 views
                      0 likes
                      Last Post Philippe56140  
                      Started by 00nevest, Today, 02:27 PM
                      0 responses
                      7 views
                      0 likes
                      Last Post 00nevest  
                      Working...
                      X