Home › Forums › Trading System Mentor Course Community › Progress Journal › Said Bitar Daily Journal
- This topic is empty.
-
AuthorPosts
-
May 11, 2016 at 1:53 pm #103924AnonymousInactiveSaid Bitar wrote:another idea would be open trades re-balance based on the recent performance and the ATR, for example let’s assume i bought 100 shares because at that time 100 shares were the result of the position size and after some months based on the new value of ATR i should have 150 shares so in this case if there is enough capital then i will add 50 shares.
Still i have to get more confident in the amibroker custom backtester since it is a bit more complicated than the regular AFL and documentation is poor, so mainly it will be based on trial and error and checking stuff with the debug and trace :ohmy:
here is my first attempt at rebalancing position size. it only rebalances current positions and makes no attempt to buy new positions if cash is left over after rebalancing. it also makes no check to see if enough cash is available to begin rebalancing.
Code:function calculateShares(equityValue,atrValue)
{
riskFactorShares = 0.001;
shares = round((equityValue*riskFactorShares)/atrValue);return shares;
}_SECTION_BEGIN(“Custom Backtesting”);
//=========================================================
// Custom Backtester
//=========================================================
SetOption(“UseCustomBacktestProc”, True );if( Status(“action”) == actionPortfolio )
{
// wednesdays only
tradingDay = DayOfWeek() == 3;
//total wednesdays
countTradingDay = Cum(tradingDay); // count Mondays
// rebalance only on tradingDay, every 2nd one
rebalanceDay = tradingDay AND (countTradingDay % 2 == 0);bo = GetBacktesterObject();
// initialize backtester
bo.PreProcess();// Loop through all signals at this bar
for (i = 1; i < BarCount; i++) { // loop through alll signals at this bar for (sig = bo.GetFirstSignal(i); sig; sig = bo.GetNextSignal(i)) { SetForeign(sig.Symbol); //calculate ATR for position rebalancing atr20 = Ref(ATR(20),-1); // If this signal is a long entry (ie. buy) and a rebalancing day if (sig.IsEntry() AND rebalanceDay[i]) { // Get stock's composite volume array evol = Foreign("~evol_" + sig.Symbol, "V"); // Get position size specified in AFL code oldPosSize = sig.PosSize; // If it's negative (a percentage of equity) if (oldPosSize < 0) oldPosSize = (-oldPosSize/100)*bo.Equity; // calculate new position size newShares = calculateShares(bo.Equity,atr20[i]); newPosSize = newShares*sig.Price; // if new position size > 1% difference then set new positionsize
if ((abs(oldPosSize – newPosSize)/oldPosSize) > 0.01)
{
// spit out some text for debugging
bo.RawTextOutput(“Rebalancing: ” + “t”+ sig.Symbol + “tBarindex: ” + NumToStr(i) + “tEquity: ” + NumToStr(bo.Equity) + “tfrom: ” + NumToStr(oldPosSize) + “tto: ” + NumToStr(newPosSize));
sig.PosSize = newPosSize;
}// if number of shares > 10% volume then limit it to 10% of volume
shares = sig.PosSize/sig.Price;
if (shares > evol[i] / 10)
{
shares = evol[i] / 10;
sig.PosSize = shares*sig.Price;
}}
RestorePriceArrays();
}
// Process trades at bar (always required)
bo.ProcessTradeSignals(i);}
// Finalize backtester
bo.PostProcess();
}
//=========================================================
_SECTION_END();May 14, 2016 at 9:04 am #103954SaidBitarMemberIndex Filter on MRV turned red, so at least for Monday there will be no orders to place just some exits.
On WTT there is one exit and i have tiny position of OCX (49 shares) they are due to merger took place last year also i will get rid of them since they do not satisfy the strategy and better to keep the portfolio clean
On momentum strategy i think i will exit CPGX due to merger with TRP.
I wish Norgate can add field for this stuff so there will be no need to check news for merge and similar stuff
May 15, 2016 at 9:59 am #103973SaidBitarMemberI was playing around with one MRV strategy i loosened one condition and as a result it increased 30% the trade frequency as well as around 10-12% increase on CAR and for sure it brought MDD a bit deeper around 7% to 10% the Edge went down from average of 0.65% to 0.55% as a result of all the changes the profit increased by factor of 4.
playing around is a two edged sword, it is good but i feel that sometimes it is better to leave stuff as they are. If it works don’t touch it.
so i think i will remain with the lower return version since it fits my targets better, normally i am trying to achieve with MRV systems 30%+ as CAR and max of 20% for MDD
May 15, 2016 at 9:41 pm #102554Nick RadgeKeymasterQuote:playing around is a two edged swordEvery action will have some kind of opposite reaction. It’s about finding a balance and being realistic.
For example, I know a vendor that produces some very solid backtest results with his system, but he doesn’t use any liquidity filters. I can make my systems look darn good by doing the same, but in the real world I’m going to come unstuck.
June 5, 2016 at 12:39 pm #103974SaidBitarMemberBack from vacation now i have more energy for new systems and ideas
May 2016 performance
Total performance is -0.19%
MRV performance is 1.35%
WTT performance is -0.24%
Momentum performance is -1.59%July 1, 2016 at 7:43 pm #104127SaidBitarMemberLong time i haven’t been here
performance for June 2016 is -1.85%
here is the breakdown:
MRV -7.71% the figure was -4.5% till Brexit and the remaining built up on Monday after Brexit and in the last 4 days of the month it was only placing trades but nothing got filled. the market was moving higher and higher everyday because the number of orders was decreasing everyday. The Monday 27th of June i exited all the positions on the close honestly was not the best exit for that day because if i exited as per the system most probably i would have been break even for the month. Anyhow i should keep my eyes on the long term not the day to day returnsMomentum -2.23% they are due to the positions that were exited on the first day of the month
Weekly Trend Following 1.55%
Since my strategy portfolio is more heavily weighted towards trend following 75% and Mean Reversion 25% the effect of the loss on the MRV system didn’t have big impact on the overall performance. With trend following I would like to believe that the market is in new trend since April 2016 and the positions that are been closed now are only part of the process of removing the bad weeds from the portfolio while the good trades are continuing to grow and hopefully the fruits will be picked soon
July 7, 2016 at 6:06 pm #104686SaidBitarMemberI have been busy since last week checking why my momentum strategy is not performing OK, so i dived in the code and there it was in the position size i used OI for position size with the idea in my mind that this is what i should have done at that time to calculate the position. Due to the big difference in some of the stocks between the Close price and the OI the results were very good, from memory the CAR was around 28% and DD -26% and mainly due to over positioning some of the trades. The other thing that i was doing is trading only the top 20 stocks so if the stock dropped from the top 20% then it is out, so there was not enough space for the stock to move.
So i changed the position size to Close instead of OI, and i changed from top 20 to a bit larger number i ran the backtest and :ohmy: the good results disappeared
so the CAR became a bit over 18% and the DD in the range of -29%. Honestly this is touching my threshold but due to the fact that this is monthly system and the effort is so small I will continue to trade it.My problem is that after the modifications that are introduced to the system there are differences between what i am holding at the moment and what i should be holding from position size point of view and the stocks. So i have 12 stocks I should be holding but i am not also 7 positions i am holding and i am supposed to be holding them but the number of shares that i should have is less of what i have currently.
So should i align now with the system as per the results of the backtest or should i wait till the end of the month maybe close all and start all over
:huh: :huh: :huh:July 22, 2016 at 7:04 am #104706SaidBitarMemberUntil mid of July the market was trending nicely, trend following systems were doing perfectly good. While MRV were so quite, few orders to be placed and most of the time nothing get filled then the trend took a break and MRV became active everyday more and more orders and many getting filled.
It is really nice how the different systems work together or it looks like they work on shifts.
July 22, 2016 at 8:44 am #104707ScottMcNabParticipantSaid Bitar wrote:I have been busy since last week checking why my momentum strategy is not performing OK, so i dived in the code and there it was in the position size i used OI for position size with the idea in my mind that this is what i should have done at that time to calculate the position. Due to the big difference in some of the stocks between the Close price and the OI the results were very good, from memory the CAR was around 28% and DD -26% and mainly due to over positioning some of the trades. The other thing that i was doing is trading only the top 20 stocks so if the stock dropped from the top 20% then it is out, so there was not enough space for the stock to move.So i changed the position size to Close instead of OI, and i changed from top 20 to a bit larger number i ran the backtest and :ohmy: the good results disappeared
so the CAR became a bit over 18% and the DD in the range of -29%. Honestly this is touching my threshold but due to the fact that this is monthly system and the effort is so small I will continue to trade it.
:What about opportunity cost Said…the MRV systems you have posted leave this one for dead ?
July 23, 2016 at 2:33 pm #104817SaidBitarMemberScott McNab wrote:Said Bitar wrote:I have been busy since last week checking why my momentum strategy is not performing OK, so i dived in the code and there it was in the position size i used OI for position size with the idea in my mind that this is what i should have done at that time to calculate the position. Due to the big difference in some of the stocks between the Close price and the OI the results were very good, from memory the CAR was around 28% and DD -26% and mainly due to over positioning some of the trades. The other thing that i was doing is trading only the top 20 stocks so if the stock dropped from the top 20% then it is out, so there was not enough space for the stock to move.So i changed the position size to Close instead of OI, and i changed from top 20 to a bit larger number i ran the backtest and :ohmy: the good results disappeared
so the CAR became a bit over 18% and the DD in the range of -29%. Honestly this is touching my threshold but due to the fact that this is monthly system and the effort is so small I will continue to trade it.
:What about opportunity cost Said…the MRV systems you have posted leave this one for dead ?
you can’t imagine how many times the idea crossed my head.
why to trade it if i can trade one thing that can give me better results?no answer
but whenever i think about this and i feel i am going to change it, then i know it is time to go for beer
July 23, 2016 at 2:38 pm #104851SaidBitarMemberThe other reason for not replacing it with MRV is that signals overlap, Even if the system is on another universe i will have lots of overlap between the systems
i tried one system on Russell 1000 and another system on S&P500
two different systems, different universe but still lots of same signalsmaybe good idea to find a short term breakout this for sure will never overlap
July 23, 2016 at 8:25 pm #102555ScottMcNabParticipantBe nice to be able to use same systems on UK/European/Asian markets if had the data…will happen eventually I guess
July 24, 2016 at 1:03 am #104852JulianCohenParticipantSaid Bitar wrote:The other reason for not replacing it with MRV is that signals overlap, Even if the system is on another universe i will have lots of overlap between the systems
i tried one system on Russell 1000 and another system on S&P500
two different systems, different universe but still lots of same signalsmaybe good idea to find a short term breakout this for sure will never overlap
I’m planning on using my Same Day Exit system on the S&P 500 and a different MR system on the Russell 2000 excluding the S&P 500 stocks.
July 24, 2016 at 2:36 pm #104853SaidBitarMemberScott McNab wrote:Be nice to be able to use same systems on UK/European/Asian markets if had the data…will happen eventually I guessI am already thinking about it, so that i can trade MRV on AUS market and then MRV on US market.
the thing that is keeping me reluctant is that the performance on AUS market is not as the US market.
lower CAR and Higher DD
regarding other markets since the account is the same that i am using on the US market i need to be sure that the close of the market that i want to trade is before the open of the US market
July 24, 2016 at 2:46 pm #104854SaidBitarMemberJulian Cohen wrote:Said Bitar wrote:The other reason for not replacing it with MRV is that signals overlap, Even if the system is on another universe i will have lots of overlap between the systems
i tried one system on Russell 1000 and another system on S&P500
two different systems, different universe but still lots of same signalsmaybe good idea to find a short term breakout this for sure will never overlap
I’m planning on using my Same Day Exit system on the S&P 500 and a different MR system on the Russell 2000 excluding the S&P 500 stocks.
good idea
-
AuthorPosts
- You must be logged in to reply to this topic.