Click here to Login

                                                   Open position profit/loss method in money manager


Dennis Schutten
2017-01-22 15:07:40


What method can I use to get the current open position profit or loss in dollars? What method code can I use?


2017-01-23 03:31:04


In the money management script, you can get all the open positions in the "OnEndPeriod" event for example using this method:
MMPosition[] positions = Portfolio.GetOpenPositions();

You can then loop through each position and calculate the profit/loss by calculating the difference between the open and last price multiplied by the number of shares. Or get the return in percentage and multiply it by the position size.

No more messages


No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"


Trading Items
Volatility-based Position Sizing Method with Adjustable Parameter...
Trading System Template: Position Sizing Techniques
Position Sizing: Fixed Percentage of Current Equity
Position Sizing: Fixed Dollar Amount
Fixed Fractional Position Sizing

How-to Lessons
How to debug a trading system using the money management tool
How to calculate the average of a time series using the money man...
How to add custom position-based metrics to your trading system
How to download Portfolio123 data into QuantShare
How to drag & drop a stock to a static watchlist

Related Forum Threads
Simulation/Back testing - Default position sizing method
How do I reduce a position size from within the Money Management
Enhanced Dynamic Position Sizing money mgmt - some issue
Example of Money Management
Advanced Money Management

Blog Posts
5 position sizing techniques you can use in your trading system
Money Management: Optimize the scale-in strategy
Money Management: Scale-in Trading Strategy
Basic trading system implemented using the money management tool
Dynamic Position Sizing in your Trading System

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2021
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Follow us on Google+
RSS Trading Items

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.