Click here to Login





                                                   3 suggestions

  0

0
Peter Gum
2011-03-24 13:43:38


I have three things in mind:
1. Under Report for trading system > Trades it would be convenient if column selection were sticky. I configure out Scale In and Scale Out but they keep reappearing.
2. In the same place I would like a new column: running profit/loss (the total, or aggregate or net as of each closed trade).
3. I am using a dynamic watchlist. However, only the latest passing stocks are used in the simulation. That is, it is treated as static for the simulation. Instead, I would like for the watchlist to be regenerated on each bar.
Thus, during the simulation the pool of passing stocks would be as of each date, not just the last date. As it stands, the simulation shows trades for stocks that were not in the watchlist on the date of the trade.
Thanks.
~Pete



QuantShare
2011-03-24 14:57:13



1, 2- Thank you for the suggestion. We will implement these in the next release.
3- You should specify the watchlist rule in the simulator.

Example:
In your watchlist:
filter = rsi(14) > 70;

In the simulator:
buy = your rules and rsi(14) > 70;



Peter Gum
2011-03-24 15:38:38



The problem is I don't know what is in the (dynamic) watchlist a month ago. It's dynamic; it's different each day. Depending on market conditions the turnover can be many (~20).
Moreover, there are now a dozen or more rules that I would rather not have to replicate in the strategy (and I don't know how the 'row' criteria woiuld be replicated?). It would be far more convenient to have the watchlist re-run during the running of the strategy.
I do understand that that might get complicated. A position could be opened on day n that is not in the watchlist on day n+1. But the symbol is in the database on both days.

It is a very powerful concept to be able to run a strategy against a variable watchlist that relfects changing market conditions as a simulation runs. (As you can tell, this is definitely on my wishlist. What do you think?)

Thanks.
~Pete



QuantShare
2011-03-25 11:49:11



Wathlists and simulations are analyzed the same way. In a watchlist, only the last bar is analyzed while in simulations, all bars are analyzed.
They both use the same language and rules syntax.

You just need to copy the watchlist rules and paste them in the simulator. It takes few seconds.

Ifyour watchlist looks for stocks whose RSI is above 70, then adding this rule in the simulator will allow you to backtest only stocks whose RSI is above 70.



Peter Gum
2011-03-25 15:54:11



Let me outline my situation in a bit more detail. For the dynamic watchlist:
- On the first panel 6 conditions have been established using the graphical GUI. That includes designating two other static watchlists, one to exclude symbols and one to include. While I am sure it is technically feasible, at this point I have no idea how these 6 conditions would be copied into a strategy script.
- In the script panel I have 16 lines. 5 of those lines set up columns to be viewed. In the simplest case none of the 16 lines would have to be 'edited' before copying to a strategy? Otherwise there would have to be two slightly different versions of the screening logic.

Both panels undergo regular 'tinkering', which would reguire synchronization with a copy in a strategy. While it may be possible technically to replicate the logic behind a watchlist in a strategy clearly to do so is inconvenient, inefficient and redundant. It may be just bookeeping, but it surely would be less messy to have QS provide some additional support for the case.

If copying would work, then including in a strategy a 'Call' instead to run the existing dynamic watchlist script would seem to yield equivalent results? Indeed, one might even consider issuing the 'call' at a different frequency, say every 5th bar or something.

I'm trying to make two points: a) the ability to run a strategy over a dynamic watchlist is a powerful QS capability; b) making it convenient to roll the contents of the watchlist in concert with running a strategy would substantially enhance the usefulness of the feature. The strategy and the watchlist would then be synchronized to the same (pertinent) time frame. That's a strategy very 'tuned' to current circumstances -- imparts credibility in the results of a simulation; -- imparts confidence in what might happen running live.

(I don't mean to under estimate possible technical complications, especially perhaps in live trading? What bounds the universe of stocks for which live quotes are required, for example? I hope such considerations are not grounds for not doing what this message contemplates.)

How am I doing? Am I making the case? Where is the weak point(s) in my reasoning?

~Pete



QuantShare
2011-03-26 05:38:07



- The Symbols Selection control is the used by many plug-ins including the simulator. (Symbols & Dates button)
You can save these conditions by clicking on "Save" (at the bottom) and load them by clicking on "Load".

- Yes, none of 16 lines would have to be 'edited'.
Simply copy the formula and paste it in the simulator editor (Create trading system using the formula editor tab) then add one single line:
buy = filter;

Even though the simulator and watchlist have several controls in common, they are separate plug-ins and aimed at different purposes.
You can follow the above instructions to backtest a watchlist.

What we can do to speed things up is to create a button in the watchlist that automatically creates a trading system based on the dynamic watchlist settings.



Peter Gum
2011-03-26 07:13:01



I thank you for considering my suggestion. Let me think over your latest remarks. They leave a merge concern; my current strategy consists of a) 11 lines of script, b) settings and c) 9 lines of money management. Whlie your button seems like a nice step in a helpful direction there would remain a need for some merging.

