The Grail Forum

General Category => Documentation and FAQ's => Topic started by: Wouter on August 20, 2009, 03:38:57 pm



Title: Computer Assisted Strategy Builder (CASB) - FAQ's
Post by: Wouter on August 20, 2009, 03:38:57 pm
Frequently Asked Questions

Copyright 2004-2010 Technovest (Pty) Ltd

1. Can I add my own indicators to CASB?
2. Can I use an indicator with range -1 to +1 with the CASB/Neural hybrid?
3. How do I use multi data streams in CASB?
4. Can a saved template in CASB be deleted or copied over?
5. Can I use any MyVar variable when adding an Additional filter?
6. Why did CASB not export any of the non standard indicators when I used 'Export CASB strategy'?
7. What regional settings should be used with CASB?
8. I am using CASB to model new strategies, but the GGO optimization report keeps on being empty?
9. When a strategy is exported from CASB for GGO/GWFO testing, how can one decipher the logic of the entry signals?
10. Does CASB D&P functionality support creation of an adaptive trading system?

11. How do I create a TS verified function for an indicator I want to use?
12. Can I use my own exit code along side of the presets for exits?
13. How can I import a CASB Template made on a separate machine?
14. Do I need all the data streams on the final chart if I have used multiple data streams?
15. What is an appropriate Maximum bars per trade setting?
16. Can I do timeframe optimization for my existing system which is coded in EasyLanguage(TM)?
17. Is Intrabar entry order types allowed with multi time frame optimization?
18. How would one use the DMI as a Boolean Filter in CASB?
19. Does it make sense to use random numbers seeds other than 1-10?
20. How do I use CASB to "enforce" and exit?

21. Do the Moving Averages apply to MultiData? Does the 5 data stream limit also apply to MA's?
22. How does "File, Export CASB Parameters" work?
23. If a filter is defined refering to Data2, can I leave the Data to "Do not optimize streams",
if no MultiData indicators are selected?
24. When is a D&P report rewritten?
25. Is there a recommended methodology that will aide in reducing fitting when running a CASB Template or a GGO run?
26. Can one use indicators with Price inputs such as "(H+L)/2"?
27. How does the Oscillator turning point (5th) entry type works?
28. Why are the Moving average crossovers never used on the price series, but only on other indicators?
29. Why do I get Entry/Exit on the same bar after profit targets are hit?
30. Why do recursive functions sometimes give problems with EasyLanguage(TM)?

31. Where can I find additional indicators to be used with CASB?
32. Can I reboot my computer while running CASB?
33. Should look inside bar back testing resolution be turned on, when using CASB?
34. When using the "File, Export CASB Strategy" option, I get a "not valid integer value" error?
35. How can I speed up my CASB optimization?


1. Can I add my own indicators to CASB?
CASB is extremely flexable and it is very easy to add your own indicators.
You can basically use any indicator as long as that indicator has been imported into your TradeStation and has been verified.
Use the 'Add an indicator' button in the Oscillators/Channel breakouts section on CASB3 to add a new indicator.
Note that you might need to first specify a new bandclass on CASB2 (or simply use an existing band class) so that CASB can know between which values the buy/sell trigger bands will vary.

2. Can I use an indicator with range -1 to +1 with the CASB/Neural hybrid?
My indicator has an output of +1 and -1 only, UpTrend Mode=+1 and Down TrendMode = -1.
How can this be used with the Neural hybrid and classified as +3 to -3 range for Neural Hybrid purposes?
Such an indicator can easily be implemented in CASB:
First you need to specify a new bandclass so that CASB can know between which values your oscillator will be oscillating.
On CASB2, press the 'Add a BandClass' button.
Type in a description e.g. 'Oscillator between -1 and +1'
Since your oscillator has a fixed range, you will next select
'Trigger band is a fixed line' as band type.

