Announcement

Collapse
No announcement yet.

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.

    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 Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                596 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                343 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                103 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                556 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                554 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X