Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Program control

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

    Program control

    Anyone with C# programing skills know about the following? I need to get my strategy logic right.

    Say I have a method call busy doing stuff ie private void doNothingfor1minutes()
    and it takes a minute to complete. (I must have an old computer did I hear you say?)

    Before it completes something else happens like a new BarInProgress arives, or there is OnExecution or OnPositionUpdate activity.

    Does program control pass to the new activity only when doNothingfor1minutes() completes, or does OnExecution or OnPositionUpdate wrest program control away immediately?


    Hope that is clear.

    #2
    I note that NT7 R2 is now out, and the Release notes for fix number 4257 states that "Strategies will now wait for 5 seconds for inflight executions to come in"

    I suspect this is related, and would appreciate more information from the hardworking NT programmers!

    Thanks.

    Comment


      #3
      Hi Aussie2, I'm sorry but do not currently follow how this fix would be connected to your question - NT is multithreaded which would mean that multiple methods can run concurrently, the situation is likely different when you're maxing out local PC resources.

      Comment


        #4
        Thanks Bertrand,

        I hoped the issue raised in my first post would elicit tips on good programming practice when alternate methods modify shared resources.

        In reality the majority of time my strategy just monitors market activity, rather than taking action. Accordingly the likelihood of concurrent activity in alternate methods is quite small, as I am not dealing with tick by tick data.

        Good multithreading programming advice is available on Wikipedia, and I might implement some for my more time crucial tick by tick strategies. One simple approach would be to take a timestamp at the beginning of the main strategy method statement, and others at the beginning of on execution and position update methods, and then compare, discarding any new orders as required.

        Regards

        Comment


          #5
          Thanks for sharing your findings, unfortunately threadsafe programming techniques is outside of the scope that we can support here...some concepts have been also discussed on MSDN - http://msdn.microsoft.com/en-us/library/ms173179.aspx

          Comment


            #6
            Multicore processing

            As I write this I am Optimising a strategy. I am doing this on a Intel i7 920 with 12G RAM which is overclocked to 3800MHz. I could push it higher however core temperatiures start to max out at 80C.

            However the genetic optimiser still takes a while.

            What is disapointing is to see CPUs 1, 2, 5 and 6 are parked, and flatline throughout optimisation. The genetic optimiser is is only able to use four of the remaining cores. I understand from other posts that the NT UI occupies one full thread and is not spread, and that access across all other cores is not supported.

            WIth multithreaded computing the norm these days, and 16 cores around the next bend, more work on this is needed by the hardworking NT team,

            Multitreading packages like Net 4 TPL or PLINQ libraries now make this so easy. See
            http://codelibraries.blogspot.com/20...net-4-and.html
            Explore the Task Parallel Library (TPL), a set of public types and APIs to simplify the process of adding parallelism & concurrency to applications in .NET.


            (I am running NT7 on NET 4 without issues.)

            Can I suggest that the NT team have another look at this approach?
            Last edited by Aussie2; 01-16-2011, 04:08 PM. Reason: syntax

            Comment


              #7
              Aussie2, your understanding is correct - thanks for sharing those resources, I'll make sure to pass them on for consideration.

              Thanks,

              Comment


                #8
                Postscipt

                Postscript 1: Ended up not using a timestamp. Too much bother. In the end settled for a true false switch to deal with multithreading.

                Postscript 2: Unable to get Net 4 "using System.Threading.Tasks "
                loaded into NT7 to push less important asynchronous activities into an unused core. Even though Net 4 is offically not supported, any one managed?

                Thanks.
                Last edited by Aussie2; 01-18-2011, 12:27 AM. Reason: Title

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                670 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                379 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                111 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                575 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                582 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X