View Full Version : Scan not returning opportunities
jalsero
29th August 2008, 05:26 AM
Hi,
I have the following issue.
I'm doing an RSC against XJO and doing a comparison against MA(C, 8, E) & MA(C, 13, E) (weekly). One of the securities returned is ABB. According to TradeSim, the first time it matched the conditions:
XJO > MA( 8 ) > MA(13)
(Previous) XJO > MA( 8 ) > MA(13)
was 28/7/2003. However, when I go back over this particular security looking on the charts I see that there was an earlier opportunity 17/2/2003.
So, my question really is where should I be looking for the issue, TradeSim, BullCharts or both?
Thanks
Robert
David Samborsky
29th August 2008, 07:25 AM
Check that you have enough data loaded.
Also the date at which you start scanning the data effects the whole sequence of trades.
To inspect the trade data for a particular security add the ShowTrades function to your exploration code.
For example add the following to see all of trades on the Long side for ANZ.
ExtFml("TradeSim.ShowTrades",LONG,"ANZ");
jalsero
29th August 2008, 11:06 PM
Hi David,
Thankyou for the prompt response. Let me respond to each of your questions and concerns.
Enough data is definitely loaded. On the Advanced Tab (in BullCharts), I have modified my searches so that they always include 10,000 bars. On both weekly and daily data, that is about 20 years worth of information!
As for date. Currently I am searching with XJO and it's basically only returning since about 2000. However, when I searched with XAO, I had data from ANZ being returned from 1986. So, date doesn't seem to be an issue.
In order to determine whether or not what I was seeing was correct, I modified my chart so that it included markers to show when the specific condition in my search was in effect. For AAX, according to TradeSim, it found the condition was first met on 02/07/2007. On my chart, the condition was first met on 16/10/2006.
The following is what I used in my chart:
[Target=New Pane]
[Period=Weekly]
Period1 := Input("Mov Avg Period", 8, 1);
Period2 := Input("Mov Avg Period", 13, 1);
ratio1 := C / LoadSymbol("XJO", C);
Short1 := MA(ratio1, Period1, E);
Long1 := MA(ratio1, Period2, E);
TmpL01 := ratio1 > Hist(ratio1, 1);
TmpL02 := Hist(ratio1, 1) > Hist(ratio1, 2);
TmpL03 := Short1 > Hist(Short1, 1);
TmpL04 := Hist(Short1, 1) > Hist(Short1, 2);
TmpL05 := Long1 > Hist(Long1, 1);
TmpL06 := Hist(Long1, 1) > Hist(Long1, 2);
TmpL07 := ratio1 > Short1;
TmpL08 := Short1 > Long1;
TmpL09 := Hist(ratio1, 1) > Hist(Short1, 1);
TmpL10 := Hist(Short1, 1) > Hist(Long1, 1);
TmpL11 := Hist(ratio1, 2) > Hist(Short1, 2);
TmpL12 := Hist(Short1, 2) > Hist(Long1, 2);
InMktL := TmpL01 AND TmpL02 AND TmpL03 AND TmpL04 AND TmpL05 AND TmpL06 AND TmpL07 AND TmpL08 AND TmpL09 AND TmpL10 AND TmpL11 AND TmpL12;
TmpS01 := ratio1 < Hist(ratio1, 1);
TmpS02 := Hist(ratio1, 1) < Hist(ratio1, 2);
TmpS03 := Short1 < Hist(Short1, 1);
TmpS04 := Hist(Short1, 1) < Hist(Short1, 2);
TmpS05 := Long1 < Hist(Long1, 1);
TmpS06 := Hist(Long1, 1) < Hist(Long1, 2);
TmpS07 := ratio1 < Short1;
TmpS08 := Short1 < Long1;
TmpS09 := Hist(ratio1, 1) < Hist(Short1, 1);
TmpS10 := Hist(Short1, 1) < Hist(Long1, 1);
TmpS11 := Hist(ratio1, 2) < Hist(Short1, 2);
TmpS12 := Hist(Short1, 2) < Hist(Long1, 2);
InMktS := TmpS01 AND TmpS02 AND TmpS03 AND TmpS04 AND TmpS05 AND TmpS06 AND TmpS07 AND TmpS08 AND TmpS09 AND TmpS10 AND TmpS11 AND TmpS12;
[Name=XJO; Color=Blue]
ratio1;
[Name=MA Short; Color=Black]
Short1;
[Name=MA Long; Color=Red]
Long1;
[Name=Long; Color=Green; LineStyle=Marker; Marker=Long]
InMktL AND Not(Hist(InMktL, 1));
[Name=Short; Color=Magenta; LineStyle=Marker; Marker=Short]
InMktS AND Not(Hist(InMktS, 1));
Thanks
Robert
jalsero
1st September 2008, 01:12 AM
I did some more troubleshooting over the weekend. I modified my chart so that it included a marker when the condition I was looking for was true. I then went to look at when the markers showed up for ABB. The 1st marker showed up on 3/2/2003.
I then modified my scan so that all it had to look for was when the marker was true.
When I look at the results presented in TradeSim, it shows that the first time the marker was true was 31/10/2005.
Something is not right
Thanks
Robert
jalsero
1st September 2008, 10:21 PM
OK,
I've resolved this issue. The problem exists between the keyboard and chair, not the software!!
Thanks
Robert
David Samborsky
2nd September 2008, 02:51 AM
Also in future it may pay to use the ShowTrades function in your code for debugging purposes ;)
jalsero
3rd September 2008, 05:26 AM
David,
I took your advice by placing ShowTrades in my exploration code. When I did this, it showed 2 trades, which is not correct. It should have showed 4 trades.
Now, here is where things become even more curious.
When I ran the exploration again, this time without ShowTrades, the TradeLog this time only showed 1 trade! Curiouser and curiouser. I then had a look at the Trade Database Manager.
Lo and behold, all 4 trades for the particular security were showing! The trades definitely had ticks next to their index number. The dates were after the date mask.
I'm sure that there is a logical reason this is occurring, however, it beats me what this logic is. Would you be kind to give me some more suggestions. I have exported both the Trade Database and Trade Log
Thanks
Robert
David Samborsky
3rd September 2008, 01:43 PM
When you run a trade database exploration is the ShowTrades function displaying the same trades ?? I'm assuming when you run the trade database exploration a few times you haven't updated your data.
jalsero
3rd September 2008, 10:50 PM
Hi David,
I was a bit puzzled by your last response. You wrote that when I run the trade database exploration a couple of times, I haven't updated the data.
Here's what I do.
1. I go into BullCharts and then run my TradeSim exploration. Please note, that in my BullCharts exploration, I have limited the weekly data from the 1/7/2005 - 1/6/2008.
2. I then come to TradeSim and click on Open Trade Database Button.
3. Since I've got my Session information saved, I click on the Start Simulation button
4. Once the simulation has completed, I go to the Trade Log, click on the Symbol column and sort the trades by Symbol in alphabetical order.
The only reason I am concentrating on ABB is that its first in my list, it should return 4 trades, however, the Trade Log shows only 1 trade was taken. I have put markers to show me the exact points when the trades should have been taken.
As I wrote previously, when I put ShowTrades in my exploration, it shows the 2 last trades in the Trade Log and in the graph produced. When I remove ShowTrades from my exploration code, it only shows the last trade in the Trade Log.
Would it help if I exported my Trade Database and Trade Log showing you the results with and without ShowTrades?
I've also had a look at the next result, which is ABC. It appears to have missed taking a trade. I'll put ShowTrades in my code for ABC and see what the result returns.
What I don't understand is why the Trades in the Trade Log don't match the Trades in the Trade Database Manager, particularly when I have filtered dates specified in my exploration code.
As to showing the same Trades, yes, it always shows the last 2 trades
Thanks
Robert
jalsero
3rd September 2008, 11:05 PM
OK,
I created a brand new scan which contained the ShowTrades code. This time, when I had a look at the graph, it showed all 4 trades hooray.
However, when I click on the Start Simulation button and had a look at the results, it still only returned the last trade in the Trade Log.
What's happening?
Thanks
Robert
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.