Ryan,
Thank you so much. Again, I'm learning a lot.
However, it doesn't seem to work as I expected. I have another backtesting tool coded in different language, the result looks totally different.
Questions:
1). If I set the moving avg to 180, this means that it is based on the calculation of past 180 minutes, right? (because this is a minute base backtest!)
2). Can I add profit target and stop loss based on #of ticks?
Some problems:
1). It does NOT seem to close all the open positions at the end of day.
I added the following to see the log info for it as below.
Exit position at end of day
if endofday_check(context) == True:
order_target_percent(context.stock, 0)
log.info('Exit, end of day' + str(endofday_check(context)))
else:
pass
But I can't see any logs showing that closed at the end of day.
2). Also, please see below. This is the logs after I tested with FAS :
2008-11-12handle_data:53INFOSE#1, 5L, [ 109.776], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 109.442], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 109.442], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 109.137], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 108.414], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 108.109], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 107.998], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 107.637], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 107.637], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 106.926], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 106.609], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 105.915], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 105.415], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 105.387], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 104.665], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 104.165], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 103.478], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 103.192], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 102.359], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 102.276], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 102.276], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 101.831], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 100.498], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 99.998], -1000000.0
2008-11-12handle_data:53INFOSE#1, 5L, [ 97.22], -1000000.0
(SE: Short Entry, 5L: 5-day Low.)
As you can see above, on 11/12/2008, total #25 short entry signals were generated based on 5-day low with min_notional. (Do we have unlimited cash??)
This doesn't seem to be right. Isn't it supposed to be just 1 entry with max/min_notional?
Please check this.
To make sure that this strategy goes to the right direction as I tested on other platform, I want to change this strategy simpler:
1). Entries are based on only 5-day high and 5-day low with max/min_notional.
2).I want to add profit target and stop loss based on the #of ticks. Is this possible here? Can you help me?
For example, my profit target is 500 ticks up from my cost basis. And stop loss is 300 ticks down from my cost basis.
So the Sell and BuyToCover orders should be Limit Order.
3). Close at the end of day (15:55 EST): please double check this...
I really appreciate it in advance if you check all of these and correct all the bugs and errors if any.
I'm learning a lot from you and all the memebrs of this forum.
Thank you again.
.