(I hope you don't mind my pressing on this. I like the apparent effectiveness of the strategy/watchlist combination I am working on. What is remarkable is that this has been accomplished with very few lines of script, as you have seen above. That is to QuantShare's credit; it does not necessarily take much coding to set up something realistic to consider. Very efficient.)

~Pete



QuantShare
2011-03-26 09:35:30



If you are planning to merge the watchlist and the trading system then the copy button will not help.

In this case, you have to perform the above steps manually.

Please note that symbol conditions are executed once (they represent the symbols that are used in the watchlist or simulation).
So, what you have to do is copy the symbol conditions and then add the watchlist rules in the top of the simulation rule (if there are already rules).

What we can do is change the function "IsInList" so that it is recalculated on each bar.
Example: IsInList(_Watchlist, "watchlist name");

But you have to add this rule in your trading system:
buy = buy and IsInList(_Watchlist, "watchlist name");




Peter Gum
2011-03-26 13:54:39



I need to think about this. I don't think IsInList will help; 'buy' assumes I know the symbol to buy and I don't if the watchlist is not refreshed before that decision is made. (I may misunderstand how IsInList works; it is not covered in the pdf documentation.)

(As would be the case if running live on EOD data, this strategy and watchlist expect a reconstructed watchlist each morning. Several stocks typically pass the buy criteria each day; the key restriction is whether there are available funds for a new purchase. That normally depends on there being a prior sale/cover. The strategy thus spends most of its time replacing recently covered positions, but from a presumably updated watchlist.)

This needs some thinking time. Perhaps I should reconsider an alternative approach, such as starting with a broadly encompassing watchlist and doing more of the per-bar screening in the strategy, as you suggested above.

~Pete



QuantShare
2011-03-26 16:25:05



"Buy" will buy only stocks that pass the criteria. In a watchlist or simulation, usually all symbols are passed and then the filter ("filter" in watchlist and "buy" in simulation) will decide whether to pick the stock or not.

The first paragraph of your last response do not make sense.
Refreshing a watchlist is equivalent (exactly) as adding a new rule in the trading system.



Peter Gum
2011-03-26 18:59:08



Well, it certainly is true that I get confused at times. [grin] But here is my understanding: for each bar a strategy loops over the symbols in a watchlist, applying the strategy script to each symbol in turn?

In my case the symbols in the watchlist change between each (EOD) bar; the same as would happen running live. How could a dynamic watchlist not change each morning based on the previous day's market?

~Pete



QuantShare
2011-03-28 06:44:55



A dynamic watchlist changes every day due to changes in Symbols Selection + Filter rule.

Symbols Selection conditions do not use historical data and therefore even if you include it in a simulation, the same symbols will always be used.
The filter rule uses historical data, but adding this rule in a simulation is exactly the same as what you want to accomplish.

Example:
filter = watchlist rules;
buy = simulation rules and filter;

For each bar and for each symbol, the simulator will accept only stocks that pass the simulation rules AND the watchlist rules.
The simulation loops over all symbols, apply the script to all symbols but gets only stocks that meet the simulation and watchlist rules.

