as I develop systems in AMM script, one of the steps I take is a cross-comparison to the same system written in QS script. There are some things I cannot explain about certain entry signals getting skipped.
Here is what I've found makes a difference:
* Minimum share price filters entry signals when the price is below $2. However, it seems that a lower ranked valid entry signal is not evaluated in this case.
* Using a function that references another symbol requires a long enough look back in the entry signal symbol. For example, if I want to trade GLD close to its first trading day in 2004, yet I want to filter entries based on SPy being above the 200 bar SMA, I get no valid entries for GLD until there are more than 200 bars of history in GLD
* In using the ranking AMM script, not all symbols show up with a rank. This is the one that I cannot figure out. It manifests as not all position slots being filled when I think they should.
Could you shed some light on all filtering criteria the simulator uses for entry signals?
* Minimum share price filters entry signals when the price is below $2. However, it seems that a lower ranked valid entry signal is not evaluated in this case.
Update Trading System -> Settings -> Capital -> Allow penny stocks
* Using a function that references another symbol requires a long enough look back in the entry signal symbol. For example, if I want to trade GLD close to its first trading day in 2004, yet I want to filter entries based on SPy being above the 200 bar SMA, I get no valid entries for GLD until there are more than 200 bars of history in GLD
SMA 200 will return non numeric values until 200 bars are available. Check that in a chart.
* In using the ranking AMM script, not all symbols show up with a rank. This is the one that I cannot figure out. It manifests as not all position slots being filled when I think they should.
What I mean is that if I DON"T want to include penny stocks. I'm using a list of 200 stocks. i want to take entries for up to 10 of them but no penny stocks. So I can either uncheck the "allow penny stocks" setting to put my own price filter in the entry rule. I already know that. However, if there are say 50 valid entry signals on a bar and some of the higher ranked signals are penny stocks, the lower ranked (yet still valid) entry signals that are NOT penny stocks do not get entered. This is what I want to understand.
On the SMA, I don't think I made myself clear. I am globally filtering on the 200 bar SMA of SPY (which goes back to 1993). However the simulator seems to need 200 bars in GLD to enter (not an entry criterion). 200 bar SMA for PSY has nothing to do with GLD.
I'm verifying the above using the code below in AMM (I can't remember the object to download):
1/ Not sure what formula you are using but you can use this as a ranking system:
SetSimLongRank(....);
This will allow you to get the lower ranked signals (in case all of the top are penny stocks)
2/ This has nothing to do with QS language vs MM Script. Just plot for example (getseries("SPY", close)) on a GLD chart, the first bars are missing because currently if GLD has 1000 bars then it loads 1000 bars of SPY and if SPY happen to have more bars for the same period of time then this will look like first bars are missing.
For #2, I think we are talking past each other. If I include a filter rule that requires SPY to be above its 200 bar SMA, I do not expect that I need 200 bars of valid GLD price data for that rule to be true. Yet that is the behavior I'm seeing.
I'll send you the system so you can see what I'm talking about. It is a simple ETF rotational system that enters the top 2 of 10 ETFs ranked by the ROC indicator. What I see is that GLD is not even ranked from the start until there is much more price history than is needed. I'm only assuming it is because of the filter rule I mention above.
got you, ran into the same in the past... behavior of QS when querying data is good for different purposes, but sometimes not intuitive.. maybe Azouz can expand, but this is what I've found so far:
1) In Qs language, Chart and functions QS "aligns" timeseries to the "current symbol", e.g. when you pull getseries("gld") into a spy chart or function, your gold series will only contain the bars that exist in "main" spy series....this is what you are seeing.. some gld bars are missing in the filter. You can use the "raw" call in functions, but then also dates are not aligned.
2) In AMM it seems to be opposite, the code runs through all timeseries individually, e.g. you get each bar for each symbol... Actually here the trick is how to allign the series if you need to eliminate empty days from "matrix" for example to run covariance or similar..
For me this is one of the areas which would need some more explanation... takes sometimes a lot of debugging effort to understand.. but again, makes sense at the end.
Maybe we can expand this thread, think it is very relevant.
yes we are talking about the same issue. Your description of QS vs. AMM is what I discovered through trial and error also. Ultimately I am looking for a better understanding of the behavior of the simulator.
I'm sure the best way to go about expanding the thread other than asking more questions.
Then using the "trick" you showed me, e.g. using same symbol in parser "GetTimeSeries(..)" to fetch full timeseries or using different symbol to align timeseries with that one, like in above example.
Sometimes also reading quote db directly, but this only in rare cases.
Maybe it would be good if you could elaborate on how data alignment and bar logic works in QS language / AMM and functions. Works good and makes sense, but needs tome time or explanation to understand. (for me at least)
Note that the symbol used to align time-series must be the same.
The alignment is simple. We take the main symbol (the analyzed one) and we check one bar N at a time. All bars of the other symbol that occurred during the open date of bar N and the open date of bar N+1 are assembled and merged to create a single bar. It is not easy to explain it with just words, maybe we will write a blog post about this.
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.