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

Whatif there is no Bar activity?!

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

    Whatif there is no Bar activity?!

    It seems that all ATM methods rely on some sort of Bar activity or an update of a sort. What if the ATM needs to place an order when there is no activity of any type? Say it's quiet after hours and it needs to place an order, then that order won't get executed until the next update of price etc on the chart?

    #2
    Hi mktrend, correct the ATM needs to reach it's user set trigger prices to place / modify orders. Once they are placed market action will determine their execution, if you happen to trade after hours or in quiet environment, this can take some time.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      Hi mktrend, correct the ATM needs to reach it's user set trigger prices to place / modify orders. Once they are placed market action will determine their execution, if you happen to trade after hours or in quiet environment, this can take some time.
      Thanks for the quick response. This is a little worrying since in such case the trader loses the opportunity to preposition himself or get in the Que!

      I wonder why, the users can't raise an event in their code, any idea please? I wonder if as a bad alternative one could place a timer that say in the case of n seconds lack of updates to take whatever action like placing a trade but then when there is no update and your code does place an order, would it then go through or it still needs an update to occur to pass the trade?

      Comment


        #4
        Hi mktrend, not sure I follow - when you have a strategy that triggers an entry and then launches an ATM strategy to manage the exit, you can use the AtmStrategyChangeStopTarget() for example to change your orders on custom conditions in your code. Please see this link here - http://www.ninjatrader-support.com/H...topTarget.html

        For a complete ATM strategy example, please open the 'SampleAtmStrategy' in your NinjaScript editor.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          mktrend,

          If you do not wish to wait for market data as your event you can create your own custom event. Please see this reference sample: http://www.ninjatrader-support2.com/...ead.php?t=5965
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_Josh View Post
            mktrend,

            If you do not wish to wait for market data as your event you can create your own custom event. Please see this reference sample: http://www.ninjatrader-support2.com/...ead.php?t=5965
            Thanks, that's what I was looking for...

            Comment


              #7
              Originally posted by NinjaTrader_Josh View Post
              mktrend,

              If you do not wish to wait for market data as your event you can create your own custom event. Please see this reference sample: http://www.ninjatrader-support2.com/...ead.php?t=5965
              Josh,
              Why is it necessary to run the following code on every tick? When just Running it once should suffice to make it a subscriber to the event?

              Code:
                      /// <summary>
                      /// Called on each bar update event (incoming tick)
                      /// </summary>
                      protected override void OnBarUpdate()
                      {
                          if (CurrentBar == 0)
                          {
                              // Initiate our Timer object with an interval of 1000ms (1 second)
                              myTimer.Tick += new EventHandler(TimerEventProcessor);
                              myTimer.Interval = 1000;
                              myTimer.Start();
                          }
              }

              Comment


                #8
                It is not running on every tick. It is processed once when CurrentBar == 0.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_Josh View Post
                  It is not running on every tick. It is processed once when CurrentBar == 0.
                  Great, thanks. The currentBar==0 makes it clear while The remarks confused me.
                  /// Called on each bar update event (incoming tick)

                  1- Just out of curiosity to help me with my future programming, does the:
                  "if (CurrentBar == 0)" run on every tick though?

                  2- Also, I'm trying to create an event that will trigger when the state of certain memory changes say from 0 to 1! No support but just a yes or no will do, do you see it feasible and doable utilizing the TriggerCustomEvent?

                  Comment


                    #10
                    1. OnBarUpdate() is updated on every single tick provided you have CalculateOnBarClose = false. The comment is for that segment. Inside there we have CurrentBar == 0. This is checked every single time OnBarUpdate() is processed. There is nowhere else to put said logic. Initialize() should never contain any logic.

                    2. In terms of memory change, that is completely outside the scope of what we can offer support for. Unfortunately I cannot advise you on this at all. It may be best to direct your research at MSDN since that would be C# not NinjaScript.
                    Josh P.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by FrazMann, Today, 11:21 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post FrazMann  
                    Started by geddyisodin, Yesterday, 05:20 AM
                    8 responses
                    52 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Started by cmtjoancolmenero, Yesterday, 03:58 PM
                    10 responses
                    36 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by DayTradingDEMON, Today, 09:28 AM
                    4 responses
                    24 views
                    0 likes
                    Last Post DayTradingDEMON  
                    Started by George21, Today, 10:07 AM
                    1 response
                    19 views
                    0 likes
                    Last Post NinjaTrader_ChristopherJ  
                    Working...
                    X