Next you must define the trigger band ranges.
If you have an oscillator that oscillates between -1 and +1 then typically
you would like to Sell when overbought i.e. in the region of +1,
and Buy when oversold i.e. in the region of -1
Thus, you will specify the UpperBand range as 0 to 1
and the LowerBand range as -1 to 0
Next press OK to save your new band class definition.

Now you only need to add your oscillator to the list of indicators:
On CASB3, press the 'Add an Indicator' button in the Oscillators / Channel breakout section.
Then type in a description and the EasyLanguage definition e.g. MyOscillator(Price,Length)
and select as BandClass, the new bandclass you have just defined yourself: 'Oscillator between -1 and +1'

3. How do I use multi data streams in CASB?
In CASB a user can select various indicators in the Oscillator / Channel breakout section on CASB3.
These indicators then serve as the underlying data series to be used.
If you have specified a basic formula e.g. RSI(Price,Length) then CASB by default assumes to use the
Close prices of Data stream #1.
CASB allows the usage of multiple data streams as follow:

On CASB3 there is a Data dropdownbox. It has the following options:
1. Do not optimize streams
2. Optimize 2 data streams
3. Optimize 3 data streams
4. Optimize 4 data streams
5. Optimize 5 data streams

If you leave this selector on 'Do not optimize streams' CASB will only apply the indicators on the default Data stream.
Thus the usage of multiple data streams must explicitly be specified by adding another indicator, e.g.
RSI(Price of data2,Length) and then CASB will know that it must calculate that specific RSI using data stream #2.

Should you specify any of the options 2-5, e.g. Optimize 3 streams, CASB will automatically optimize
the first 5 indicators (as selected in the Oscillator / Channel breakout section) on 3 data streams.
This would require you to make sure that your have inserted 3 data streams onto your chart, e.g.
@ER2.D 20 min, @ER2.D 40 min and @ER2.D 60min.
It is very important to remember that you should always specify the data streams with the shortest bar interval first,
otherwise it can lead to exponential waiting times.
Thus in our example Data1 would be 20min, Data2 would be 40min and Data3 would be 60 min bars.
CASB will then automatically test all permutations of the 5 multidata indicators on any of the data streams.

Note that this approach only allows the specific data streams on the chart to be optimized. Thus, if you have
3 data streams e.g. 10,20 and 30 minutes, then CASB will only be able to optimize those 3 intervals and
will not be able to do optimization on other increments e.g. 15 minutes that are not on the chart.
Doing a simultaneous time frame optimization on a wide range of bar intervals (to be calculated during execution) would just be too computing intensive
given the current TS architecture and would lead to unrealistic waiting times. (Note that this feature should be possible with USO)

4. Can a saved template in CASB be deleted or copied over?
The active template is automatically saved when the 'Generate code' button is pressed. Thus if you have made changes to the current template, it will overwrite the previous copy. If you want the current changes to be saved as a new unique template, just select a different active template number on CASB3 and press the Save As button.
We strongly recommend NOT to use Template1 for D&P purposes, because Template1
will we overwritten to the default values every time you upgrade.

5. Can I use any MyVar variable when adding an Additional filter?
When adding an Additional Filter in CASB2 when it has only 1 Variable.
Must one start with MyVar1 or can 1,2,3 be left 0's and use only MyVar4 for the new Filter?
You can use any one of MyVar1-4. Thus if you only want to use MyVar4 that's also OK!

6. Why did CASB not export any of the non standard indicators when I used 'Export CASB strategy'?
Make sure that you have imported all necessary functions into your TradeStation, if you have used any non standard or proprietary functions. (There is no way that CASB can know what functions are standard TS functions and which ones are proprietary).
CASB is not exporting ELS/ELD files but is only exporting a text file.
If you havenot imported all your non standard indicators, then that text might not Verify in TradeStation.

7. What regional settings should be used with CASB?

Not only for CASB, but also for GGO/GWFO, the regional settings should preferably be English/USA.

