Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy adjusts size of entry based on percentage of current account balance

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

    Strategy adjusts size of entry based on percentage of current account balance

    I've found part of the answer to how this is done, GetAccountValue.

    Would love some help learning how to program the strategy to:
    - before placing the order,
    - retrieve the current broker account balance,
    - reference the percentage of funds allocated for each position,
    - calculate the number of units/shares/lots of this instrument that can be purchased with this percentage,
    - use this number in the entry order
    so the goal can be achieved.

    Anyone know where a sample of this is posted or help in any other way?

    Much appreciated.

    #2
    Hello,

    Thank you for the question.

    It would certainly be possible to use the GetAccountValue() method to retrieve values from the account in realtime. This would reflect the values you see in the control center accounts tab and would be updated when Account Updates occur based on events in the platform. This does only occur in Realtime though so any logic that requires this to be used Historically would not work correctly.

    The remainder of the question would likely require you to create custom logic that does exactly what you are asking. To know what percentage of the total account is utilized in open positions, you would need to store the open position information and quantities to later look that information up.

    Unfortunately this is a more complicated subject so there is not necessarily a specific sample for exactly this. We do have various samples demonstrating getting account values, managing logic based on trade information and PnL information. These can assist in creating your own system for determining the quantity to use.

    Here are a few links which may assist in this question:



    http://ninjatrader.com/support/forum...ad.php?t=19182 (likely if this spans multiple days you would need to reset variables)

    If you have further questions please feel free to ask and I can provide help where I can on this subject.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    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  
    Started by Option Whisperer, Today, 09:05 AM
    0 responses
    2 views
    0 likes
    Last Post Option Whisperer  
    Working...
    X