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.

            Comment


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



              than you for prompt reply, Mike. am looking to have my ATM strategy to be triggered by a Ninja Script, which is very simple. Go long or short on cross above of two EMA's and exit long or short on a cross of the opposite direction. when the position is open i need this position to be managed by my ATM strategy. and whatever shares are left open to be closed by NT on the opposite cross. So far, the script i have triggers on the MA crossover the ATM strategy i need. But it does not close the position in …





              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);
                    			}

                    Comment


                      #11
                      Makes sense. Thanks.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Johnny Santiago, 10-11-2019, 09:21 AM
                      95 responses
                      6,193 views
                      0 likes
                      Last Post xiinteractive  
                      Started by xiinteractive, 04-09-2024, 08:08 AM
                      2 responses
                      11 views
                      0 likes
                      Last Post xiinteractive  
                      Started by Irukandji, Today, 09:34 AM
                      1 response
                      3 views
                      0 likes
                      Last Post NinjaTrader_Clayton  
                      Started by RubenCazorla, Today, 09:07 AM
                      1 response
                      5 views
                      0 likes
                      Last Post RubenCazorla  
                      Started by TraderBCL, Today, 04:38 AM
                      3 responses
                      25 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Working...
                      X