• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Input ATM rules into a Strategy

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

    Input ATM rules into a Strategy

    I want to be able to essentially write ATM rules into a strategy as follows:
    5 ticks in favor move stop to -7
    10 ticks in favor move stop to -5
    15 ticks in favor move stop to Break Even +1

    Does anyone know the code needed to write that? Thanks for the help!!

    Marc

    #2
    Hello wallstreetkid,

    Thanks for your note.

    I am linking an official reference sample that I believe will help you toward your goal. In this reference sample, the author moves the stop loss as you wanting to. The script is called SamplePriceModification.

    Below is a link to the SamplePriceModification reference sample.
    http://www.ninjatrader.com/support/f...ead.php?t=3222


    Please let me know if you need assistance after reviewing this script.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      This is helpful. However it just shows how to make something move to breakeven. How do I write script that allows it to move to +5 or -5 after its moves a certain amount?? Thanks for the help.

      Marc

      Comment


        #4
        Originally posted by wallstreetkid View Post
        This is helpful. However it just shows how to make something move to breakeven. How do I write script that allows it to move to +5 or -5 after its moves a certain amount?? Thanks for the help.

        Marc
        In exactly the same manner. Instead of moving to breakeven, you move to (breakeven - 5 ticks) etc.

        Comment


          #5
          But what do I write?

          Comment


            #6
            Hello Marc,

            Thank you for your response.

            5 ticks in favor move stop to -7 would be the following:
            Code:
            if(Close[0] > Position.AvgPrice + (5 * TickSize))
            {
            SetStopLoss(CalculationMode.Price, Position.AvgPrice - (7 * TickSize));
            }
            10 ticks in favor move stop to -5 would be the following:
            Code:
            if(Close[0] > Position.AvgPrice + (10 * TickSize))
            {
            SetStopLoss(CalculationMode.Price, Position.AvgPrice - (5 * TickSize));
            }
            15 ticks in favor move stop to Break Even +1 would be the following:
            Code:
            if(Close[0] > Position.AvgPrice + (10 * TickSize))
            {
            SetStopLoss(CalculationMode.Price, Position.AvgPrice + (1 * TickSize));
            }
            Please let me know if I may be of further assistance.
            Patrick H.NinjaTrader Customer Service

            Comment


              #7
              I have never done it, but if you set up an ATM, I believe you can use it in your strategy.

              http://www.ninjatrader.com/support/h...tegycreate.htm

              http://www.bigmiketrading.com/ninjat...-strategy.html




              Originally posted by wallstreetkid View Post
              I want to be able to essentially write ATM rules into a strategy as follows:
              5 ticks in favor move stop to -7
              10 ticks in favor move stop to -5
              15 ticks in favor move stop to Break Even +1

              Does anyone know the code needed to write that? Thanks for the help!!

              Marc

              Comment


                #8
                Thank you very much for your help!

                Comment


                  #9
                  Resetting SetStopLoss for Long and Short Positions

                  Chelsea,
                  Since we need to "reset" the SetStopLoss() function once my position goes flat (for non-fixed value stops). It works fine when I trade just one side (say long only), because when I am flat I set the stoploss below the current Low for instance. But when I wish to trade EnterShort I obviously get immediately stopped out. My question is:
                  How do I "reset" the SetStopLoss() function to make it work for potential Long and Short Positions?

                  Please advise.
                  Thanks!

                  Comment


                    #10
                    Hello carlosavellan,

                    Thank you for your post.

                    When the position is flat set the stop loss using ticks, for example:
                    Code:
                    			if (Position.MarketPosition == MarketPosition.Flat)
                    			{
                    				SetStopLoss(CalculationMode.Ticks, stoplossticks);
                    			}
                    Patrick H.NinjaTrader Customer Service

                    Comment


                      #11
                      Makes sense. Thanks.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by profitabletrader306, Today, 12:00 AM
                      0 responses
                      2 views
                      0 likes
                      Last Post profitabletrader306  
                      Started by marcelodelta, Yesterday, 08:28 PM
                      2 responses
                      11 views
                      0 likes
                      Last Post marcelodelta  
                      Started by junkone, Yesterday, 09:06 PM
                      1 response
                      7 views
                      0 likes
                      Last Post NinjaTrader_Marco  
                      Started by ferenc., Yesterday, 04:54 PM
                      2 responses
                      17 views
                      0 likes
                      Last Post ferenc.
                      by ferenc.
                       
                      Started by rwilliam, Yesterday, 03:51 PM
                      1 response
                      13 views
                      0 likes
                      Last Post NinjaTrader_ShawnB  
                      Working...
                      X