Position Sizing - Equity Curve Trading - EasyLanguage Programming | futures.io
futures.io futures trading

Go Back   futures.io

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > TradeStation > EasyLanguage Programming

Position Sizing - Equity Curve Trading
Started:April 10th, 2016 (12:13 PM) by CharlieTrader Views / Replies:326 / 3
Last Reply:April 24th, 2016 (11:25 AM) Attachments:0

Welcome to futures.io.

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

Position Sizing - Equity Curve Trading

Old April 10th, 2016, 12:13 PM   #1 (permalink)
Elite Member
Futures Experience: Advanced
Platform: MultiCharts
Favorite Futures: Global Futures
Posts: 6 since Apr 2016
Thanks: 2 given, 0 received

Position Sizing - Equity Curve Trading

Hello guys,

i've actually pinched this code from another user on this site but have been unable to make the modifications to work. Basically the code is looking at the slope of the closed trades equity curve and then passing this to a money management algorithm which resizes the trade size depending on whether the strategy is going through a winning or losing streak.

There are two parts to this, firstly the code to be placed within the strategy code and then secondly the code for the money management algorithm(MM) to be placed in the MM signal section within Portfolio Trader.

At present i have this code for the MM signal but am not sure if i have assigned code correctly to variables or arrays:



for idx = 0 to portfolioStrategies -1 begin
TargetRank[idx] = pmms_get_strategy_named_num(idx, "TargetRank");
EquitySlope[idx] = pmms_get_strategy_named_num(idx, "EquityCurveSlope");

// Adjust position size based on equity slope

AdjustedPositionSize[idx] = 1.25;
If EquitySlope[idx]>= .150 then AdjustedPositionSize[idx] = 1.5;
If EquitySlope[idx] <= .075 and EquitySlope[idx]> -.075 then AdjustedPositionSize[idx] = .75;
If EquitySlope[idx] <= -.075 then AdjustedPositionSize[idx] = 0;

// Send the adjusted position size back to the strategy

pmms_set_strategy_named_num( idx, "PosSizeScaler", AdjustedPositionSize[idx] );

Secondly there is the code to be placed in the strategy itself:


Array: a_NetPL[](0);
condition1 = Array_setmaxindex(a_NetPL,LRSlopeLen);

oLRSlope( 0 ),
oLRAngle( 0 ),
oLRIntercept( 0 ),
oLRValueRaw( 0 ) ;

TotTds = TotalTrades;

If TotTds> TotTds[1] then begin
For value1 = LRSlopeLen downto 2 begin
a_NetPL[value1] = a_NetPL[value1-1];
a_NetPL[1] = (PreviousEquity - netprofit)/EquityScaler;
If TotTds>= LRSlopeLen then Value1 = LinRegArray( a_NetPL, LRSlopeLen, 0, oLRSlope, oLRAngle, oLRIntercept, oLRValueRaw ) ;
oLRSlope = oLRSlope / RSize;

Reply With Quote

Old April 10th, 2016, 12:13 PM   #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.


Old April 11th, 2016, 05:10 AM   #3 (permalink)
 Vendor: abctradinggroup.com 
Hamburg Germany
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
Posts: 1,109 since Apr 2013
Thanks: 188 given, 624 received


what does the compiler tell you when you try to compile your code? The first one doesn't declare the arrays at all, which basically means you are trying to use a structure within the code that you didn't create first. You need to declare and initialize arrays just like you do with variables plus depending on the array you need to set the sizes.
You should be able to find the examples you need in the MC wiki and the EasyLanguage Essentials PDF (or check your second code piece).



Reply With Quote
The following user says Thank You to ABCTG for this post:

Old April 24th, 2016, 11:25 AM   #4 (permalink)
Elite Member
Futures Experience: Advanced
Platform: MultiCharts
Favorite Futures: Global Futures
Posts: 6 since Apr 2016
Thanks: 2 given, 0 received

Thanks ABCTG, i'll do that.


Reply With Quote


futures.io > Futures Trading, News, Charts and Platforms > Platforms and Indicators > TradeStation > EasyLanguage Programming > Position Sizing - Equity Curve Trading

« average | indicator »
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
Equity Curve Trading - Work Around The9000 MultiCharts 0 January 24th, 2016 07:12 PM
Position sizing and successful trading. johnedoe Psychology and Money Management 20 January 9th, 2015 04:53 AM
Equity curve trading - possible? DarkPoolTrading Psychology and Money Management 19 March 3rd, 2013 07:42 PM
[MC] Trading only when equity curve is higher than its MA Nicolas11 Elite Automated Trading 2 January 22nd, 2012 05:40 PM
Equity Curve Trading dgresens Psychology and Money Management 3 October 9th, 2011 04:54 PM

All times are GMT -4. The time now is 04:45 AM.

Copyright © 2016 by futures.io. 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.
no new posts

Page generated 2016-10-28 in 0.07 seconds with 19 queries on phoenix via your IP