• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

limiting SetTrailStop() updates to once every second

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

    limiting SetTrailStop() updates to once every second

    Hi,

    at present I have a trailing stop configured as below:

    else if (State == State.Configure)
    {
    //Sets a trailing stop
    SetTrailStop(CalculationMode.Ticks, Trailing_Stop);

    }


    I notice that every single tick is causing my trailing stop position to be re-evaluated, causing problems with my connection to my broker.

    What is the best practice method to throttle the updates to my trailing stop? are there any examples?

    Ideally these should not be updating more than once per second.

    Do I need to create a for loop and evaluate the trailing stop within this, or is there a variable I can configure?

    #2
    Hello Conall,

    Thank you for your note.

    What do you have Calculate set to in State.Set Defaults? If this is set to calculate on each tick, that's exactly how your stop will be evaluated - every time a tick comes in. If you set this to OnBarClose for your strategy, it will only evaluate when the bar closes, which as long as you're not running said strategy on a 1 tick data series, would be less often than each tick.

    Here's a link to our help guide on SetTrailStop:

    https://ninjatrader.com/support/help...ttrailstop.htm

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hi Kate,

      the issue with this approach is that it affects the whole strategy.

      In the scenario where I wish for it to apply to the trailing stop only, and not the rest of the strategy, what is the best method to implement this?

      Is it possible for me to for example, call a method from a different script, and have that script have a different calculation method?, or should I rely on using a loop or a counter of some kind ?

      regards,
      Conall

      Comment


        #4
        Hello Conall,

        Thank you for your post.

        If you would like the SetTrailStop() to only update when the bar closes, set Calculate to OnBarClose, for all other actions you would like triggered intra-bar, add a secondary series and trigger the logic for that series' BarsInProgress.

        Here's a link to one of our forum posts with further information about utilizing a secondary data sereies for intrabar granularity:
        https://ninjatrader.com/support/foru...377#post773377

        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          thanks for getting back to me Kate, that looks like a great solution. Thanks.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by chazyang, Today, 02:01 AM
          1 response
          3 views
          0 likes
          Last Post chazyang  
          Started by tonynt, Today, 01:20 AM
          0 responses
          13 views
          0 likes
          Last Post tonynt
          by tonynt
           
          Started by sdauteuil, Yesterday, 11:02 PM
          1 response
          3 views
          0 likes
          Last Post sdauteuil  
          Started by Jschmelz, Yesterday, 04:45 PM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_Marco  
          Started by sisenberg, Yesterday, 08:06 PM
          1 response
          11 views
          0 likes
          Last Post sisenberg  
          Working...
          X