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

Auto Reload Ninja Script F5

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

    Auto Reload Ninja Script F5

    Hi,

    Tryin' to find a indicator or something to timebased autoreset NT script, F5 style.
    Can someone help on the subject? Where should I start from?

    Thanks!

    #2
    Hello nailui, thanks for your post.

    If you need to refresh the NinjaScript on a chart you can use the C# method SendKeys() to send the "F5" key to the operating system. But If you need to automatically refresh like this it would imply that something is broken because no indicator should require a refresh like this. If you would like, please share details on why this is needed and I might be able to help fix the root of the issue.

    Best regards.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Good reading here.

      Comment


        #4
        I am researching exactly the same thing.

        I have an indicator that plots a value based on my market position. These values are 0 if flat, 1 if long and -1 if short. I rely on it to create conditions for my strategies. The indicator updates perfectly when testing on a sim account. When testing live, after closing a long/short position, the value does not update to 0 when flat; it stays on 1 or -1. I need to hit F5 to update it manually, which defeats the purpose of having an automated strategy.

        Is there a simple function I can add in ninjascript? I read about the AutoHotkey solution but I would prefer to opt for a solution in NT8.

        Thanks!

        Comment


          #5
          In your strategy, try calling the indicator's Update() function just before using any of its values.

          Comment


            #6
            Originally posted by andr3i View Post
            I have an indicator that plots a value based on my market position. These values are 0 if flat, 1 if long and -1 if short. I rely on it to create conditions for my strategies. The indicator updates perfectly when testing on a sim account. When testing live, after closing a long/short position, the value does not update to 0 when flat; it stays on 1 or -1.
            How does your indicator know your Strategy has closed its position?

            I mean, how does your indicator know your Strategy is flat?

            Indicators don't even know they're being called by a Strategy,
            and have no direct access to the Strategy's market position.

            Perhaps you have a bug, or your description is too imprecise?

            Last edited by bltdavid; 04-19-2021, 09:08 PM.

            Comment


              #7
              I forgot to specify, I don't use the strategy builder for my strategy. I set up alerts on horizontal lines that I draw on the chart, which trigger embedded atm orders when conditions are met. The indicator prevents the system from repeatedly triggering orders if conditions are met multiple times in a short period of time.

              Is there a way to create an "empty" strategy that would simply update my indicator?

              Comment


                #8
                Calling Update() didn't work?

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by alifarahani, Today, 09:40 AM
                6 responses
                29 views
                0 likes
                Last Post alifarahani  
                Started by Waxavi, Today, 02:10 AM
                1 response
                17 views
                0 likes
                Last Post NinjaTrader_LuisH  
                Started by Kaledus, Today, 01:29 PM
                5 responses
                13 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by Waxavi, Today, 02:00 AM
                1 response
                12 views
                0 likes
                Last Post NinjaTrader_LuisH  
                Started by gentlebenthebear, Today, 01:30 AM
                3 responses
                17 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X