8. I am using CASB to model new strategies, but the GGO optimization report keeps on being empty?
This can happen if
1) On CASB4 you have selected Required trading frequency, accuracy and drawdown (FAD) settings that were too strict, thus filtering out all systems being modeled by CASB, OR
2) On CASB3 in the Entry types box, you have selected Buy/Sell filters that were too strict, again resulting in systems that could not adhere to the FAD settings as per 1) above

9. When a strategy is exported from CASB for GGO/GWFO testing, how can one decipher the logic of the entry signals?
About 3/4 through the strategy you will find statements that typically looks as follow (only an extract):
If EntryType=2 then begin
LongEntry = (MavST crosses above LowerBand);
If LongEntry then begin
If OrderType=1 then Buy this bar at close;
These statements define the actual entry signals.
EntryType=1 handles with moving average crossovers
EntryType=2 handles with oscillators
EntryType=3 handles with channel breakouts
OrderType=1 is to trade at the close of the current bar
OrderType=2 is to trade at the open of the next bar
OrderType=3 is for intrabar entry orders
For moving average crossovers, MavST and MavLT is the short and long term
moving averages calculated on top of the underlying indicator
For Oscillators and channel breakouts, MavST is the short term
average of the underlying indicator.
The underlying indicator is calculated higher up in the section:
{* Define Indicators used for entries *}
IndType[Count] is the variable determining the
indicator e.g. IndType[Count]=1 would select the first indicator,
IndType[Count]=2 would select the second indicator etc.

10. Does CASB D&P functionality support creation of an adaptive trading system?
Although a genetic algortihm is highly adaptive by design, the standard CASB is not adaptive in the sense that you would like it to be. Note that CASB can be modified to do exactly what you want, but that is something that must rather be done on your own by modifying the code of the CASB template manually.


11. How do I create a TS verified function for an indicator I want to use?
When using say, "MyTSI" ,do I actually create a new Function for it in TS or can I simply type "MyTSI" in CASB when I go to add it?
You need to create a new MyTSI function in TradeStation:
Use File, Open EasyLanguage document to open the TSI function.
Now select File, Save EasyLanguage Document As, and save the original TSI function as
MyTSI.
Now edit the EL code of the MyTSI function and replace all XAverage functions with Average.
Finally select Tools, Verify to verify your new MyTSI function.
Now you can simply use MyTSI in CASB using the definition MyTSI(Price, Length, 13,1)

12. Can I use my own exit code along side of the presets for exits?
Yes, you can use your own exit code. But since the CASB front-end does not cater for adding your own exits, you will have do it manually.
Just identify an exit that you do not want to use, and then replace that exit with your own code.
For instance, if you do not want to use a trailing stop, you can tick the Trailing stop exit on CASB3, but then in the template, just delete the CASB code within the if statement of the Trailing stop exit and replace it with your own code:
If Scale1Type=5 or Scale2Type=5 or Scale3Type=5 then begin
If Scale1Type=5 then ScalePar2=Scale1Par2;
If Scale2Type=5 then ScalePar2=Scale2Par2;
If Scale3Type=5 then ScalePar2=Scale3Par2; { ScalePar2 ranges between 1-10 }

If Scale1Type=5 then ScalePar1=Scale1Par1;
If Scale2Type=5 then ScalePar1=Scale2Par1;
If Scale3Type=5 then ScalePar1=Scale3Par1; { ScalePar1 ranges between 1-10 }

{ Insert the logic for your own exit strategy here, using ScalePar1 and ScalePar2 as parameters }

end;

13. How can I import a CASB Template made on a separate machine?
You should be able to use templates on any other machine by simply transferring the file
CASBTemplateX.def, which is located in C:\Program files\TheGrailGGO folder.

14. Do I need all the data streams on the final chart if I have used multiple data streams?
The resulting systems most likely will not use all of these when generating the final system.
It is important to keep the exact 5 data streams on the chart because even if CASB is only using one data stream it might be Data4 and thus you cannot delete the other data streams from the chart.

