Click here to Login





                                                   Entry Signal Rejection Criteria

  0

0
Dave Walton
2014-11-14 11:16:25


Hi Azouz,

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?



QuantShare
2014-11-15 03:47:34

  0

* 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.

Which "ranking AMM script" are you referring to?



Dave Walton
2014-11-15 09:39:44

  0

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):

System.Text.StringBuilder builder = new System.Text.StringBuilder("");
MMEntrySignals buy = Data.GetBuySignals();
for(int i=0;i<buy.Count;i++)
{
builder.AppendLine(buy.GetSymbol(i) + ": " + buy.GetDetail(i, "rank"));
}
Divers.Output(builder.ToString());


I'm also verifying this by running the same system implemented in both AMM and also in QS script. I get different results because of the above.



QuantShare
2014-11-17 01:20:40

  0

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.



Dave Walton
2014-11-17 09:03:30

  0

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.



Alexander Horn
2014-11-22 12:07:17

  0

Hi Dave,

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.




Dave Walton
2014-11-22 14:51:53

  0

Hi Alex,

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.



QuantShare
2014-11-24 01:51:57

  0

I understand you are using "GetSeries" in QS to get an external symbol but how are you doing that in AMM?


Alexander Horn
2014-11-24 02:09:58

  0

Hi QS,

not sure if this question was for me. Through parser also, may be I was not clear.

example:
MMParser parser= Data.ParseFormula("a = getseries('" + UsedSymbols[i] + "', close, LastData);");
TimeSeries ts = parser.GetTimeSeries(UsedSymbols[0], "a");

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)

Alex



QuantShare
2014-11-25 01:12:18

  0

Hi Alex,

If I understand, you are not getting same results when applying these:

QS language: (Analyzing AAPL)
a = getseries("GOOG", close);

C#
MMParser parser= Data.ParseFormula("a = getseries('GOOG', close);");
TimeSeries ts = parser.GetTimeSeries("AAPL", "a");


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.



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
+ve signals for short entry
Entry Trailing Stop
Drawdown Since Trading Signal
Entry for long (Multibagar)
Buy signal watchlist And Buy signal on your Chart (Red Spot)

How-to Lessons
How to add custom position-based metrics to your trading system
How to quickly select stocks based on the last value of a databas...
How to set order type of a trading system programmatically
How to quickly add several positions to your portfolio
How to dynamically change the number of positions in a portfolio?

Related Forum Threads
MM Staggered Entry and Exit
Prediction Model - Entry Rule
bars since entry in QS language?
Signal bar question
External trade signal

Blog Posts
The Ultimate Guide to Create Trading Systems in QuantShare
Trend following systems
Diversify your portfolio by investing in stocks from various indu...
How to get buy and sell orders for a portfolio based on a trading...
Backtesting All Candlestick Patterns in 10 Minutes









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.