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 cls71, Today, 04:45 AM
    0 responses
    1 view
    0 likes
    Last Post cls71
    by cls71
     
    Started by mjairg, 07-20-2023, 11:57 PM
    3 responses
    213 views
    1 like
    Last Post PaulMohn  
    Started by TheWhiteDragon, 01-21-2019, 12:44 PM
    4 responses
    544 views
    0 likes
    Last Post PaulMohn  
    Started by GLFX005, Today, 03:23 AM
    0 responses
    3 views
    0 likes
    Last Post GLFX005
    by GLFX005
     
    Started by XXtrader, Yesterday, 11:30 PM
    2 responses
    12 views
    0 likes
    Last Post XXtrader  
    Working...
    X