Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entry and EXIT an SMA

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

    Entry and EXIT an SMA

    Hello,

    I have two question.

    1) I want to go short if the price is below the sma20 for a longer time and it comes to kiss the sma20. All the time as the price is below the SMA20 a limit order is set at the sma20 and will be automaticly modified as the SMA 20 changed ofer time.

    2) I want to exit the trade on a SMAxx Target on a specific Timeframe. This taregt must be modified automaticly as the sma is changed over time. The same will be with the STOP Loss. IF one of each is hit the oter oder must be canceled.

    Thanks for yoour help
    Sailor

    #2
    Hi Sailor,

    One of our NinjaScript trainees will respond later today. Thank you for your patience.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hi Sailor,

      Thanks for your post.

      Please take a look at the following screenshots from our strategy wizard -

      1. The first enters a limit order at the SMA when the last 3 closes were below it, you can of course add more here to make the entry condition tighter.

      2. The second exits the short trade at the SMA of the Low price with the use of a limit order.

      Please also review this link here - http://www.ninjatrader-support.com/H...nBuilder1.html

      Then use the blue arrows at the top to navigate through the Condition Builder examples.
      Attached Files
      BertrandNinjaTrader Customer Service

      Comment


        #4
        Stop Loss Exit

        Thanks for your help. one last question how can I set a stop loss order based on the last highest high above an SMA Line ?

        Comment


          #5
          Hi Sailor,

          You are welcome.

          Please take a look at those three screenshots, those detail all the sets of conditions you need to arrive at your custom stop value.

          However you cannot use it right away in the wizard to update your stop loss order continually. You would need to move to the NinjaScript Editor then by unlocking your code. Please also review this reference sample -
          http://www.ninjatrader-support2.com/...ead.php?t=3222

          Variable0 stores the Stop value you want to use in your order.
          Attached Files
          BertrandNinjaTrader Customer Service

          Comment


            #6
            Betrand,

            I am receiving an error after compiling
            Connot convert from double to integer line 58

            customvariable0 == 0

            Any idea

            Nice to see that you are from Hamburg, I am from Berlin.

            Thanks Sailor

            Comment


              #7
              Hi Sailor,

              yes, both very nice cities, was in Berlin for some time, too!

              How did you declare your 'customvariable0' in the Variables() section?

              Also for assigning a value to your variable you should use only one equal sign -

              Code:
              if (Close[0] > Close[1])
              customvariable0 = 0
              BertrandNinjaTrader Customer Service

              Comment


                #8
                I have found the problem it was in an other strategy which was not compiles without errors. So now it is working !

                One last point what can you do if you start the srategy when the strategy in theory already executed the short sell but in realtrading the position isnt short?

                Thanks

                Comment


                  #9
                  When you start your strategy you start off in what is known as a Strategy Position. This position is not to be confused with your Account Position. You have a few options available at this point. You can either sync up your Account Position with your Strategy Position through manually placing orders or you can select "Wait until flat before executing live" and just wait for your strategy to kick in live.

                  The second is easier for most people. All you have to do is ensure your Account Position is flat, select "Wait until flat" in Tools->Options->Strategies->NinjaScript and then when your strategy crosses the flat state the next order will be a live trade. At that point in time your two positions will be in sync.

                  Please review this link: http://www.ninjatrader-support2.com/...ead.php?t=4033
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Target And Stop Loss

                    hi iam runnig a simple strategy.that does not have target or stop loss.please advise how to add stop loss and target to it
                    regards
                    hanaa

                    Comment


                      #11
                      Hi hanaa, thank you for your question.

                      If you are using the strategy wizard, the target and stop loss section is right after the 'Conditions and Actions' page.

                      If you are programming in NinjaScript, please read the references on SetProfitTarget, SetStopLoss, and SetTrailStop.
                      Last edited by NinjaTrader_Austin; 07-06-2009, 04:13 PM.
                      AustinNinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by MatthewLesko, Yesterday, 11:13 PM
                      0 responses
                      4 views
                      0 likes
                      Last Post MatthewLesko  
                      Started by Lance El Camino, Yesterday, 04:14 PM
                      1 response
                      13 views
                      0 likes
                      Last Post s.kinra
                      by s.kinra
                       
                      Started by jtrading82, Yesterday, 04:56 PM
                      1 response
                      10 views
                      0 likes
                      Last Post NinjaTrader_ShawnB  
                      Started by dmking, Yesterday, 06:00 PM
                      1 response
                      6 views
                      0 likes
                      Last Post NinjaTrader_EricB  
                      Working...
                      X