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

Price touch EMA strategy building question

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

    Price touch EMA strategy building question

    Hello all,

    Just had a quick question that I can use some help with.
    Tried looking around in the forums and elsewhere and couldn't find exactly what I was looking for.

    I want to setup and back-test a strategy where any given futures instrument's price touches a given EMA and a trade is entered at that point.

    The first condition is that the trades will be long/buy if current candle is green, and short/sell if red.
    In addition, once the trade is entered, there is a given ATM applied to the trade.
    Moreover, trades are restricted to specific days of the week AND times of the day.
    Also, only one entry and done for the given time-of-day windows (more in point #4 below).
    Lastly, trades need to be closed by/before market close (US).

    So for example...
    1- Instrument = ES
    2- EMA = 18 period
    3- Days that the trade is to be executed = Tuesdays & Fridays
    4- Hours to be traded
    = 1 hour into the US open (9:30 am to 10:30 am EST)
    = Last half hour of US close (3:30 pm to 4:30 pm EST)
    = 1 hour into London open (3 am to 4 am EST)
    ****P.S. - only one entry per given time window...even if trade is entered and closed out by the ATM before given time window ends
    5- ATM to be applied = ATM_Example_1
    6- Chart time frame = 1 hour

    So to summarize, if the candle is green and the price touches the 18 period EMA, I want the strategy to enter a long trade and apply the given ATM.
    The opposite for red candles (short when price touches the EMA).
    Trades are only on the given times of the day and the given days.

    Appreciate any help I can hopefully get.

    Thank you

    #2
    Hello rps_bizy,

    Thanks for the post.

    It is not really clear what specifically you need help with here. Are you asking for help on all of these items or what specific part do you have a question about? While our support can't just create a sample that contains all of these items we can try to provide resources for various concepts so you can learn NinjaScript. Was there a part of what you are trying in your own code that you needed help with?

    For working with ATM strategies you can see the SampleATMStrategy that comes with NinjaTrader. That is a manually coded script you can view in the NinjaScript editor.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello Jesse,

      Thanks for the response.

      So I basically want to backtest a strategy where a trade is entered when the current price of an instrument touches a given EMA.

      The different items I listed are basically guidelines I would follow if I was using the strategy in a live setting manually...so I wanted the backtest to reflect those points.

      So the strategy itself is to enter trades when price touches EMA.
      The rest of the items are restrictions/guidelines that I would follow (I.e. only trade on specific days and times, only go long on green candle and short on red, etc...)
      The ATM is just the stop and target to be applied to the position once the trade is open.

      Not sure if that’s any clearer than my initial post.

      Thanks fir the help

      Comment


        #4
        Hello rps_bizy,

        One item would be that ATM's can only be used in realtime, if you plan on using an ATM strategy that will require manual coding and cannot be backtested.

        I would otherwise need more specific questions on what you need help with. As noted we can't just make a script that does all of that for you. If you are already making a script and had questions on it we could assist with your questions in contrast to what you made.

        If you need help with all of those topics I would suggest asking individual questions to progress through learning what you need help with. For example 2- EMA = 18 period, we could outline how to use an EMA with the strategy builder. Most of the general use cases are covered in the strategy builder webinar: https://youtu.be/VxU4FR6GWNA

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Thanks Jesse

          I’ll have a look at the link you provided and go from there.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Spiderbird, Today, 12:15 PM
          2 responses
          10 views
          0 likes
          Last Post Spiderbird  
          Started by WHICKED, Today, 12:45 PM
          0 responses
          3 views
          0 likes
          Last Post WHICKED
          by WHICKED
           
          Started by FrazMann, Today, 11:21 AM
          2 responses
          6 views
          0 likes
          Last Post NinjaTrader_ChristopherJ  
          Started by rjbtrade1, 11-30-2023, 04:38 PM
          2 responses
          80 views
          0 likes
          Last Post DavidHP
          by DavidHP
           
          Started by lorem, Yesterday, 09:18 AM
          5 responses
          18 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X