Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

User Variables

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

    User Variables

    Dear NT-Team,

    Can access to user variables please be made available in the Strategy Builder in the same fashion as it is for price for example?

    Why is it not possible to

    - compare current UserVariable with UserVariable x-bars ago?
    - apply an offset (int, double, variable) to an UserVariable?

    Thank you very much for considering.

    Kind regards
    NT-Roland

    #2
    Hello NT-Roland,

    Thank you for your note.

    Are you using NT7 or NT8?

    In NT8 you can create a custom series in the strategy builder, which you would be able to store calculations to for which you could later reference. See the attached screen shot for how you’d set this up, as well as the following section of our helpguide,



    So I may best answer your question, would you please provide a use case where you’d like to apply an offset to a user input?

    I look forward to your reply.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Offset to User Variables

      Hi Alan,
      I see this, but still don't understand how this can help me using Strategy Builder.

      Example 1: Counter
      Day 1: Check condition (e.g. indicator value). If condition is true, set UserVariable Counter (int) to 1.
      Day 1+1: Check condition. If again true, set Counter to Counter[1] + 1.
      Do Loop Until Day 1+n: Check is not true anymore. Reset Counter to 0.

      Where can I apply the simple math Counter = Counter [1] + 1?

      And if I have different counters for Long and Short, where can I add both counters to get the combined Long/Short Counter?

      Example 2: Offset to Time
      Assume, you would like to backtest/do time based intraday trades in different time zones (e.g. DE, US). Entry and Exit Time for the "foreign" time zone cannot taken as per user input (e.g. from 15:30 - 17:00) because the shift from summer to winter time does not occur on the same date.

      Installing NT8 multiple times on different machines for the respective "foreign" time zone is not an option (multiple market data subscriptions, etc.).

      An abstract definition of the summer to winter time change rules for the respective time zone does not seem to be an option with Strategy Builder either because this would require both the "Month" (see my separate post) and a Counter for Weekdays (e.g. 2nd Sunday in March).

      Now, there could be an easy fix just looking at when the first bar of session is true and comparing this to the expected regular opening time (if 1st Bar of Session true before 15:30 -> Early US Trading Hours ending at 21:00; if not, RTH ending on 22:00) and then writing different rules for that.

      BUT this does not allow the user to input the Entry Time and Exit Time for the respective instrument only once (for RTH) and let NT8 do the adjustment for the Early Session period. To have the user enter RTH and ETH entry/exit times separately for each idea is nasty when it comes to backtesting, particularly optimization of time.

      Thus, what I would like to do is to apply a calculated Entry Time and Exit Time based on user input.

      Please let me know how I can do the simple math, if 1st Bar of Session is true before expected Regular Opening Time,

      1) EntryTimeAdjusted (time variable) = Entry Time (User Input) +/- offset (time variable).
      2) ExitTimeAdjusted (time variable) = Exit Time (User Input) +/- offset (time variable).

      Even if I add a custom series "DateTime", I don't seem to be able to do this little calculation in Strategy Builder because I can't figure where the offset in time to a user variable (time) can be applied.


      Example 3: Offset to Time
      Or imagine, that the conditions for a trade are met, but you don't want to do the trade at market, but use a limit instead. You want the limit to be active for x time units. The user should be able to plug in the "LimitTime" (Input) and the Strategy Builder should then calculate until when the order is active.

      LimitUntil (time variable) = Condition Bar + LimitTime (time units)

      Thank you.

      Kind regards
      NT-Roland
      Last edited by NT-Roland; 05-26-2018, 06:53 AM.

      Comment


        #4
        Hello NT-Roland,

        Thank you for your note.

        You would not be able to do a counter in the builder but I will submit this feature request.
        The issue with the time zones could be handled with custom code which would require working outside the builder, however I will also submit a feature request for a user be able to handle this via code written in the builder.

        You would not be able to use an offset with time in the builder, I can also submit an SFT for this.

        I will submit a feature request for a limit order Good Till Time/Bars.

        Since your strategy complexity is growing, you may consider learning code which would make all the issues above easy to solve on your own rather than waiting for SFT’s to go through.

        I would encourage to see the information and links under Getting Started with NinjaScript


        The following will introduce you to the strategy builder;

        Strategy Builder Intro: 7 Minutes
        An overview of the Strategy Builder feature in the NinjaTrader 8 platform.NinjaTrader supports over 40,000 traders around the globe with best-in-class techno...


        Strategy Builder NT8:
        Understand the fundamentals of basic strategy creation by developing an actual strategy using the NinjaTrader Strategy Builder.2:45 Opening a Strategy Builde...


        See the NinjaScript Editor Youttube,
        Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.


        A link to our Help Guide NinjaScript section can be found here,


        Click here to see our NinjaScript Reference Samples:


        You can also contact a professional NinjaScript Consultants who would be eager to create or modify a script at your request or assist you with your script. Please let me know if you would like our business development follow up with you with a list of professional NinjaScript Consultants who would be happy to create this script or any others at your request.

        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Alan,

          Thank you very much for your feedback.

          I consider the scenarios I described pretty basic and uses cases for own calculations are endless, but it understand that I will have to cope with coding in NT rather sooner than later.

          Kind regards
          NT-Roland

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by RubenCazorla, Today, 09:07 AM
          2 responses
          11 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by i019945nj, 12-14-2023, 06:41 AM
          7 responses
          81 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by timmbbo, 07-05-2023, 10:21 PM
          4 responses
          158 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by tkaboris, Today, 08:01 AM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by Lumbeezl, 01-11-2022, 06:50 PM
          31 responses
          819 views
          1 like
          Last Post NinjaTrader_Adrian  
          Working...
          X