John62
Junior Member

Posts: 23
Registered: 29-9-2017
Member Is Offline
Mood: No Mood
|
|
Adding some fundamental data: Commitments of Traders Report
I did a test by adding an extra secondary filter on the GSB NG_DEMO model. I used the momentum of the Net Commercials.
Some background on COT https://www.ireallytrade.com/cotreport.html
The COT data is available from Tradestation:
Results
Percent Profitable from 70.32 to 79.12
Profit factor from 3.64 to 7.72
Average Trade from 369.54 to 558.02
Nr of trades is down to 91 and Net Profit to 50.780. Further research is necessary, but I think it has potential as a filter.
Add this Tradestation Code to your model at the correct positions and add an extra daily datastream:
Inputs: CommMomDays(35);
Vars: //cot
string FieldNamePrefix( "" ),
string CommLongFieldNme( "" ),
string CommShortFieldNme( "" ),
double CommLong( 0 ),
double oCommLongErr( 0 ),
double CommShort( 0 ),
double oCommShortErr( 0 ),
double CommNet( 0 ),
double COTMom ( 0 );
// Get COT data
if Category > 0 then
Raiseruntimeerror(!( "Commitments of Traders studies can be applied only to futures symbols." ) );
FieldNamePrefix = "COTF-";
CommLongFieldNme = FieldNamePrefix + "12";
CommShortFieldNme = FieldNamePrefix + "13";
CommLong = FundValue( CommLongFieldNme, 0, oCommLongErr ) of data(3); // !!! Use daily data here
CommShort = FundValue( CommShortFieldNme, 0, oCommShortErr)of data(3);
if oCommLongErr = fdrOk and oCommShortErr = fdrOk then
Begin
CommNet = CommLong - CommShort;
COTMom=Momentum(CommNet,CommMomDays);
End
Else
Begin
Raiseruntimeerror( !( "Error in Commitments of Traders studies: ") );
End;
// Buy/Sell
If decision = 1 And sfDecision = 1 and COTMom < 0 Then
Begin
Buy("Long entry") 1 contracts this bar on close;
End
Else If decision = -1 And sfDecision = -1 and COTMom > 0 Then
Begin
SellShort("Short entry") 1 contracts this bar on close;
End;
|
|
|
John62
Junior Member

Posts: 23
Registered: 29-9-2017
Member Is Offline
Mood: No Mood
|
|
I also did some testing by adding Net Commercials as an extra data input to GSB. Several of the best systems used the COT datastream. You can get the
data from the Tradestation indicator and format it in Excel to the correct format. The sample dataset for NG is attached for your own testing.
Attachment: Login to view the details
|
|
|
rws
Member
 
Posts: 114
Registered: 12-6-2017
Member Is Offline
Mood: No Mood
|
|
Very good !
|
|
|
admin
Super Administrator
       
Posts: 5069
Registered: 7-4-2017
Member Is Offline
Mood: No Mood
|
|
Whats the symbol for COT. Has anyone tried this on ES market., IE GSBsys1ES or NQ?
|
|
|
John62
Junior Member

Posts: 23
Registered: 29-9-2017
Member Is Offline
Mood: No Mood
|
|
It is not a separate symbol, it is additional information for each future symbol. You can access it with the Fundvalue function in TradeStation. See
the sample above. I think COT works best for markets with fysical delivery, and not stock indexes. But i did not try yet.
|
|
|
admin
Super Administrator
       
Posts: 5069
Registered: 7-4-2017
Member Is Offline
Mood: No Mood
|
|
Quote: Originally posted by John62  | | It is not a separate symbol, it is additional information for each future symbol. You can access it with the Fundvalue function in TradeStation. See
the sample above. I think COT works best for markets with fysical delivery, and not stock indexes. But i did not try yet. |
Thanks for that tip.
Please keep me informed on this.
|
|
|
John62
Junior Member

Posts: 23
Registered: 29-9-2017
Member Is Offline
Mood: No Mood
|
|
I did a test with GSBsys1ES. I used the COT data of the @SP contract. Because COT needs daily data and GSB 500 bars lookback. I took only trades from
1/1/2006 tot compare the same trading period.
Percent profitable and Average Trade little better, but the profit factor from 2.98 to 3.92!

|
|
|
John62
Junior Member

Posts: 23
Registered: 29-9-2017
Member Is Offline
Mood: No Mood
|
|
For your own testing. A complete ES dataset with a COT file for GSB.
Attachment: Login to view the details
|
|
|
admin
Super Administrator
       
Posts: 5069
Registered: 7-4-2017
Member Is Offline
Mood: No Mood
|
|
Interesting. It improved long but not short.
I did testing on go long if {all the usual} and close >close[1]
with the inverse for short.
It worked for one GSB system on es, but later when I tried it, worse on another.
What you have done is good, but requires more testing to validate.
I have been thinking about the addition secondary filters that are over due to be implemented. We really want to find SF that are true for all systems
on the market, not just the one that appears to test better.
|
|
|
Carl
Member
 
