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 ghoul, Today, 06:02 PM
          2 responses
          13 views
          0 likes
          Last Post ghoul
          by ghoul
           
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          44 views
          0 likes
          Last Post jeronymite  
          Started by Barry Milan, Yesterday, 10:35 PM
          7 responses
          20 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by AttiM, 02-14-2024, 05:20 PM
          10 responses
          180 views
          0 likes
          Last Post jeronymite  
          Started by DanielSanMartin, Yesterday, 02:37 PM
          2 responses
          13 views
          0 likes
          Last Post DanielSanMartin  
          Working...
          X