Announcement

Collapse
No announcement yet.

Position size based on Current Account Size and entry Price

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

  • Position size based on Current Account Size and entry Price

    Hi,

    In my back test program, I want to set my position size = (the money currently available in the account / entry price)

    How do I get current account size?

    Thanks

    Tony

  • #2
    Try:

    For example using: Strategy.doLong(Description, Fill Type, Fill Bar, LotSize, StopOrLimit) -- returns true if filled, false if not filled

    PHP Code:
    var availableMoney = $50000;//decremented by money in a trade and when a trade is exited, decremented by losses and incremented by gains
    var entryPrice 1620.25;//determined by the strategy logic
    Strategy.doLong("My Entry"Strategy.LIMITStrategy.THISBAR, (availableMoney/entryPrice), entryPrice
    How do I get current account size?
    As I understand your question, you track the money available for trading via your code logic. It is all simulated.

    Wayne
    Last edited by waynecd; 08-17-2013, 01:32 AM.

    Comment


    • #3
      Yes, I did that. I also had my program recalculate "availableMoney" after every trade to reflect gains and losses.

      My question was if Strategy Analyzer keeps track of that number and how to use it for calculation.
      Because on the backtesting report, Strategy Analyzer produces an Equity Curve.
      That means the software must have kept track of current account size after every trade.
      I was wondering if there's a way to retrieve that number for calculating the size of full position.



      Originally posted by waynecd View Post
      Try:

      For example using: Strategy.doLong(Description, Fill Type, Fill Bar, LotSize, StopOrLimit) -- returns true if filled, false if not filled

      PHP Code:
      var availableMoney = $50000;//decremented by money in a trade and when a trade is exited, decremented by losses and incremented by gains
      var entryPrice 1620.25;//determined by the strategy logic
      Strategy.doLong("My Entry"Strategy.LIMITStrategy.THISBAR, (availableMoney/entryPrice), entryPrice

      As I understand your question, you track the money available for trading via your code logic. It is all simulated.

      Wayne

      Comment


      • #4
        pisces029
        There isn't a function that will return that value
        Alex


        Originally posted by pisces029 View Post
        Yes, I did that. I also had my program recalculate "availableMoney" after every trade to reflect gains and losses.

        My question was if Strategy Analyzer keeps track of that number and how to use it for calculation.
        Because on the backtesting report, Strategy Analyzer produces an Equity Curve.
        That means the software must have kept track of current account size after every trade.
        I was wondering if there's a way to retrieve that number for calculating the size of full position.

        Comment

        Working...
        X