• 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

Automated strategy that would use results of a scanner

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

    Automated strategy that would use results of a scanner

    Hello everyone,
    I was searching the forum to find answer to my problem but so far to no purpose.
    What I need to do is to develop a strategy that would run permanently, every night it would run a scanner on a predefined set of stock symbols, sort the results based on predefined criteria and then take top x stocks and create orders to open positions in these stocks. Also the scanner would identify whether there are conditions met to close any of currently open positions. The scanner would of course include several criteria, indicators and so on. Also after developing such strategy I would like to properly backtest it and optimize.
    My simple question is, whether this is feasible in Ninjatrader or if I need to look for a different solution.
    If my problem can be solved using Ninjatrader, could you please provide me with just a very high level design of such solution? I am capable of creating it, but it would help me to browse the forum looking for more clues how to do it.
    Thank you very much for your advice.
    LXM

    #2
    Hello traderlxm,

    Thank you for the post.

    This is possible by means of a multi-instrument strategy. There is a simple example of this in the platform by default called "@SampleMultiInstrument". This strategy uses AddDataSeries to add an additional instrument to the script. The script can be viewed from a NinjaScript editor. The primary data series is going to be whatever data series is running on the chart, or whatever data series you select in the strategies tab of the Control Center.

    Below are links to the material used to create multi-instrument scripts:

    AddDataSeries - Used to add additional time series and instrument series to your script.

    BarsArray - Used to access the various bars objects you have added

    BarsInProgress - Used to get the context for which series OnBarUpdate is being called for. For example, when BarsInProgress == 0, OnBarUpdate is being called for the primary bars series, so referencing a price variable, like Close[0] will get the latest close price for the primary series. If BarsInProgress == 1, OnBarUpdate is being called for the secondary series, and so on.

    You can also access the other series in your script regardless of what BarsInprogress is using the plural price data arrays such as Closes[][], Lows[][], and Highs[][], here are all of those price data series:

    https://ninjatrader.com/support/help...riceseries.htm

    Please let me know if I can assist further.
    Last edited by NinjaTrader_ChrisL; 12-12-2018, 03:02 PM.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi Chris,
      thanks for the reply.
      However I can’t see how I would use it for my purpose.
      I intend to scan thousands of stock symbols, so even if there was a way how to transfer results from the market analyzer to the strategy, which I am not aware of, correct me please if I am wrong, I would need to have all dataseries for all symbols scanned already added to the strategy. Would ninjatrader even handle such amount of dataseries? Or is there a way how to add and remove dataseries from a strategy dynamicaly based on the market analyzer results?
      Thanks
      LXM

      Comment


        #4
        Hello traderlxm,

        Thank you for the reply.

        Multiple thousands of stock symbols streaming data might cause performance problems at high volume. Consider narrowing down the list to add to a strategy. AddDataSeries() is called in State.Configure, which is a one-time setup state, so you must add the desired symbols at the beginning of the strategies initialization.

        Please let me know if you have any questions.
        Last edited by NinjaTrader_ChrisL; 12-15-2018, 03:57 PM.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by zweistein, 11-14-2017, 03:24 PM
        2 responses
        1,476 views
        0 likes
        Last Post woodie1
        by woodie1
         
        Started by Newtrader101, Today, 04:50 AM
        3 responses
        18 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Started by utilizator, Today, 06:31 AM
        3 responses
        13 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by digibob, Today, 01:13 AM
        3 responses
        14 views
        0 likes
        Last Post digibob
        by digibob
         
        Started by calebsandfort, Yesterday, 05:16 PM
        2 responses
        11 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Working...
        X