NexusFi: Find Your Edge


Home Menu

 





Code For Basic Money Management System


Discussion in NinjaTrader

Updated
    1. trending_up 1,790 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread

Code For Basic Money Management System

  #1 (permalink)
Tomhgriff1
Dublin/Ireland
 
Posts: 1 since Dec 2011
Thanks Given: 0
Thanks Received: 0

Hi all,

I'm in that frustrating place of being an experienced trader yet don't know how to code but trying my best and made some progress.

However, there's a pretty simple money management rule i'd like to code. Please could someone help me out?

Basically i already have a money management rule based on whether the last series of trades are winners or losers. Basically going from 1 lot to 2 lot.

However, i'd like to code a rule that says for every additional 5k the system makes the minimum size is increased by a 1 lot. So instead of trading either a 1 or 2 lot with sub 5k account once your profits take you above 10k it would be a 2 or 4 lot and so on.

If it helps I have already defined these variables regarding to the normal size

 
Code
private int OrderQuantity = 1;
           private int OrderQuantityMultiplier1 = 2
Many thanks.

Tom

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
REcommedations for programming help
Sierra Chart
How to apply profiles
Traders Hideout
MC PL editor upgrade
MultiCharts
Cheap historycal L1 data for stocks
Stocks and ETFs
 
  #2 (permalink)
Fiddich
CO at the moment
 
Posts: 8 since Sep 2016
Thanks Given: 3
Thanks Received: 5

Hi Tom,

If I'm reading what you wrote correctly, it seems you just need to take your account size and divide it by 5000 to determine your lot size.

Example:

Current account size: $5000
Position quantity calc: current account size / 5000 --> $5000/5000 = 1 contract

If your account size increases to $12,500, then the below calculation would occur:


Current account size: $12,500
Position quantity calc: current account size / 5000 --> $12,500/5000 = 2.5 contracts (include a rounding function here to either round up or down per your preference)

If instead you want to trade 2 contracts for every $5000 in account equity, then just divide by 2500 instead, so a $5k account will trade 2, etc.

Does that help?

Fiddich

Reply With Quote




Last Updated on July 22, 2020


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts