Hi ,
I am having diffuculties to calculate rigth order size for live trading with Oanda. Leverage in the account is set for 30 for the asset. Basically an Apha triger to place a market order while having no open position for full available margin in the account , and after when position profits ie there is available margin to trade, trying to place a new market order with avaialble margin for pyramiding. Calculating postion size by simply available margin / asset price and multiplying with leverage worked very well in back tests however in live trading it always calculate much bigger size than tradable.
Gurumeher Sawhney
Instead of manually calculating the order size, there are two methods that can assist in margin modeling. GetMaximumOrderQuantityForTargetValue(portfolio, security, decimal) will return the maximum market order quantity to obtain a position with a given value in account currency and GetBuyingPower(portfolio, security, direction) returns the buying power available for a trade. These built-in methods should provide you with more accurate results.
MEHMET YILDIZ
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!