NexusFi: Find Your Edge


Home Menu

 





Money Mgmt and Compounding


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one nismo with 6 posts (0 thanks)
    2. looks_two RM99 with 5 posts (4 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 Family Trader with 1 posts (1 thanks)
    1. trending_up 9,477 views
    2. thumb_up 5 thanks given
    3. group 5 followers
    1. forum 13 posts
    2. attach_file 0 attachments




 
Search this Thread

Money Mgmt and Compounding

(login for full post details)
  #1 (permalink)
nismo
Australia
 
Posts: 32 since Dec 2010
Thanks Given: 7
Thanks Received: 3

Hi All,

I'm trying to implement some Money Mgmt and Compounding into my EasyLanguage strategy. Not really sure where to start though and just need someone to point me in the general direction.

It would be good to be able to have an input called riskPercent which is calculated on your capital which in turn determines the position size based on riskPercent / stopLossPips.

I'm using Multicharts and I trade Forex.

Any help is appreciated.

Cheers,

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
ISO Equity Curve Indicator
NinjaTrader
News alerts
Traders Hideout
Searching for CurrentMonthOHL Indicator
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Tao te Trade: way of the WLD
37 thanks
Deaddogs Stock Trading
27 thanks
GFIs1 1 DAX trade per day journal
25 thanks
Supertradersams Thread Journal on NQ/MNQ
24 thanks
Leaving CFD trading and learning futures
11 thanks

(login for full post details)
  #3 (permalink)
 RM99 
Austin, TX
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
Posts: 839 since Mar 2011
Thanks Given: 124
Thanks Received: 704


For starters,

Check out the help index on development environment.

For what you're looking for, you should check out the "AccountFields" class...

such as Value[RTAccountEquity] or whatever equity parameters you would like to base your position size upon.

Secondly, you should check out the "setxxxxx" suit of functions.

Some of the setstops are based upon a position value, some are based upon a per contract value.

Between setstoploss, setprofittarget, setdollartrailing, setstopcontract, setstopposition, setbreakeven, etc, you should be able to craft your desired exit criteria.

Reply With Quote
(login for full post details)
  #4 (permalink)
nismo
Australia
 
Posts: 32 since Dec 2010
Thanks Given: 7
Thanks Received: 3

Hi RM99,

I currently don't use any of the setxxxx suit of functions and just create my own functions such as:

if marketposition = 1 and close >= (EntryPrice + ProfitPoints) then sell next bar at market;

I do this so I have more control to do things such as sell half a position and let the rest ride. Also the setxxxx suit of functions cannot be in a condition. I'm also lead to believe (although this could be wrong) that the setxxxx suit of functions gets posted straight to the broker?

I can't seem to find the value function you speak of except for the built in variable value1, value2 etc....

For Money Mgmt I'm trying to accomplish something like this:

RiskDollar = AccBalance * RiskPercent;
DollarPerPip = (RiskDollar / LLossPoints)*10;
OrdQnty = DollarPerPip / 0.0001;

This seems to work but I have no way of getting the Account Balance and am just setting this as an input. It would be nice if I could have this read from the broker? or set it once and have it increase/decrease as the account balances goes up/down (overall up of course ) Maybe something like if a trade is successful increase AccBalance by the profit?

Cheers,

Reply With Quote
(login for full post details)
  #5 (permalink)
 RM99 
Austin, TX
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
Posts: 839 since Mar 2011
Thanks Given: 124
Thanks Received: 704


nismo View Post
Hi RM99,

I currently don't use any of the setxxxx suit of functions and just create my own functions such as:

if marketposition = 1 and close >= (EntryPrice + ProfitPoints) then sell next bar at market;

I do this so I have more control to do things such as sell half a position and let the rest ride. Also the setxxxx suit of functions cannot be in a condition. I'm also lead to believe (although this could be wrong) that the setxxxx suit of functions gets posted straight to the broker?

I can't seem to find the value function you speak of except for the built in variable value1, value2 etc....

For Money Mgmt I'm trying to accomplish something like this:

RiskDollar = AccBalance * RiskPercent;
DollarPerPip = (RiskDollar / LLossPoints)*10;
OrdQnty = DollarPerPip / 0.0001;

This seems to work but I have no way of getting the Account Balance and am just setting this as an input. It would be nice if I could have this read from the broker? or set it once and have it increase/decrease as the account balances goes up/down (overall up of course ) Maybe something like if a trade is successful increase AccBalance by the profit?

Cheers,

Vars: AccBalance(0);

//Declaration of Variable

AccBalance = GetRTPurchasingPower(GetAccountID);

The "getxxxxxx" functions will supply you with whatever numerics you're looking for. You can either manually specify your account number or use the "GetAccountID" function to return it.

Reply With Quote
The following 3 users say Thank You to RM99 for this post:
(login for full post details)
  #6 (permalink)
nismo
Australia
 
Posts: 32 since Dec 2010
Thanks Given: 7
Thanks Received: 3

Sweeet just what I'm looking for RM99. Much appreciated.

RM99 do you think I should look more into using the setxxxx suite of functions? Do you know if these orders are held locally and then sent when triggered or are they sent immediately to the broker?

Reply With Quote
(login for full post details)
  #7 (permalink)
 RM99 
Austin, TX
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
Posts: 839 since Mar 2011
Thanks Given: 124
Thanks Received: 704


nismo View Post
Sweeet just what I'm looking for RM99. Much appreciated.

RM99 do you think I should look more into using the setxxxx suite of functions? Do you know if these orders are held locally and then sent when triggered or are they sent immediately to the broker?

Are you using Tradestation?

Reply With Quote
(login for full post details)
  #8 (permalink)
nismo
Australia
 
Posts: 32 since Dec 2010
Thanks Given: 7
Thanks Received: 3

Using Multicharts.

Doh! It appears GetRTPurchasingPower doesnt exist in Multicharts?

Reply With Quote
(login for full post details)
  #9 (permalink)
 RM99 
Austin, TX
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
Posts: 839 since Mar 2011
Thanks Given: 124
Thanks Received: 704


nismo View Post

Well, I can't speak for MC, but assuming they use similar/same exchange parameters and syntax/coding with EL, the short answer is....not in the way you're hoping.

TS exchange server updates the automated orders every 15 seconds. Additionally, if there are 2 different orders (as in a simple bracket with a profit target and stop loss) then the strategy "toggles" between the two picking whichever is "closest" to the current market price.

I know what you're seeking....and the holy grail of "unattended" or hands free trading is not possible on TS (and I'm assuming it's not with MC either).

The only solution I've seen is using macros to execute OCO (order cancels orders) or OSO (order supplemental order) orders just like you would using the platform manually. Even then, i'm not sure if TS maintains those orders on the exchange server in the event you have a disconnection. Essentially, the exchange server is an intermediate between you (and your platform) and the exchange itself......just like the challenges of manually moving a stop on the trading matrix (when you drag and drop, if the market is moving quickly, it can pass your mouse by) the automated strategy orders are not maintained beyond your computer reminding the intermediary to keep them until the price reaches the order and then (and only then) is it sent to the actual exchange.

In the end, not only is it not currently available, but I don't think the engineers really care to develop "hands free" or unattended trading capability....even from a philosophical perspective. Their whole take is that automated trading should be a "cruise control" or "autopilot" and not a "fire and forget" system.

I will tell you that there are things that will complicate your auto exits...

1) Using IOG (if you can ABSOLUTELY help it, don't use IOG, as it asks your system and the exchange server to update ever tick, which can be several times/second on highly volitile instruments....and again, if you're toggling or using multiple orders simultaneously, it MAY create snags with live execution).

2) TS recommends using "synthetic market if touched" orders...which will reduce the number of signals produced or maintained and only issue an order once the price reaches a certain point (which you incorporate into your coding).

In the end, like I said, I'm not sure that even using manual macro orders maintains orders at the actual exchange. I know with my old broker and using TransAct, my orders bracket orders would actually get issued to the exchange and then i would get a cancellation order if I moved it (with a number). However, with TS's trade matrix, there's so much functionality that I think using trailing stops and OCO's and such, if the platform isn't live and functioning to send the follow on signals, you end up flying blind with an open position.

Lastly, the only REAL solution to the problem you're trying to solve (unattended trading) is to hire a just graduated finance student at $15/hour to baby sit your system Or baby sit it yourself.

Reply With Quote
The following user says Thank You to RM99 for this post:
(login for full post details)
  #10 (permalink)
 RM99 
Austin, TX
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
Posts: 839 since Mar 2011
Thanks Given: 124
Thanks Received: 704



nismo View Post
Using Multicharts.

Doh! It appears GetRTPurchasingPower doesnt exist in Multicharts?

Go to the help index and do a search for "getxxxxx" and see what functions they have that return numerical values.........

Reply With Quote





Last Updated on June 7, 2011


© 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