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

Working with user Variables

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

    Working with user Variables

    Is there a way to work with formulas from within Strategy Builder to set my User-variables value? Specifically, I want to reset the value after a target was touched, to Zero. That was easy using the Variable = 0 in an Condition / 'action' window. However, If I had a trade which was a loss, I want to add the loss to the variable for that exit and subsequent exits until a profit target was reached, so as to keep a running tab of cumulative loss. I want to use the loss value for subsequent purposes. Is this possible in Strat. Builder or am I off to the wilderness of script editing?

    #2
    Hello RedRock,

    Thanks for writing in to our Support Forums!

    There is currently not any functionality to set a variable to another variable (or the same variable) with a mathematical offset. I may submit a feature request for this feature on your behalf, if you'd like.

    Otherwise, you would have to unlock the code and do the scripting manually.

    Please let me know if I may be of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      Thank-You.

      As manipulating variables is beyond the scope of Strategy Builder, could you possibly point me to some examples where a variable is changed upon some event occurring?

      For example I want to keep track of the number of losing trades before a win is achieved, at which point the variable is reset to zero. Sort of a consecutive real-time loss counter.

      Comment


        #4
        Hello RedRock,

        Thanks for the reply.

        It is within the goal of the Strategy Builder to allow you to build strategies without a programming background. It would benefit yourself as well as others to have the added functionality to do this from the GUI.

        We do not build custom indicators or strategies for customers but if you’d like I could have someone from our business development team pass over a list of professoinal Ninja Script consultants that you could contact about developing this for you. If this is the case please write in to platformsupport[at]ninjatrader[dot]com with the text "1678176 ATTN Jim" in the subject of the email.

        The NinjaTrader 7 help guide contains basic programming concepts that teach you about variables and other basic programming syntax.

        You can view the programming resources from NinjaTrader 7's help guide here:
        Basic Syntax - https://ninjatrader.com/support/help...sic_syntax.htm
        Programming Concepts - https://ninjatrader.com/support/help...g_concepts.htm
        NinjaScript Editor 401 - https://www.youtube.com/watch?v=BA0W4ECyVdc

        After you have looked into working with variables, and are comfortable with your knowledge of C# you may wish to look at the reference sample on protective orders so you can write your strategy to keep track of your trades in OnOrderUpdate() and OnExectution(). These overrides are for advanced programmers so I advise to start small with your programming endeavors.

        That sample can be found here:
        The OnOrderUpdate() and OnExecution() methods are reserved for experienced programmers. Instead of using Set() methods to submit stop-loss and profit target orders, you can submit and update them manually through the use of IOrder and IExecution objects in the OnOrderUpdate() and OnExecution() methods. The OnOrderUpdate()


        I'm still willing to submit the feature request for the Strategy Builder to have better variable handling. Please let me know if you would like me to submit a request for it.
        JimNinjaTrader Customer Service

        Comment


          #5
          Sure Jim, Please submit the request... Great idea which should be helpful to many!

          I have been programming in another more 'natural language' environment for some time. So I know that Ill need to get a grasp on C# to make full use of NT8. Ill look at your samples and see if I can get my brain to 'click'.

          Thanks, RR

          Comment


            #6
            Hello RedRock,

            Thanks for your input to help improve NinjaTrader.

            The feature request is being tracked with ticket ID SFT-2059 and can be seen in the Release Notes of the version of NinjaTrader 8 that contains the feature request's implementation. You can use the link below to view the Release Notes page of the help guide.



            You may also writing in to platformsupport[at]ninjatrader[dot]com to ask a technician on the status of the ticket ID.

            Please let me know if you have any questions.
            JimNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Barry Milan, Today, 10:35 PM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by WeyldFalcon, 12-10-2020, 06:48 PM
            14 responses
            1,428 views
            0 likes
            Last Post Handclap0241  
            Started by DJ888, Yesterday, 06:09 PM
            2 responses
            9 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by jeronymite, 04-12-2024, 04:26 PM
            3 responses
            40 views
            0 likes
            Last Post jeronymite  
            Started by bill2023, Today, 08:51 AM
            2 responses
            16 views
            0 likes
            Last Post bill2023  
            Working...
            X