NexusFi: Find Your Edge


Home Menu

 





Equity Curve Trading - Work Around


Discussion in MultiCharts

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




 
Search this Thread

Equity Curve Trading - Work Around

  #1 (permalink)
The9000
Chicago, IL
 
Posts: 6 since Oct 2015
Thanks Given: 0
Thanks Received: 3

After doing an extensive search on the topic, I see lots of people looking for ways to use equity curves however I don't see anyone actually using them.

I use equity curve trading and I've found it fruitful in my higher volume (75 - 100 trades/month) intraday systems. I use the MC Portfolio Trading with ~30 symbols for my strategy. How I use the equity curve slope is I created a custom routine that calculates the slope of the equity curve based on the last X number of trades.

One problem I've found with using the built in equity curve (net profit)in TS/MC is it generates the equity curve based on the last X number of days. I found it is much more fruitful to use the equity curve based on the last X number of trades and pull the slope off the equity curve using a regression. The is the code in the main strategy for generating the equity curve data:

Inputs:

LRSlopeLen(30);

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

Vars:
TotTds(0),
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];
end;
a_NetPL[1] = (PreviousEquity - netprofit)/EquityScaler;
If TotTds >= LRSlopeLen then Value1 = LinRegArray( a_NetPL, LRSlopeLen, 0, oLRSlope, oLRAngle, oLRIntercept, oLRValueRaw ) ;
oLRSlope = oLRSlope / RSize;
end;

It then pitches it to the Money Management Script (MMS) in the portfolio trader and it adjusts the position size based on the slope of the equity curve (using some other data in the MMS). The Money Management Script code snippet for that is:

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] );
end;

In the MMS script, the equity curve is broken down into four buckets that are of equal size (there about the same number of trades in each bucket). In the bottom bucket with the equity curve < -.075, I don't trade that symbol in the portfolio. In the code snippet, it adjusts the position size in this bucket to 0.

The problem is if the symbol is prevented from trading once the equity curve slope falls below -.075 in my example, the symbol will no longer trade. The impression I was under was that the strategy operated in it's own existance separate from the actions of the MMS. If the strategy generates a buy/sell order, inside the strategy, it counts that trade as if it was placed. However this apparently isn't how it works.

The MMS acts as a firewall to allow/deny/increase/decrease the order before it goes to market. However the netprofit variable in the strategy is effected based on the MMS allowing/denying the trade. If the strategy places a buy/sell order and the MMS prevents it, the order is not realized in the netproft variable in the strategy.

As a work around, I allow it to trade 1 share (stocks) of the symbol. The EquityScaler variable adjusts the equity curve so it's adjusted with a neutral position size. For example, if the base position size is 1.0 and the MMS script adjusts the position size up to 1.5x, when the equity curve is recalculated, it adjusts the profit of the trade by 1/1.5. If it only trades 1 share, the code adjusts the equity curve to simulate the profit based on trading a normal position size.

It works however my geek brain would sleep better at night if I can come up with a way to keep it from placing an order for 1 share when I really don't want to take the trade.

Any suggestions?

Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Quantum physics & Trading dynamics
The Elite Circle
What broker to use for trading palladium futures
Commodities
Cheap historycal L1 data for stocks
Stocks and ETFs
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
REcommedations for programming help
Sierra Chart
 
  #2 (permalink)
thinkorn00b
stavanger
 
Posts: 19 since Sep 2020
Thanks Given: 1
Thanks Received: 1

hi
Did you ever find a workaround for this? I'm looking for something similar, however I want to paper trade on the sideline when the signals are true, store the entry/exit prices into a txt/csv document, then use python to calculate a simple moving average of the paper trades in the document, with a result text saying "trade/not trade". Use this trade/not trade as an additional signal into the strategy for taking the actual trades when the profit curve is above the simple moving average. So I need the strategy to export entry/exit prices, and read the trade trade/not trade signal back from the document.

Reply With Quote
  #3 (permalink)
zordan3274
sydney australia
 
Posts: 1 since Mar 2024
Thanks Given: 0
Thanks Received: 0



The9000 View Post
After doing an extensive search on the topic, I see lots of people looking for ways to use equity curves however I don't see anyone actually using them.

I use equity curve trading and I've found it fruitful in my higher volume (75 - 100 trades/month) intraday systems. I use the MC Portfolio Trading with ~30 symbols for my strategy. How I use the equity curve slope is I created a custom routine that calculates the slope of the equity curve based on the last X number of trades.

One problem I've found with using the built in equity curve (net profit)in TS/MC is it generates the equity curve based on the last X number of days. I found it is much more fruitful to use the equity curve based on the last X number of trades and pull the slope off the equity curve using a regression. The is the code in the main strategy for generating the equity curve data:

Inputs:

LRSlopeLen(30);

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

Vars:
TotTds(0),
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];
end;
a_NetPL[1] = (PreviousEquity - netprofit)/EquityScaler;
If TotTds >= LRSlopeLen then Value1 = LinRegArray( a_NetPL, LRSlopeLen, 0, oLRSlope, oLRAngle, oLRIntercept, oLRValueRaw ) ;
oLRSlope = oLRSlope / RSize;
end;

It then pitches it to the Money Management Script (MMS) in the portfolio trader and it adjusts the position size based on the slope of the equity curve (using some other data in the MMS). The Money Management Script code snippet for that is:

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] );
end;

In the MMS script, the equity curve is broken down into four buckets that are of equal size (there about the same number of trades in each bucket). In the bottom bucket with the equity curve < -.075, I don't trade that symbol in the portfolio. In the code snippet, it adjusts the position size in this bucket to 0.

The problem is if the symbol is prevented from trading once the equity curve slope falls below -.075 in my example, the symbol will no longer trade. The impression I was under was that the strategy operated in it's own existance separate from the actions of the MMS. If the strategy generates a buy/sell order, inside the strategy, it counts that trade as if it was placed. However this apparently isn't how it works.

The MMS acts as a firewall to allow/deny/increase/decrease the order before it goes to market. However the netprofit variable in the strategy is effected based on the MMS allowing/denying the trade. If the strategy places a buy/sell order and the MMS prevents it, the order is not realized in the netproft variable in the strategy.

As a work around, I allow it to trade 1 share (stocks) of the symbol. The EquityScaler variable adjusts the equity curve so it's adjusted with a neutral position size. For example, if the base position size is 1.0 and the MMS script adjusts the position size up to 1.5x, when the equity curve is recalculated, it adjusts the profit of the trade by 1/1.5. If it only trades 1 share, the code adjusts the equity curve to simulate the profit based on trading a normal position size.

It works however my geek brain would sleep better at night if I can come up with a way to keep it from placing an order for 1 share when I really don't want to take the trade.

Any suggestions?

Hi The 9000. This is a great suggestion. I have been looking at how to implement a ranking/rotation strategy on the portfolio trader. The code above does not compile as I guess all the variables/ arrays are not declared. Could you possibly post the full code that compiles?

Reply With Quote




Last Updated on March 6, 2024


© 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