Variable for purchasing power?

Forums ProRealTime English forum ProBuilder support Variable for purchasing power?

  • This topic has 1 reply, 2 voices, and was last updated 2 years ago by avatarJS.
Viewing 2 posts - 1 through 2 (of 2 total)
  • #189994

    I would like to create a variable that shows the available cash on hand for purchasing shares. Meaning, if the initial capital is $100 then that variable should be equal to 100. If $50 worth of shares are purchased with a trade commission of $2 then this variable should become 48.

    I am trying to create a “counter” variable like this: v = v – positionprice * countofposition – 2 within the BUY if-loop but it’s not working. The idea is to use this variable to create a condition for buying (long positions) whereby if there is not enough cash on hand to buy to not buy. Otherwise the code is selling at market price to avail cash for executing buys. This is driving me nuts…

    #189996
    JS

    Hi @Nassim

    Something like this…

    Equity = StartCapital + StrategyProfit

    PositionSize = Equity / Close  (Close of share)

    If PositionSize > 1 then
    Buy PositionSize Contracts at Market
    Else
    Sell at Market
    EndIf

Viewing 2 posts - 1 through 2 (of 2 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login