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 geddyisodin, 04-25-2024, 05:20 AM
          8 responses
          58 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by halgo_boulder, 04-20-2024, 08:44 AM
          2 responses
          21 views
          0 likes
          Last Post halgo_boulder  
          Started by mishhh, 05-25-2010, 08:54 AM
          19 responses
          6,189 views
          0 likes
          Last Post rene69851  
          Started by gwenael, Today, 09:29 AM
          0 responses
          5 views
          0 likes
          Last Post gwenael
          by gwenael
           
          Started by Karado58, 11-26-2012, 02:57 PM
          8 responses
          14,830 views
          0 likes
          Last Post Option Whisperer  
          Working...
          X