15. What is an appropriate Maximum bars per trade setting?
I would recommend users to increase their Maximum bars per trade setting on CASB4, now that we have introduced multi time frame optimization.
Thus I would recommend users to increase their Maximum bars per trade to at least 200, and in some cases an even larger setting might be appropriate.

16. Can I do timeframe optimization for my existing system which is coded in EasyLanguage(TM)?
The multi time frame optimization is provided as part of the CASB template and involves very specific code.
Thus one can only use the multi time frame feature during a CASB D&P.

17. Is Intrabar entry order types allowed with multi time frame optimization?
No, EasyLanguage does not allow intrabar entry order types when optimizing multiple data streams.
If you do that, the EL interpreter will produce the following message when trying to verify your CASB template:
"Cannot mix next bar prices with data streams other than Data1"

18. How would one use the DMI as a Boolean Filter in CASB?
Description: DMI
EL code: (DMIPlus(Length) - DMIMinus(Length))
BandClass: Zero line trigger
Thus when DMIPlus crosses above DMIMinus, you will get a buy signal
and when DMIPlus crosses below DMIMinus, you will get a sell signal.

19. Does it make sense to use random numbers seeds other than 1-10?
I.e. if I run the same CASB search the next day, will it return the same results if I don't change the seed?
We are simply varying the GASeed to define different random starting points for the GA. Even though the GASeed is not random, the resulting starting points are random, and thus we can simply use 1-10 as seed.

20. How do I use CASB to "enforce" and exit?
CASB allows the following exit strategies to be enforced with specific values:
End-of-day exit, stoploss, profit target, breakeven stop, trailing stop.

To enforce an exit, simply goto CASB3, check the 'Enforce exit' tickbox and select the exit to be enforced as well as the dollar value to be used (if applicable).

CASB by default optimizes a total of three different exits per strategy.
By enforcing a specific exit, CASB will still continue to test all the exits as selected in the 'Exits' box on CASB3 as a possible 2nd or 3rd exit rule.


21. Do the Moving Averages apply to MultiData? Does the 5 data stream limit also apply to MA's?
The moving averages are applied on top of the indicators as selected in the 'Oscillators/Channel breakouts' section on CASB3.
Thus if the underlying indicator is using Multidata, then the MA will also be multidata.

With regard to the question:
"If under CASB 3 Entry types, only one entry type is selected (Ex. Oscillators),
does one have to also "Un-Check" indidual indicators under the other 2 types?
Or would the software automatically not include all other entry types?"
Note that most indicators can be traded as either an oscillator or a breakout.
Thus if you have only selected 'Oscillators' then CASB will automatically only test the indicators as if they are
oscillators.

22. How does "File, Export CASB Parameters" work?
The File,Export CASB parameters option was previously necessary with the old GSB prototyping strategy.
We have only kept this option for backwards compatibility.
Where as File, Export CASB strategy exports a complete EL strategy, the Export CASB parameters option
only exports the variable definitions as used in the CASB template itself.
Now with CASB, it is not necessary to export the template variables on their own, since CASB
exports complete Verifiable strategies.

23. If a filter is defined refering to Data2, can I leave the Data to "Do not optimize streams", if no MultiData indicators are selected?
Yes, with additional filters, CASB simply uses whatever datastream the user has specified.
Thus Multidata is only applicable to the indicators in the 'Oscillators/Channel breakout' section on CASB3.
If you want to use a specifc data stream with a filter, you need to specify that specific data stream
in the definition of the filter, since CASB will not automatically optimize it.

