Home › Forums › Trading System Mentor Course Community › Progress Journal › Len’s Journal
- This topic is empty.
-
AuthorPosts
-
October 4, 2019 at 1:56 pm #110404AnonymousInactive
Hi Len,
Would you be willing to share a snippet of the code to retreive the equity curve to build in a 200dma filter? This is really a great idea. I am constantly monitoring my equity drawdown on each strategy as a mental stop loss but building it into the system itself as you have done is really much better.
Thanks.
Dustin
October 4, 2019 at 11:54 pm #110458LEONARDZIRParticipantDustin,
I am not using Amibroker to track the equity curve. I am using a different software that is not commercially available as yet.October 5, 2019 at 8:49 am #110460MichaelRodwellMemberDustin, you can use ~~~EQUITY to plot the equity curve of a backtest. Might be somewhere to start.
October 5, 2019 at 8:32 pm #110461AnonymousInactiveOk thanks guys. I will take a look around and see if I can program this type of filter within Amibroker. Will let you know if I get there and share the code.
October 7, 2019 at 12:31 am #110465Stephen JamesMemberHere is some code which ‘seems’ to work but I haven’t done any serious testing. Any user therefore will need to do their own analysis and testing to determine if is working as intended.
I’ve added it to the CBT code we use for MR systems.
Code:_SECTION_BEGIN(“Custom Backtester”);
//=================================================================================
//Custom Backtester
//=================================================================================
DailyEntryOrderLimit = MaxPos;
“”;
“Ticker:”;
Ticker = Name();
StaticVarSet(Ticker + “LimitEntryPrice”, Ref(BuyLimit,-1));
“Buy Limit: ” +NumToStr(BuyLimit,1.2);EquityTog = ParamToggle(“Equity Curve”,”Off|On”,0);
EQMA = Param(“Equity Curve MA”,100,2,1000,1);
//———————————————————————————
SetCustomBacktestProc(“”);
if (Status(“action”) == actionPortfolio)
{
bo = GetBacktesterObject(); // Get backtester object
bo.PreProcess(); // Do pre-processing (always required)
MaxOrdersToPlace = 0;
TotalOrdersPlaced = 0;
AveEquity = 0;for (i = 1; i < BarCount; i++) // Loop through all bars { MaxOrdersToPlace = MaxPos - bo.GetOpenPosQty(); TotalSignalCount = 0; SigCount = 0; AveEquity = bo.EquityArray < MA(bo.EquityArray,EQMA); // Count all entry signals for this bar for (sig = bo.GetFirstSignal(i); sig; sig = bo.GetNextSignal(i)) { if (sig.IsEntry() && sig.IsLong()) TotalSignalCount++; } // Process signals for (sig = bo.GetFirstSignal(i); sig; sig = bo.GetNextSignal(i)) { if (sig.IsEntry() && sig.IsLong()) { SigCount++; LimitPrice = StaticVarGet(sig.Symbol + "LimitEntryPrice"); LowPrice = Foreign(sig.Symbol, "Low"); // Restrict number of orders per day if (SigCount > MaxOrdersToPlace OR // Lower in the list than MaxPos less Open positions
SigCount > DailyEntryOrderLimit) // Exceeds max orders per day parameter setting
sig.Price = -1; // Therefore exclude this signal
else
TotalOrdersPlaced++; // Count orders placedif (LimitPrice[i] < LowPrice[i]) // If limit less than Low... sig.Price = -1; // ...Doesn't meet entry trigger criteria else TotalOrdersPlaced++; // Count orders placed if (EquityTog && AveEquity[i-1]) sig.Price = -1; } } // End of for loop over signals at this bar bo.ProcessTradeSignals(i); // Process trades at bar (always required) } // End of for loop over bars bo.PostProcess(); // Do post-processing (always required) st = bo.GetPerformanceStats(0); bo.AddCustomMetric("Total Entry Orders Placed", TotalOrdersPlaced, Null, Null, 0); bo.AddCustomMetric("Fill Rate", NumToStr(((st.getvalue("AllQty") / TotalOrdersPlaced) * 100), 1.0) + "%", Null, Null, 1); } //================================================================================= _SECTION_END();
October 7, 2019 at 4:26 am #110467JulianCohenParticipantHi Craig,
Can we just add this at the bottom of the Custom backtester code as a separate section?
October 7, 2019 at 8:53 pm #110469Stephen JamesMemberJulian
You can replace current CBT code for a limit order, except it does not have any position sizing variables in it as I understand some of yours do.It would need adjustment for any buy at open system.
It uses a CBT object bo.EquityArray so the question at this stage is whether that array continues to take all raw signals when the traded signals are being ignored.
I’ll post a bolt on version later to use with any existing code.
October 7, 2019 at 9:20 pm #110470LEONARDZIRParticipantCraig,
Very helpful. I was never able to generate the equity ticker using the cbt templates.October 7, 2019 at 10:46 pm #110471Stephen JamesMemberHere’s a version that can be added to any system. I’m getting suspicious of it though – some comparison with some excel analysis is probably the way to go.
Code:_SECTION_BEGIN(“Custom Backtester”);
//=================================================================================
//Custom Backtester
//=================================================================================
EquityTog = ParamToggle(“Equity Curve”,”Off|On”,0);
EQMA = Param(“Equity Curve MA”,50,2,1000,1);
//———————————————————————————
SetCustomBacktestProc(“”);
if (Status(“action”) == actionPortfolio)
{
bo = GetBacktesterObject(); // Get backtester object
bo.PreProcess(); // Do pre-processing (always required)
MaxOrdersToPlace = 0;
TotalOrdersPlaced = 0;
AveEquity = 0;for (i = 1; i < BarCount; i++) // Loop through all bars { TotalSignalCount = 0; SigCount = 0; AveEquity = bo.EquityArray < MA(bo.EquityArray,EQMA); // Count all entry signals for this bar for (sig = bo.GetFirstSignal(i); sig; sig = bo.GetNextSignal(i)) { if (sig.IsEntry() && sig.IsLong()) TotalSignalCount++; } // Process signals for (sig = bo.GetFirstSignal(i); sig; sig = bo.GetNextSignal(i)) { if (sig.IsEntry() && sig.IsLong()) { SigCount++; if (EquityTog && AveEquity[i-1]) sig.Price = -1; } } // End of for loop over signals at this bar bo.ProcessTradeSignals(i); // Process trades at bar (always required) } // End of for loop over bars bo.PostProcess(); // Do post-processing (always required) } //================================================================================= _SECTION_END();
November 1, 2019 at 11:26 pm #104587LEONARDZIRParticipantOctober 2019
US MR not trading
US MOC stopped trading
US momo +0.88%
Nicks’s TLT 3.69%November 30, 2019 at 4:27 pm #104588LEONARDZIRParticipantNov 2019
Short term trading US – 1.79%
Nasdaq Aggressive + 1.9%Trading poor results this year. However all investments at new equity highs for the year primarily because of 50/50 mix of CXO advisory value/momentum portfolio (+15.9%) so farthis year. I am adding adding a value portfolio this month.
January 1, 2020 at 8:15 pm #104589LEONARDZIRParticipantDecember 2019
Nasdaq aggressive 6.7%
I strayed this year from chartist territory.
I have all my investments in 5 systems.Here are the systems and annual returnsNasdaq aggressive 19.7%
US MOMO (etf) 5.1%
CXO value 31.2%
Novell Diversfied ETF 16.54%
Novell 60/40 SHYIEF 23%
SHY = shareholder yield
ASJanuary 1, 2020 at 8:24 pm #110721LEONARDZIRParticipantHad some real issues generating profits with my US MR and MOC. Stopped trading using MA of my equity curve.
Hooked up with a trader who trades for a living and adopted his strategies.Backtesting looks awesome but So far no exciting profits. Most of his strategies are mean reversion but some shortterm trend.
Joined a beta site of Alvarez. Did learn that he has been having difficulties generating profits with mean reversion in US.
Interesting that Nick had great profits in US with his HFT mean reversion and he is increasing his allocationJanuary 1, 2020 at 8:56 pm #110722Nick RadgeKeymasterMy HFT closed +19.4% and my main MOC closed +19.3%
January 1, 2020 at 9:28 pm #110723LEONARDZIRParticipantNick,
Outstanding results. I am still not there with my mean reversion and MOC. Have great Backtested results but no significant profits as yet. -
AuthorPosts
- You must be logged in to reply to this topic.