Home › Forums › Trading System Mentor Course Community › Progress Journal › Darryl’s Journal
- This topic is empty.
-
AuthorPosts
-
March 25, 2016 at 1:47 pm #103004SaidBitarMemberDVink wrote:SMcNab wrote:Be interesting to test:
PositionScore = Ref(ATR(10),-1)/Ref(C,-1);
Results even better!
Just remembered one thing last year I was planning to use ranking on mean reversion because I didn’t know about DDE any how what I want to say if you want to use ranking for placing orders you need to back test with ranking and I don’t mean using position score because position score will start working only when u have more positions than capital
The better way in my opinion is to take all the stocks that satisfy your entry signal aND then you rank them after that you trade the top 10 or 20
Suppose on a given day you have 50 stocks that are potential entries you rank them using what ever you desire then u add the rank to the buy signal so buy = buy and rank <20
So it will take only the top 20
Till now it sounds exactly same like position score but if your rank is anything with condition it will be different
For example if you are ranking based on rsi (14)<30 then it will act differentlyI will try to find the afl
I hope I didn’t confuse youMarch 26, 2016 at 8:38 am #103455StephaneFimaParticipantThanks Said.
You did not confuse me, on the contrary, that’s clear.
The only thing is that you absolutely need to backtest the strategy with the same ranking condition.
If you have the AFL that would be fantastic!March 26, 2016 at 9:53 am #103457SaidBitarMemberfor some reason most probably the recent updates the original code is not working so i modified it a bit but it is slow
here is the original code that i used from AB help
Code:// we run the code on WatchList 0List = CategoryGetSymbols( categoryWatchlist, 0 );
SetOption(“MaxOpenPositions”, 3);
if ( Status(“stocknum”) == 0 ) // Generate ranking when we are on the very first symbol
{
StaticVarRemove( “values*” );
for ( n = 0; ( Symbol = StrExtract( List, n ) ) != “”; n++ )
{
SetForeign ( symbol );
// value used for scoring
values = 100 – RSI();
RestorePriceArrays();
StaticVarSet ( “values” + symbol, values );
_TRACE( symbol );
}
StaticVarGenerateRanks( “rank”, “values”, 0, 1224 );
}
symbol = Name();
values = StaticVarGet ( “values” + symbol );
rank = StaticVarGet ( “rankvalues” + symbol );
PositionScore = values;
BuySignal = Cross( Close, MA(Close, 100 ) );
// buy on the next bar
Buy = Ref( BuySignal, -1);
BuyLimitPrice = Ref( Close, -1) * 0.999;
// now we check if limit was hit for the symbols ranked as top 3
Buy = Buy AND L < BuyLimitPrice AND rank <= 3; BuyPrice = Min( Open, BuyLimitPrice ); // sample exit rules - 5 - bar stop Sell = 0; ApplyStop( stopTypeNBar, stopModeBars, 5, 1);
then i modified it to look like this
Code:BuySignal = Cross( Close, MA(Close, 100 ) );// we run the code on WatchList 0
List = CategoryGetSymbols( categoryWatchlist, 0 );
SetOption(“MaxOpenPositions”, 3);
if ( Status(“stocknum”) == 0 ) // Generate ranking when we are on the very first symbol
{
StaticVarRemove( “values*” );
for ( n = 0; ( Symbol = StrExtract( List, n ) ) != “”; n++ )
{
SetForeign ( symbol );
// value used for scoring
values = IIF(BuySignal, 100 – RSI(),0);
RestorePriceArrays();
StaticVarSet ( “values” + symbol, values );
_TRACE( symbol );
}
StaticVarGenerateRanks( “rank”, “values”, 0, 1224 );
}
symbol = Name();
values = StaticVarGet ( “values” + symbol );
rank = StaticVarGet ( “rankvalues” + symbol );
PositionScore = values;
// buy on the next bar
Buy = Ref( BuySignal, -1);
BuyLimitPrice = Ref( Close, -1) * 0.999;
// now we check if limit was hit for the symbols ranked as top 3
Buy = Buy AND L < BuyLimitPrice AND rank <= 3; BuyPrice = Min( Open, BuyLimitPrice ); // sample exit rules - 5 - bar stop Sell = 0; ApplyStop( stopTypeNBar, stopModeBars, 5, 1);
for some reason it is not working so i modified it as following
Code:List = CategoryGetSymbols( categoryWatchlist, 44 );if ( Status(“stocknum”) > 0 )
{
StaticVarRemove( “values*” );for ( n = 0; ( Symbol = StrExtract( List, n ) ) != “”; n++ )
{
SetForeign (symbol);// value used for scoring
values = IIf(C>=1 AND MA(V,21)>=500000 AND L< Ref(L,-1) AND Ref(L,-1)< Ref(L,-2) AND C > MA (C, 100) AND C < MA (C, 5),100-RSI(14),0); RestorePriceArrays( False); StaticVarSet ( "values" + symbol, values ); _TRACE( symbol ); } StaticVarGenerateRanks( "rank", "values", 0, 1224 ); } symbol = Name(); values = StaticVarGet ( "values" + symbol ) ; rank = StaticVarGet ( "rankvalues" + symbol ); PositionScore = values;the modification is changing == 0 to > 0 in
if ( Status(“stocknum”) > 0 )March 27, 2016 at 7:42 am #103458StephaneFimaParticipantThank you Said.
I am going to work on it today.May 2, 2016 at 5:28 pm #102964AnonymousInactiveFinally getting back to this journal after some time away. While away I have refined a MR strategy that seems to have a reasonable performance which I have been paper trading with IB for the last few weeks. Results seem to be confirming backtesting so far:
since 21/04:
total orders placed: 972
total orders filled: 66
total trades completed: 46
winning: 29
losing: 17
open orders: 20May 8, 2016 at 8:34 pm #102965AnonymousInactiveWeekly update:
Going through the process of paper trading MRV strategy. Made a modification to MRV strategy based on an idea from Said’s jounal about modified swing trading strategy. After coding the entry and exit rules I could not make it work but tried using ADX( 8 ) > 30 in my MRV code. Turns out it works well! Here are some results from single run backtests with default position score ranking.Russell 1000 1995-2015
Old MRV:
CAGR 40.44%
Max. system drawdown -13.60%
CAR/MDD 2.97
Total Trades 12,151
Winning Trades 64.16%
Losing Trades 35.84%New MRV:
CAGR 46.27%
Max. system drawdown -17.59%
CAR/MDD 2.63
Total Trades 14,516
Winning Trades 64.65%
Losing Trades 35.35%Russell 1000 2010-2015
Old MRV:
CAGR 21.23%
Max. system drawdown -15.90%
CAR/MDD 1.33
Total Trades 3,483
Winning Trades 60.90%
Losing Trades 39.10%New MRV:
CAGR 47.09%
Max. system drawdown -14.31%
CAR/MDD 3.29
Totafor l Trades 4,720
Winning Trades 64.28%
Losing Trades 35.72%
What is noticable is the increase in CAR and CAR/MDD over the more recent time frames. It seems that my optimizing of entry values had become slightly skewed by market conditions from 1995 to 2001. I’m not quite sure what the concensus is on weighting optimization results more towards recent market conditions.May 8, 2016 at 10:56 pm #102966Nick RadgeKeymasterIf the strategy is robust over the longer window then you can certainly tweak to more recent data to squeeze a little more out of it.
May 13, 2016 at 4:33 am #102967ScottMcNabParticipantFinally getting back to this journal after some time away. While away I have refined a MR strategy that seems to have a reasonable performance which I have been paper trading with IB for the last few weeks. Results seem to be confirming backtesting so far:
since 21/04:
total orders placed: 972
total orders filled: 66
total trades completed: 46
winning: 29
losing: 17
open orders: 20Hi Darryl, Are you using limit orders or are there some buy or sell mkt orders in there ? I would be interested to compare your slippage in the 66 entry or 46 exit trades if any of them were mkt orders (if you get a spare few minutes some time).
Cheers
ScottMay 13, 2016 at 5:20 am #103903LeeDanelloParticipantGeezus they look like impressive stats
May 13, 2016 at 7:25 am #103963AnonymousInactiveScott McNab wrote:Hi Darryl, Are you using limit orders or are there some buy or sell mkt orders in there ? I would be interested to compare your slippage in the 66 entry or 46 exit trades if any of them were mkt orders (if you get a spare few minutes some time).
Cheers
ScottHi Scott. All the buy orders are placed as limiit buy orders and all the sell orders are placed as market orders at the open. I have not had a chance to go through all orders and calculate the slippage yet but it sounds like a good thing to do! I shall try and write some excel code to do it today (my hatred for excel has almost dissapeared now that i have a good use for it). the results of slippage might be interesting… have you noticed much slippage in your paper trading account ?
Also, the impressive stats that i posted are not so impressive anymore :unsure:
since 21/04 until 13/05:
total orders placed: 1329
total orders filled: 81
total trades completed: 74
open trades: 7
winning: 44
losing: 37portfolio return: -3.5%
Actually i’m quite happy about these stats as they verify the backtesting. I changed the strategy on 05/05 so results are a mix the previous MRV system i was testing.
May 13, 2016 at 10:09 am #102968LeeDanelloParticipantAm i correct in saying that the problem with having limit order entries is that a lot of orders won’t get filled in real time trading. So if that’s the case then shouldn’t you allow this in the back testing.
May 13, 2016 at 12:25 pm #103969AnonymousInactiveMaurice Petterlin wrote:Am i correct in saying that the problem with having limit order entries is that a lot of orders won’t get filled in real time trading. So if that’s the case then shouldn’t you allow this in the back testing.Hi Maurice
– yes your correct that alot of orders may not be filled with buy limit orders.
– yes you should allow for this in backtesting! thats why we us MCS with trade skipping. i use a 25% chance of skipping trades when backtesting on Russell 1000.it might be a good excercise at some point to compare the difference in trades taken in reality to those taken by the backests. if the percentage difference is greater than 25% i may be concerned!
has anyone done this exercise already i wonder?
May 13, 2016 at 1:23 pm #102969LeeDanelloParticipanttotal orders placed: 1329
total orders filled: 81
total orders rejected: 1248
% orders filled: 6.1%
% orders rejected: 93.9%When you look at it like that then I would question the limits placed on the orders.
Seems like something is not working as planned?
May 13, 2016 at 1:49 pm #103970AnonymousInactiveMaurice Petterlin wrote:When you look at it like that then I would question the limits placed on the orders.Seems like something is not working as planned?
as i said there was a strategy change on the 05/05 so results may be slightly skewed. the previous strategy was placing more buy orders. however, i think it is not unusual to place a high amount of trades that do not get filled with this type of system.
May 13, 2016 at 4:01 pm #103971SaidBitarMemberI never kept track of the number of placed orders and how many out of them are filled, but to have smaller percentage getting filled is normal.
It depends on
[ol]
[li]Market conditions if the market is going up most likely all the stocks will move up and very few will go down to hit the limit order. while if the market is up and down or down be sure you will get high number of fills.[/li]
[li]if the stretch is far then may be this is a reason[/li]
[/ol]you have your backtest and it can give you estimate figure on the percentage of orders that will be filled.
this month i got filled on 48 orders and i am sure there on average i had more than 550 orders, for me this ok and the number is quite OK, keep in mind that the US market had many days down
-
AuthorPosts
- You must be logged in to reply to this topic.