Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to programmatically Sync strategy Accountsize with live account onStart

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

    How to programmatically Sync strategy Accountsize with live account onStart

    Is there a best practice for setting the AccountSize on strategy start?

    Currently this is peformed manually for backtest purposes then a tally kept...


    AccountSize=GetAccountValue(AccountItem.CashValue)

    If i have interpreted correctly this will only return during realtime bars


    perhaps then:

    onInit
    {
    AccountSize=1000; //default
    }

    OnBarUpdate()
    {

    if(!Historical) AccountSize= GetAccountValue(AccountItem.CashValue) == 0 ? AccountSize : GetAccountValue(AccountItem.CashValue);

    }
    Last edited by MicroTrends; 06-30-2010, 03:21 PM.
    MicroTrends
    NinjaTrader Ecosystem Vendor - micro-trends.co.uk

    #2
    MicroTrends, we currently do not have a recommend method for synchronizing account size with your live account. What have you tried so far? What about something like:
    Code:
    bool hasSynced = false;
    if (!Historical && !hasSynced)
    {
        AccountSize = GetAccountValue(...);
        hasSynced = true;
    }
    You are correct that it will only return a meaningful value during real-time.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Ok i will try that:


      i was going down the following route:

      onInit
      {
      AccountSize=1000; //default
      }

      OnBarUpdate()
      {

      if
      (!Historical) AccountSize= GetAccountValue(AccountItem.CashValue) == 0 ? AccountSize : GetAccountValue(AccountItem.CashValue);


      }
      MicroTrends
      NinjaTrader Ecosystem Vendor - micro-trends.co.uk

      Comment


        #4
        is it intensive to call GetAccountValue(AccountItem.CashValue) on each barupdate
        say firsttick etc

        if it is then on sessionEnd/Begin
        This will allow factoring in of commissions and mis charges

        thanks for the help
        MicroTrends
        NinjaTrader Ecosystem Vendor - micro-trends.co.uk

        Comment


          #5
          Hi there, as far as I know, calling GetAccountValue() doesn't require very much computing power. As long as you aren't calling it every tick you should be fine.
          AustinNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Segwin, 05-07-2018, 02:15 PM
          14 responses
          1,788 views
          0 likes
          Last Post aligator  
          Started by Jimmyk, 01-26-2018, 05:19 AM
          6 responses
          837 views
          0 likes
          Last Post emuns
          by emuns
           
          Started by jxs_xrj, 01-12-2020, 09:49 AM
          6 responses
          3,292 views
          1 like
          Last Post jgualdronc  
          Started by Touch-Ups, Today, 10:36 AM
          0 responses
          12 views
          0 likes
          Last Post Touch-Ups  
          Started by geddyisodin, 04-25-2024, 05:20 AM
          11 responses
          62 views
          0 likes
          Last Post halgo_boulder  
          Working...
          X