24. When is a D&P report rewritten?
If a D&P is completed with no good results, does one have to "Delete" all generated files
under GGO & WFO, before running a new D&P for the same symbol?
How does the above apply to GGO and WFO produced files?
I personally start with only a few indicators and then gradually increase the complexity of
the trading model.
If for instance I have started with only two indicators and did not get good results, then I can move
on to another two indicators/data streams or maybe just replace one of the indicators/data stream with another one.
If I have started with 15 indicators and 5 data streams, how will I know which ones was the "bad"
ones that was actually responsible for distracting CASB in all kinds of wrong directions?
You do not have to delete all the generated files, because they will be overwritten next time if you are using
exactly the same symbol and bar interval.
The GGO optimization report is saved using the following name format:
Symbol_Interval_BuildCASBTemplateX_Fitness Y.txt
Thus if you are using the same symbol, bar interval, template and fitness, then that report will be overwritten.

25. Is there a recommended methodology that will aid in reducing fitting when running a CASB Template or a GGO run?
A D&P run is not optimizing a single system a such but is discovering new systems (by varying switches).
Since the stress testing feature works so well when optimizing a single system with GGO,
CASB also allow one to do stress testing during the CASB D&P process.
However, the stress testing is only done on
the "real" parameters and no stress testing is done on the switches (which will result in a different system).
In this way, the D&P run favours newly discovered systems which performs well during
stress testing (varying) the real parameters of that specific system.

The stress level and stress test increment% can be set on CASB4.
VERY IMPORTANT:
When selecting a stress test size>1, you should increase the number of Iterations accordingly!
E.g. when no stress testing is selected (Stress test size=1), then optimize
GASeed 1...10 and
Iteration 1...2000 as usual

When doing stress testing (Stress test size>1), Iteration should be optimized 1...MaxGen x PopSize x StressTestSize

e.g. if stress test size=3 then optimize
GASeed 1...10 and
Iteration 1...6000 (40 x 50 x 3)

Note that if you have selected Stress test size=3, your D&P will now take 3 times longer compared to when no stress testing is selected.

26. Can one use indicators with Price inputs such as "(H+L)/2"?
Yes, simply replace 'Price' with whatever formula you want to use.
By default, whenever CASB come across the word 'Price' within a definition, it replaces it with
'Close' in the final template, but if you use a formula like (H+L)/2 instead of 'Price', CASB will use it just as you have specified it in the definition.

27. How does the Oscillator turning point (4th) entry type works?
This entry type generates a buy signal when the short term average turns to the upside
and a sell signal when the short term average turns to the downside.
Thus the signals generated by the Oscillator turning point are faster than the signals
generated by the normal Oscillator entry type that must first wait for the short term
average to cross the upper/lower bands.

28. Why are the Moving average crossovers never used on the price series, but only on other indicators?
CASB1 states "An indicator of this type is drawn directly on the underlying price series".
However, the CASB generated code will never do straight price moving average crossovers.
This can be achieved by adding an indicator of "Close".
Since CASB always draw the moving averages on top of the indicator, it implies that if you want the moving average crossover directly on the price series,
then you need to use an indicator with the definition 'Close'.

29. Why do I get Entry/Exit on the same bar after profit targets are hit?
In TradeStation, on the Format Strategies -> Properties menu (where you set the Position Limits), you should select 'Allow up to 2 entry orders when the order is generated by a different entry order'.
This is required if your strategy has (or will test) either Max Favorable Excursion, Drawdown Support, or both of these exits.

30. Why do recursive functions sometimes give problems with EasyLanguage(TM)?
The document "Some Programming Issues in EasyLanguage" is available at https://www.tradestation.com/discussions/Topic_Archive.aspx?Topic_ID=34190
This document explains why EasyLanguage does not allow the usage of recursive functions under certain conditions.


31. Where can I find additional indicators to be used with CASB?

To make the most of your CASB, we recommend all users to consider buying an additional library of indicators and not just trying to use the few canned indicators provided with TradeStation.
Here is an example of such a library:
170 indicators, 76 trading systems, 11 paint bars, 4 functions, 3 show me's, all for free! Available at
http://trader.online.pl/ELZ/!-ELZ-index.html (http://trader.online.pl/ELZ/!-ELZ-index.html)