Posts: 343
Registered: 10-5-2017
Member Is Offline
Mood: No Mood
|
|
Hi John62,
Just tried your COT on RB.
Do we need a daily bar for COT? Or just one bar per session?
So ie session is 0900-1430, use a 330 min bar for COT?
Thanks
|
|
|
rws
Member
 
Posts: 114
Registered: 12-6-2017
Member Is Offline
Mood: No Mood
|
|
This rule can have erratic results,
close >close[1]
In general it is believed that a relation between 3 bars can
have some good results. But you often need a bit more.
Here are some test examples in Amibroker, there are better
examples from the Amibroker closed forum but that is not for republishing available.
https://www.wisestocktrader.com/indicators/1139-candlestick-...
this one can enhanced so that it can find the candle stick patterns with the highest profit either over a ticker in seconds till minuts or a portfolio
of thousands of tickers in a couple of hours.
Even better is if you could generate any combination of OHLC between the last 3 bars and combine that with indicators.
I sent you some opensource code that I do not want to post here.
Quote: Originally posted by Carl  | Hi John62,
Just tried your COT on RB.
Do we need a daily bar for COT? Or just one bar per session?
So ie session is 0900-1430, use a 330 min bar for COT?
Thanks |
|
|
|
admin
Super Administrator
       
Posts: 5069
Registered: 7-4-2017
Member Is Offline
Mood: No Mood
|
|
I did a little more testing on ES30 min systems and found close>close[1] to be erratic, so I dont think it was a good idea. We need to test these
concepts on multiple systems to see if they are generally true.
|
|
|
rws
Member
 
Posts: 114
Registered: 12-6-2017
Member Is Offline
Mood: No Mood
|
|
Here are some more examples
http://www.usingeasylanguage.com/free-tradestation-code/patt...
The best patterns could be found with software that specializes in patterns and the best patterns could be in the example above so a custom indicator
could test them.
|
|
|
rws
Member
 
Posts: 114
Registered: 12-6-2017
Member Is Offline
Mood: No Mood
|
|
That example is if you want to find a pattern in tradestation or in a custom indicator but if you already know the best patterns you could describe
all the OHLC comparisons of the last few bars and give them a number and have another parameter activate the predefined pattern.
|
|
|
cyrus68
Member
 
Posts: 171
Registered: 5-6-2017
Member Is Offline
Mood: No Mood
|
|
I'm not sure how pattern recognition can be included in GSB.
One thing to remember is that systems focused entirely on pattern recognition, based on price action, are essentially parameterless and can't be walk
forwarded.
|
|
|
rws
Member
 
Posts: 114
Registered: 12-6-2017
Member Is Offline
Mood: No Mood
|
|
If you have the 10 best patterns in a script, and have assigned a parameter to them then it is still parametric. This is the way how I already do
that in Amibroker.
|
|
|
curt999
Junior Member

Posts: 51
Registered: 24-7-2017
Member Is Offline
Mood: No Mood
|
|
just assign 1 or 0 say for example candlestick patterns it either exists or does not..in the base gsb code result =0 or 1..you would need to output
the custom indicator file in the correct format..
|
|
|
John62
Junior Member

Posts: 23
Registered: 29-9-2017
Member Is Offline
Mood: No Mood
|
|
Quote: Originally posted by Carl  | Hi John62,
Just tried your COT on RB.
Do we need a daily bar for COT? Or just one bar per session?
So ie session is 0900-1430, use a 330 min bar for COT?
Thanks |
For RB you have to take the COT based on RB, the data is in Tradestation. The COT report is weekly, i used the daily data (but 5 days have the same
value). Correct about the min.
|
|
|
cyrus68
Member
 
Posts: 171
Registered: 5-6-2017
Member Is Offline
Mood: No Mood
|
|
In a walk forward you are optimising parameters. Assigning 0 or 1 to patterns does not create a parameter that is optimisable.
|
|
|
rws
Member
 
Posts: 114
Registered: 12-6-2017
Member Is Offline
Mood: No Mood
|
|
I still have to test this in GSB but in Amibroker there is no problem at all to do a walk forward with either predefined patterns or search for
calculated best patterns based on any condition like RAR/MD, % wins etc for the next forward loop. It just will use the best pattern of the previous
period based on WF criteria.
I hope I can do this in GSB because I like to know if combining patterns with indicators will show something. Another thing with patterns is that they
are often more stable than indicators at least if you have a couple of predefined patterns that you already have found to be stable over several
tickers or many stocks of the index you are trying to optimize.
|
|
|
rws
Member
 
Posts: 114
Registered: 12-6-2017
Member Is Offline
Mood: No Mood
|
|
It is not like assigning 0 or 1 to a pattern
P should be the parameter of which specified pattern to use.
The pattern formula should calculates if the current bar results in a 0 or 1 signal.
If p=1 pattern1
if p=2 pattern2
if p=3 pattern3
The pattern will generate a zero or 1 for every bar and I hope GSB could make something out of this. I still have to figure out custom indicators, I
hope it allows to do things like this.
|
|
|