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

Very simple strategy request.

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

    Very simple strategy request.

    Hello,
    I am very confused and can't figure this out.

    I wish to implement a very simple strategy backtest on a given basket of stocks.
    It is the following -
    1. Select the top 15 stocks in terms of 6 month return at the beginning of each month to buy.
    2. Must have +200k in volume at time of purchase.
    3. Must be over $2 at time of purchase.
    4. Hold for one month at sell those not in top 15 and replace the next month.

    (I have an additional timing system and allocation rules which I will overlay on this, but I am basically seeking is what were the top 15 momentum stocks on the market for each month as far back as possible)

    Thanks to anyone who can help, Simon

    #2
    Hello GeminiSi,

    Thank you for your post.

    This would actually be considerably more complicated than you might think. You'd need a multi-instrument strategy for this, as strategies cannot share information between instances of the strategy. So if you just ran the same strategy on say 30 different stocks, if you tried to calculate the six month return in each one there's no way the other instances of the strategy would know whether they were in the top 15 or not.

    So you'd need to add all of these as a different data series to your Strategy. Then you would need logic to calculate the six month return for each (you could do this in an indicator that you then use in your strategy), then check that they have over the correct volume and price, then take the top 15 of those, and add a time filter so if it's the beginning of the month then sell any that were previously in the top 15 but aren't now. You'd then need to check positions on the top 15 and if they don't currently have a position then place an order.

    This would not be something you could likely do with the Strategy Builder, it would need to be manually coded. This would be fairly complicated logic, and you may want to look into using a NinjaScript Consultant for assistance coding this or to code it for you.

    Here are some resources that would be applicable should you decide to code this yourself:

    Multi-Time Frame and Instruments:


    Adding Indicators to Strategies:


    Using a Time Filter:


    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by GussJ, 03-04-2020, 03:11 PM
    16 responses
    3,281 views
    0 likes
    Last Post Leafcutter  
    Started by WHICKED, Today, 12:45 PM
    2 responses
    19 views
    0 likes
    Last Post WHICKED
    by WHICKED
     
    Started by Tim-c, Today, 02:10 PM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by Taddypole, Today, 02:47 PM
    0 responses
    5 views
    0 likes
    Last Post Taddypole  
    Started by chbruno, 04-24-2024, 04:10 PM
    4 responses
    53 views
    0 likes
    Last Post chbruno
    by chbruno
     
    Working...
    X