32. Can I reboot my computer while running CASB?
Is there a way to pause CASB, for instance if I want to reboot my computer?
Yes, just do the following:
1. Abort the CASB optimization
2. Use the GGO SmartEditor to load the GGO optimization report and scroll down to the bottom of the report to see what was the last GASeed being used when CASB was interrupted.
3. Let's say you aborted CASB when GASeed=6 and Iteration=250.
4. Then restart CASB by optimizing:
GASeed 6...10
Iteration 1..2000
Note that you will again optimize Iteration between 1...2000 regardless of the iteration number at which CASB was previously aborted.
(The Iterat# column in the CASB report is a record index calculated as follow: Iteration+100000*GASeed
Thus the first 2 digits represent the GASeed while the last 4 digits represent the Iteration number)

33. Should look inside bar back testing resolution be turned on, when using CASB?
When evaluating a trading signal for a given bar, TradeStation assumes the following:
If the Open of the bar is higher than the Close, then TS assumes the High of the bar was made before the Low.
If the Open of the bar is lower than the Close, then TS assumes the Low of the bar was made before the High.
The assumptions are not always true in real life, especially if the open and close was relatively close to each other indicating a bar with sideways market action.
Thus, using these assumptions can then lead to inaccurate backtesting results.
To be prudent and to ensure that you have accurate backtesting results at all times, we recommend that CASB users should ALWAYS use look inside bar back testing, if the strategy uses any intrabar entries/exits. (While there are means of protecting yourself against the TS assumptions, it is a very advanced topic and not recommended for the typical user).
Using look inside bar back testing will result in the optimization being a bit slower, but at least you know for sure you can trust the results.

If you want to save time by not having to use LIB, you should
use the Buy/Sell next bar at market Entry order type and also select ‘Evaluate exit only on close of bar’.
Then you can safely optimize your strategy without having to use Look-Inside-Bar (LIB) backtesting resolution.

But, as soon as you have selected to use an intrabar Entry order type (e.g. Buy next bar at Highest(High,MyVar5)+1 point)
or if you have not checked the ‘Evaluate exit only on Close of bar’ option, the strategy will need intrabar information to
be accurately executed and thus Look-Inside-bar backtesting resolution is recommended.

34. When using the "File, Export CASB Strategy" option I get a "not valid integer value" error?
The EXPORT CASB STRATEGY option is ONLY available with regard to an optimization report that was created by CASB.
Those reports can easily be identified because they all include the word "Build" in front of the strategy name, e.g.
@ER2.D_30min_BuildCASBTemplate1_Fitness1 while the report name of a normal GGO optimization report that was created by the GGO, will be for instance @ER2.D_30min_MyStrategyName_Fitness1, thus without the "Build".

35. How can I speed up my CASB optimization?
Look-Inside-Bar (LIB) backtesting is only necessary if a strategy has intrabar entries or exits.
Strategies that don't require any intrabar execution and just trade on the open or close of the next bar, does NOT require LIB testing.

CASB does allow one to evaluate exits only on the Close of each bar.
In this way we do not need LIB resolution and can save lots of time!
Furthermore, there is also a strong case to be made that evaluating exits only on the close
of the bar will prevent unnecessary exits to be triggered by a noisy intrabar high/low.

Anyway, if you want to save time by not having to use LIB, then on CASB3 you should
use the Buy/Sell next bar at market Entry order type and also select ‘Evaluate exit only on close of bar’.
Then you can safely optimize your strategy without having to use Look-Inside-Bar (LIB) backtesting resolution.

But, as soon as you have selected to use an intrabar Entry order type (e.g. Buy next bar at Highest(High,MyVar5)+1 point) or if you have not checked the ‘Evaluate exit only on Close of bar’ option, the strategy will need intrabar information to be accurately executed and thus Look-Inside-bar backtesting resolution is recommended.

Also read "How much history data is enough for CASB?". Refer
http://www.thegrailsystem.com/forum/index.php?topic=261.0 (http://www.thegrailsystem.com/forum/index.php?topic=261.0)