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

Simple moving average ea

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

    Simple moving average ea

    I am new to Ninjatrader and I am looking for a Simple Moving Average Expert Advisor - where can I turn to, thanks.

    #2
    Hello Ziklag,

    Please try to avoid sending the same inquiry twice. In the email correspondence you clarified that you refer to automated strategies with "Expert Advisor".

    We have the 'Sample MA crossover' automated strategy available in NinjaTrader. You can find it in the Strategies menu of charts or if you right click in the Control Center-->Strategies-tab and select 'New Strategy'. You can find more information on how to use automated strategies at the links below.

    Control Center-->Strategies-tab


    Chart
    JasonNinjaTrader Customer Service

    Comment


      #3
      I've followed Sitebuilder videos to try and build a SMA automated strategy but ...; I hear 'order submitted' and on the subsequent candle 'order cancelled' - what could I be missing, why are positions not opened?

      Comment


        #4
        Hello Ziklag,

        Thanks for your reply and welcome to the NinjaTrader forums!

        To clarify, you are using Ninjatrader7 and the Strategy Wizard or are you using Ninjatrader7 and coding directly in Ninjascript?

        Based on your description it sounds like you are submitting an entry order using a limit type order, is that correct?

        You are welcome to post your code or attach a screenshot of it as that may save some time.

        Paul H.NinjaTrader Customer Service

        Comment


          #5
          I am using Ninjatrader 8 and the Strategy Builder Wizard ..., yes I was using the limit order type. I hear 'order submitted' and on the subsequent candle 'order cancelled' - what could I be missing, Why are positions not opened?

          Comment


            #6
            hello Ziklag,

            Thanks for your reply.

            I will move this thread to the NinjaTrader8 strategy forum.

            With limit orders in the strategy builder, they will automatically be canceled if not filled on the same bar they are submitted on. To keep them alive, you would have to resubmit the order on each bar until filled or until no longer needed. The limit type orders are automatically canceled because of the order handling rules specified here: https://ninjatrader.com/support/help...d_approach.htm

            What you can do is to create a bool variable and set it to false. When your entry condition occurs, determine and save your entry price into a double variable and set the bool to be true. In another set you would check to see that your market position is flat and that the bool is true and when both are true to submit the limit order. Once the order is filled the market position change keeps it from resubmitting and you should also reset the bool in prep for the next entry.

            Or you can simply use a market order to enter.

            Paul H.NinjaTrader Customer Service

            Comment


              #7
              My concern is ...; why are orders not filled? I am very new to Ninjatrader and working on a demo account. Pronouncing 'Order Submitted' is proof that I've got a lot correct already. So what am I missing that these orders are not filled? Pronouncing 'Order Cancelled' is proof that I've got a lot correct already. Why are orders not filled?

              Comment


                #8
                One of my suspicions is ...; both the videos and Strategy Builder do not show me how/ where to set position (lot) size ...; could it be that orders sent do not have specification for position size? I've walked through it over and again but I'm failing to see where to specify lot-size.

                Comment


                  #9
                  Hello Ziklag,

                  Thanks for your posts.

                  For a limit order to fill price would need to go through the price level.

                  If you want to use the same quantity on every order, when you apply the strategy, in the strategy parameters, locate the field "set order quantity" which will by default show "Strategy", click the drop-down arrow and select "Default quantity" and a new field called "Default Quantity" will appear and you can directly enter the number to buy or sell each time.
                  Reference: https://ninjatrader.com/support/help...tegyProperties
                  Paul H.NinjaTrader Customer Service

                  Comment


                    #10

                    See attached; I'm looking forward to knowing what it is that I am missing, that is failing my signals from being generated/ executed.
                    Attached Files

                    Comment


                      #11
                      Hello Ziklag,

                      Thanks for your reply.

                      On the strategy tab, the name of the strategy is a yellow color. This indicates the strategy is waiting to close its historic position (1 long). Once that position is closed then the strategy would begin trading live.

                      Reference: https://ninjatrader.com/support/help...eStrategiesTab

                      Your strategy conditions are quite unusual. Rather than trying to tell you what is missing it would be more productive for you to provide a screenshot of a chart that shows the condition you are trying to create in the strategy builder.

                      In case you have not seen these resources on the Strategy Builder:

                      Free live webinar every other Thursday at 4:00 PM EST, through this link to all webinars: https://ninjatrader.com/PlatformTraining
                      Previous recording of the Strategy Builder 301 webinar: https://youtu.be/HCyt90GAs9k?list=PL...auWXkWe0Nf&t=2
                      Help guide for the strategy builder: https://ninjatrader.com/support/help...gy_builder.htm
                      Paul H.NinjaTrader Customer Service

                      Comment


                        #12
                        See attached ..; under Control Center - the 'Positions Tab' shows no position, but the 'Strategies Tab' shows there's a position, I've already reset/ restarted the platform to no avail; how do I get rid of it? Too, I availed you screenshots of the steps I took, complete with notes under each screenshot that you may help where I got it wrong,somewhere something ain't right.
                        Attached Files

                        Comment


                          #13
                          Hello Ziklag,

                          Thanks for your reply.

                          The position is of the strategy's historical position meaning it is not a live position. To remove you would need to remove the strategy. A strategy will perform historical trades on historical data but these are not real trades but are intended to show you what the strategy would have done had it been live data. In your case when the strategy goes to the live data it still has a long historical position.

                          "Your strategy conditions are quite unusual. Rather than trying to tell you what is missing it would be more productive for you to provide a screenshot of a chart that shows the condition you are trying to create in the strategy builder."

                          Please post a screenshot of a chart that illustrates what entry you want to make with the strategy builder as that will be the quickest way forward.
                          Paul H.NinjaTrader Customer Service

                          Comment


                            #14
                            See attached ...; I want to sell/ short the moment that Price Crosses From Above (intrabar) and to buy/ long the moment that Price Crosses From Below (intrabar). For simplicity of "strategy building," I could have the two running separately; one strategy doing short only and another/ separately doing long only. If I could get the A-to-Z steps of making that happen, I will be the happiest today ;-)
                            Attached Files

                            Comment


                              #15
                              Hello Ziklag,

                              Thanks for your reply.

                              While we typically do not provide this much detail, to help you get started:

                              To accomplish your goal you will need to run your strategy with Calculate.OnPriceChange (or Calculate.OnEachTick) This will get you that moment of crossing on the live bar and the ability to place the order intrabar.

                              For the the crossabove set, I would suggest checking to see:

                              Left side: Price > High
                              Center: CrossAbove
                              Right Side: Indicators>SMA(30) (You had select high price and that is fine)

                              Because your strategy will be run on every price change, we will have to add further conditions so that the order is placed only once as the conditions of crossing can occur hundreds of times within the bar as price oscillates. First, add a condition to check that the market position is flat (see the example here: https://ninjatrader.com/support/help...ionComparisons) That will prevent placing an order unless you are flat. In addition, you will need to create an int variable in the inputs and variables section, call it LongEntryBar (or whatever you like). Create the condition like this:
                              Left side: Misc>Current bar
                              Center: Not Equals
                              Right side User Variables>LongEntryBar

                              Also, in the do the following section:

                              Order Management> EnterLong()
                              and
                              Misc>Set LongEntryBar> click set then select Misc>Current Bar and click Ok.


                              In the Stops and Targets window, create a single stop and set it to "ticks" and specify the number of ticks to set the stop loss, zero will not work. Same with the profit taregt, set it to ticks and set some value.

                              I would suggest to create just this first and make sure it is working as you expect. Once it is then you can see how you can add the short side.

                              Please note: When you apply the strategy to a chart, you will see historical trades and these trades cannot be made intrabar (without unlocking your strategy) so just be prepared to see that but when you are on live data (or Playback with market replay) you will see intrabar orders.
                              Paul H.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by algospoke, Yesterday, 06:40 PM
                              2 responses
                              18 views
                              0 likes
                              Last Post algospoke  
                              Started by ghoul, Today, 06:02 PM
                              3 responses
                              14 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              3 responses
                              44 views
                              0 likes
                              Last Post jeronymite  
                              Started by Barry Milan, Yesterday, 10:35 PM
                              7 responses
                              20 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by AttiM, 02-14-2024, 05:20 PM
                              10 responses
                              180 views
                              0 likes
                              Last Post jeronymite  
                              Working...
                              X