Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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?
    BertrandNinjaTrader Customer Service

    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.
        BertrandNinjaTrader Customer Service

        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
            BertrandNinjaTrader Customer Service

            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'.
                BertrandNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by usazencort, Today, 01:16 AM
                0 responses
                1 view
                0 likes
                Last Post usazencort  
                Started by kaywai, 09-01-2023, 08:44 PM
                5 responses
                603 views
                0 likes
                Last Post NinjaTrader_Jason  
                Started by xiinteractive, 04-09-2024, 08:08 AM
                6 responses
                22 views
                0 likes
                Last Post xiinteractive  
                Started by Pattontje, Yesterday, 02:10 PM
                2 responses
                21 views
                0 likes
                Last Post Pattontje  
                Started by flybuzz, 04-21-2024, 04:07 PM
                17 responses
                230 views
                0 likes
                Last Post TradingLoss  
                Working...
                X