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

How do I enter the following trading strategies?

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

    How do I enter the following trading strategies?

    Hello. I am a beginner and don't really know how to use NinjaTrader.

    The trading rules are these:
    • Calculate the 15-day average of the daily High minus the Low (daily prices).
    • Today is Monday or Wednesday.
    • The close today must be lower than yesterday’s close minus the range in number one.
    • We sell at the close of the third trading day.

    #2
    Hello silver211,

    Thanks for your post.

    You could consider adding an additional Daily data series to your script using the AddDataSeries() method. Then you could access the High and Low prices of that added Daily series by using Highs[1][0] and Lows[1][0] to do your calculations. Highs[1][0] would get the current High price of the added Daily bar series. Highs[1][1] would get the previous bar's High price of the added Daily bar series. Highs[1][2] would get the High price 2 bars ago on the added Daily series, and so on.

    See this help guide page for information about accessing PriceSeries values like Highs, Lows, Closes: https://ninjatrader.com/support/help...riceseries.htm

    You could use a Time comparison or Time Filter to limit your strategy to taking certain actions during a specified time period.

    Information about creating Time comparison conditions and Time Filters could be found on the help guide documentation linked below.
    Time comparisons: https://ninjatrader.com/support/help..._builder.htm#H owToCreateTimeComparisons
    Time Filter: https://ninjatrader.com/support/help..._builder.htm#H owToCreateTimeFilters

    You could then create a condition in your script that checks if the current Low price from the added Daily series (Lows[1][0]) is Less than yesterday's Daily Close (Closes[1][0]) and call your Entry order method.

    A condition would need to be created to check if three trading days have passed since your Entry order was placed and you would call your Exit order method to exit the current position.

    See this forum thread for more information: https://ninjatrader.com/support/foru...tween-two-date

    NinjaTrader utilizes the C# programming language for developing indicators and strategies.

    The best way to begin learning NinjaScript is to use the Strategy Builder. With the Strategy Builder, you can set up conditions and variables and then see the generated code in the NinjaScript Editor by clicking the View Code button. Note that the Strategy Builder does have limitations on what may be set up, however, this would be the best way to first learn and practice creating strategies in NinjaTrader.

    Here is a link to our publicly available training videos, 'Strategy Builder 301' and 'NinjaScript Editor 401', for you to view at your own convenience.

    Strategy Builder 301 — https://www.youtube.com/watch?v=_KQF2Sv27oE&t=13s

    NinjaScript Editor 401 - https://youtu.be/H7aDpWoWUQs?list=PL...We0Nf&index=14

    I am also linking you to the Educational Resources section of the Help Guide to help you get started with NinjaScript:
    https://ninjatrader.com/support/help..._resources.htm

    If you are new to C#, to get a basic foundation for the concepts and syntax used in NinjaScript I would recommend this section of articles in our help guide first:
    https://ninjatrader.com/support/help...g_concepts.htm

    And the MSDN (Microsft Developers Network) C# Language Reference.
    https://ninjatrader.com/support/help...erence_wip.htm

    Let me know if I may further assist.​
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Thank you for your help.
      I don't know how to program, but can I create a strategy from the Strategy Builder's Conditions and Actions? ​

      Comment


        #4
        Hello silver211,

        Thanks for your note.

        Some of the strategy could be set up in the Strategy Builder but you would need to unlock the script and manually program the strategy to detect if three trading days have passed since your last entry order was placed.

        You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. If you would like our NinjaTrader Ecosystem team follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request please email vendorsupport[AT]ninjatrader.com.

        Let me know if I may assist further.
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          Thank you very much. In the meantime, I will try to contactvendorsupport[AT]ninjatrader.com.after I'll try programming it myself

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by jxs_xrj, 01-12-2020, 09:49 AM
          6 responses
          3,290 views
          1 like
          Last Post jgualdronc  
          Started by Touch-Ups, Today, 10:36 AM
          0 responses
          8 views
          0 likes
          Last Post Touch-Ups  
          Started by geddyisodin, 04-25-2024, 05:20 AM
          8 responses
          61 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by Option Whisperer, Today, 09:55 AM
          0 responses
          8 views
          0 likes
          Last Post Option Whisperer  
          Started by halgo_boulder, 04-20-2024, 08:44 AM
          2 responses
          24 views
          0 likes
          Last Post halgo_boulder  
          Working...
          X