I'm trying to write a custom position sizer where the calculation requires the current buying power.  Is the current buying power simply:  
CurrentEquity * MarginFactor - CostBasisOfOpenPositions ?
    
    
    
    CurrentEquity * MarginFactor - CostBasisOfOpenPositions ?
        Rename
    
        Hmm what about CurrentCash * MarginFactor? 🤷🏼♂️
    
    
        I'm using a margin factor > 1 so CurrentCash goes negative as the simulation is on margin. 
I thought the calculation would be CurrentEquity * MarginFactor - (CostBasisOpenPositions or MTMOpenPositions).
But I'm still getting NSF positions occasionally when there shouldn't be with the above logic.
Is it possible to add a CurrentBuyingPower property to UserStrategyBase to go along with CurrentCash and CurrentEquity?
    
I thought the calculation would be CurrentEquity * MarginFactor - (CostBasisOpenPositions or MTMOpenPositions).
But I'm still getting NSF positions occasionally when there shouldn't be with the above logic.
Is it possible to add a CurrentBuyingPower property to UserStrategyBase to go along with CurrentCash and CurrentEquity?
        BuyingPower = ( ( MF - 1 ) * CurrentEquity ) + CurrentCash
    
    
        Thank you
    
    
        I would be interested in this position sizer. I've run Percent Equity thus far and it has been useful when backtesting. But recently, I've had rejected orders from the broker because of lack of buying power. It would be awesome if there was a way WL knew my buying power and could make trades based off of that number....or if there was a feature that you could select for it to submit an order using the remaining buying power of an account (as long as the $ amount wasn't over X% of an account's total value). 
    
    
            Your Response
            
            Post
        
        
        
    
            Edit Post
            
        
        
        
    
            Login is required