Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Frustrated

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

    Frustrated

    I am trying to do what I considered a simple trade strategy. I want to trigger a trade based on ATR trailing stop. I can clearly see the point when I chart it but have been unable to figure out how to cause a trade to occur using the strategy wizard.

    Any help would be appreciated. If I can't figure out something this simple I will abandon using this program.

    #2
    Hi uwuffle,

    I'd be happy to assist you, but first, can you describe a little more about how you want the strategy to behave...

    1. At what value of the ATR do you want to enter a trade, to exit?
    2. How do you want the trailing stop to behave?

    Here are some great tutorial on the subject
    Simple MA Crossover - http://www.ninjatrader-support.com/H...gyViaTheWizard

    Also, every other week, there is a "Automated Strategy Development Level 1" webinar. Click the link in my signature for a schedule of live events.
    TimNinjaTrader Customer Service

    Comment


      #3
      Thank you for the pointer. I have been thru all that training and I can make strategies using cross overs of averages etc. I am having a problem using ATRTrailingStop.

      I was trying to keep it simple and just go long when it signalled down and exit when it signalled up. If you just pick AA from the DOW, do a daily chart and apply ATRTrailingStop indicator (I used defaults) to the chart you will get arrows at the locations I want to trigger actions.

      Comment


        #4
        uwuffle,

        Unfortunately this would depend on how the particular indicator you are using is programmed. If the author made the indicator have programmatically accessible events for those locations then you can check against those, otherwise it would not be possible through the Strategy Wizard.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Initially I was using 6.5 and a downloaded authors ATRTrailingStop. I am currently using 7.x Beta and using your ATRTrailingStop, so the question is does your indicator support this?

          Comment


            #6
            How do I determine?

            Comment


              #7
              The current indicator code provide is below, I don't see any events.

              protected override void Initialize()
              {
              Add(new Plot(Color.Blue, PlotStyle.Line, "Trailing Stop"));
              CalculateOnBarClose = true;
              Overlay = true;
              BarsRequired = 1;
              }

              /// <summary>
              /// Called on each bar update event (incoming tick)
              /// </summary>
              protected override void OnBarUpdate()
              {
              if (CurrentBar < 1)
              return;

              // Trailing stop
              double trail;
              double loss = ATR(Input, Period)[0] * Multi;

              if (Close[0] > Value[1] && Close[1] > Value[1])
              trail = Math.Max(Value[1], Close[0] - loss);

              else if (Close[0] < Value[1] && Close[1] < Value[1])
              trail = Math.Min(Value[1], Close[0] + loss);

              else if (Close[0] > Value[1])
              {
              trail = Close[0] - loss;
              DrawArrowDown(CurrentBar.ToString(), false, 1, Value[1], Color.Orange);
              }

              else
              {
              trail = Close[0] + loss;
              DrawArrowUp(CurrentBar.ToString(), false, 1, Value[1], Color.Orange);
              }

              Value.Set(trail);
              }

              Is it as easy as creating a new ninja script strategy and putting this same code in the Initialization block and changing the DrawArrows to EnterLong or EnterShort?

              Or should I edit the indicator and add events in the drawup and draw down to use in the strategy?

              Comment


                #8
                Hi uwuffle,

                You would need to create a strategy. But you don't need to copy all the code from the indicator to the strategy. Rather you can just "call" on the indicator.

                Is this a custom indicator that you posted below?
                TimNinjaTrader Customer Service

                Comment


                  #9
                  No this is not a custom indicator. It is a direct cut and paste of the ATRTrailingStop Indicator provided in 7.x beta

                  Comment


                    #10
                    Hi uwuffle,

                    I am not aware of any default loaded indicator by that name, however, it looks like you can access ("call") on the indicator directly by it's name.

                    Something like...

                    ATRTrailingStop("variable value", "variable value")
                    TimNinjaTrader Customer Service

                    Comment


                      #11
                      ok, sounds like I will just have to code it.

                      One additional question, if select Tools->Edit NinjaScript->Strategy

                      and select a strategy, it pops open the wizard, I can select view code but the code is read only. Do I have to export the ninja script out to edit it. I didn't believe this was the expected behavior.

                      Type: SimulationOnly
                      .NET/CLR Version: 2.0.50727.4200
                      Expiration: 11/30/2099
                      Licensed features: AdvancedStrategyManagement
                      AutomatedTrading
                      BasicEntry
                      Charting
                      SuperDom
                      Licensed providers: Collective2
                      IQFeed
                      ESignal
                      External
                      Barchart.com
                      Google
                      Replay
                      Simulator
                      Yahoo
                      Gain
                      Zen-Fire
                      InteractiveBrokers
                      MBTrading
                      Patsystems
                      PFG
                      Vision Financial Markets
                      TD AMERITRADE
                      TrackData
                      TradingTechnologies

                      Comment


                        #12
                        Hi uwuffle,

                        There is also the option to "Unlock Code". Once done you can edit the coding in the strategy, but will no longer be able to edit via the Strategy Wizard.
                        TimNinjaTrader Customer Service

                        Comment


                          #13
                          Ok I coded the strategy and the simple one worked as expected.
                          It executes EnterLong() as it should.

                          I am building on the script to have it add to my long position.

                          I have the following code block:

                          if(Position.MarketPosition == MarketPosition.Long)
                          {
                          String s2 = " Current Position Size:" + Position.Quantity.ToString();
                          Log(s2, NinjaTrader.Cbi.LogLevel.Information);
                          EnterLong(500, "daily long add");
                          }


                          The Log message gets logged to the log so I know its entering the code block, but no new shares are ever purchased?

                          Comment


                            #14
                            Hi uwuffle,

                            You can set the Entry Handling to "UniqueEntries" when you apply the strategy, or even hard code it in to the strategy.

                            More info at - http://www.ninjatrader-support.com/H...xEntryHandling
                            TimNinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by burtoninlondon, Today, 12:38 AM
                            0 responses
                            5 views
                            0 likes
                            Last Post burtoninlondon  
                            Started by AaronKoRn, Yesterday, 09:49 PM
                            0 responses
                            12 views
                            0 likes
                            Last Post AaronKoRn  
                            Started by carnitron, Yesterday, 08:42 PM
                            0 responses
                            11 views
                            0 likes
                            Last Post carnitron  
                            Started by strategist007, Yesterday, 07:51 PM
                            0 responses
                            13 views
                            0 likes
                            Last Post strategist007  
                            Started by StockTrader88, 03-06-2021, 08:58 AM
                            44 responses
                            3,982 views
                            3 likes
                            Last Post jhudas88  
                            Working...
                            X