Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Automating once-only tasks

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

    Automating once-only tasks

    Hi

    I would like to know the best way to automate some once-only tasks.

    For example, when I place orders I don't care much about postiion size, but I do care about the $ risked. Such a program would take entry price, stop-loss price and risk amount, then calculate the position size and place the appropriate order. There is no more to do after that.

    I thought one way would be to use a strategy, do the work in Initialize() and simply put a return statement in OnBarUpdate(). However, the strategy remains running.

    There is probably a better way, but I don't have the experience to know it and didn't find anything about it when I searched the forum.

    I'd appreciate any advice.

    Cheers
    Tony

    #2
    Hi Tony, would those orders then come from a fully automated strategy as well? Or would you look to autoadjust the order size on your manual made orders?

    Comment


      #3
      This is for manual orders. Once placed I would adjust stops & targets manually.

      Comment


        #4
        Thanks, then it would be unfortunately not possible to automate this process, you could run your calcs though in an indicator and display the to be traded quantity for example on the chart, so you know what to enter the manual trades.

        Comment


          #5
          Thanks, Bertrand, for your very quick response.
          I am part of a group of 4 trading buddies and I'm assessing NinjaTrader for our use and so far I really like it. It seems to combine the best of several platforms we use currently. Also, the good support is a major factor.
          Cheers
          Tony

          Comment


            #6
            Thanks for the kind words Tony, we appreciate it - if there's anything we can assist on, just post or drop us a note to support at ninjatrader dot com.

            Not sure if you've seen it already, but we also have a nicely filled YouTube channel now as well, NT team training / tips enriched with partner introductions to addons offered for NT - http://www.youtube.com/user/NinjaTraderLLC

            Comment


              #7
              Hi

              Reading this read again, I realise I may not have been entirely clear. I think I can see a way of doing what I want using OnStartUp().

              I wish to input entry level, stop-loss price, target price and risk amount; make position size calculation(s); place appropirate order(s); then do nothing more automatically. Later, after being filled, I may wish to adjust stop-loss level if price moves far enough in my favour.

              Is the following a valid way of achieving such a once-only action?

              Write a NinjaScript strategy
              Within Initialize()
              CalculateOnBarClose = false; for action on the next tick.

              Within OnStartUp()
              Make the appropriate position size calculation(s) and place order(s).
              Disable()

              I think I can manually change the stop loss order(s) later even though the strategy is not running.

              Is my understanding correct?

              Cheers
              Tony
              Last edited by Jellybean; 04-08-2012, 04:39 PM.

              Comment


                #8
                Hi Tony, if the entry condition is automatic, yes you could do that by calling an ATM strategy via AtmStrategyCreate() - but you would not call it in OnStartUp(), but for example on the first realtime bar when you have the strategy running - this could be done by excluding prior OnBarUpdate() calls via Historical - http://www.ninjatrader.com/support/h...historical.htm

                A fully working ATM example in NinjaScript is preinstalled with NT, it's called 'SampleAtmStrategy'.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                580 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                336 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                103 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                554 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                552 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X