PDA

View Full Version : Money management code


pjimmyinahouse
04-14-2008, 01:27 PM
There doesn't appear to be much MM code (that I can find). Does anyone have a source of code snippets on MM or examples?
There is a lot of Mq4 developmentt, but none that is converted.
My stab in the dark is that it uses the RealizedPnL command to access trade history. - but I'm so green to ninjatrader it's humiliating:rolleyes:
I'm specifically interested in using % of capital per trade. eg 2%.

Frankly I'm surprised I can't find anything, MM is critical to automating any strategy.

Regards
Paul.

adrian
04-15-2008, 04:38 PM
I don't think that NT has any methods to access the size of your portfolio. If you don't want to hack around it using Strategy parameters, you could hack around it by making an API call directly to your broker (if it is supported). This won't help you in backtesting, more's the pity.

NinjaTrader_Josh
04-16-2008, 12:13 AM
Please see this reference sample. It may shed some light as to what you are looking for: http://www.ninjatrader-support.com/vb/showthread.php?t=4084

pjimmyinahouse
04-16-2008, 04:20 PM
Thank you Josh, I did go through this sample before posting. It is very useful but I'm just surprised there isn't more code like this around.

NinjaTrader_Josh
04-17-2008, 01:51 AM
Unfortunately that is the only reference we have available at this time. You can review small code snippets in the Help Guide too. Search for the Trades object.