In reality, the simulator loops over symbols first. After that, it loops over each bar of each symbol. Signals are stored in an internal database and then the backtester will pick stocks from signals given ranks and portfolio settings (such as capital...).



Peter Gum
2011-03-28 08:01:05



Thank you very much! That is a lot of enlightening information. I think the crux of the matter lies in the order of operations: looping over symbols and then bars is not equivalent to looping over bars and then symbols for dynamic lists. ("Bars" have two meanings here, point-in-time and HLOCV.) It would be interesting if there is agreement on this point?

~Pete



QuantShare
2011-03-28 09:46:50



Thank you.

Yes it is not equivalent. But the final result is the same.



Peter Gum
2011-03-28 15:22:49



It is probably time to close this thread. I am not explaining myself clearly enough. That's my fault; I need to put together a more detailed demonstration. The key to it is that today's simulation does not show the dispostion of the trades my simulation made last week. It does not have to remember them, but not regenerating them over an unchanging historical record does present implicatons. I'll get back to you when I have that time line documented. Thanks for taking so much time on this.

~Pete



QuantShare
2011-03-29 07:13:01



Why are you backtesting the same simulation every week?


Peter Gum
2011-03-29 08:39:55



It is essential to consider the consequences of a dynamic watchlist. I run the exact same strategy nearly every day with substantially different results day-to-day. Here's why: yesterday morning the watchlist criteria selected 19 stocks. This morning the same criteria selected 16 stocks, 4 of which were not in yesterday's list. That is the consequence of market activity yesterday. The constituents in my watchlist change each day, some days rather dramatically.

Had the strategy made a trade yesterday it would have picked from the group of 19. 7 of those stocks are not in today's list. Had the strategy bought one of those stocks yesterday, today's simulation would not do that. That is because today's simulation will not use the watchlist that was applicable yesterday morning. That is the enhancement I am after.

The enhancement is a closer fit to live trading. Suppose I follow the strategy with manual live trading. If the strategy recommended a purchase yesterday, and I made the same trade in my live account (which in fact I do in some cases, by the way), then this morning the trade is still in my live account. But today's simulation will not acknowledge that and therefore I cannot follow the exit recommendations (there will be none) in the live account.

The dynamic watchlist is a lovely source of tadeable candidates, day by day. Indeed, I work from that 'pool' in my real trading. But I need a backtest algorithm that comprehends a different 'pool' (watchlist) every day (bar).

I recognize there are some technical complications. For example, when regenerating a watchlist each day during a simulation such regeneration would have to be confined to not use bar data after the current simulation point. Also, the CPU load would probably increase substantially. However, the stategic advantage of working with then-current information more than justifies spending the cycles.

~Pete



QuantShare
2011-03-30 06:38:43



You should use the Portfolio tool. (In the menu -> Portfolio -> Portfolio)

You must create a portfolio and then associate a trading strategy to it.
The portfolio will get recommendations (buy, sell signals) from your trading strategy.

Each time you execute it, it will get new stocks from your watchlist and then apply the buy, sell and money management rules of your trading strategy.



Peter Gum
2011-03-30 09:44:30



Thank you! I had not thought to look in that direction. I will look into that.

~Pete



No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Fixed Bucket Calculation
Analyst Rating
Analyst Days Since Last Rating
Analyst Previous Rating
Analyst Rating (Yahoo Historical Buy/Sell Recommendations)

How-to Lessons
How to draw distances on a chart?
How to create a mobile database/account
How to get stocks for a particular index using the global script
How to create and trade a Neural Network model
How to create a custom trading indicator

Related Forum Threads
Minor suggestions
Making available indicators read-only
LSE - UK - EOD data 202 and 102 errorrs for all stocks
Blog Post Ideas
Industry/Sector data

Blog Posts
Trading Optimization
Create a trading strategy using the money management tool - Part ...
How to create custom databases in your trading software
Historical Market Data
How to simulate options strategies









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.