Enter when other symbols meet criteria
Moderator: Chris White
Enter when other symbols meet criteria
Is it possible enter when the CCI(20 period) of Microsoft is below 200 and the S&P 500 index (or its ETF equivalent) is above its 75 period moving average. If yes, how is this done?
-
- Posts: 212
- Joined: Mon Nov 29, 2010 9:21 pm
Re: Enter when other symbols meet criteria
Yes - the way you would do this is by adding the following script:
Here you can see that they symbols for comparison have been 'hard-coded' to MSFT for the CCI calculation and SPY for the MA calculation.
When using this script it is important that your active symbol list contains both MSFT and SPY and that you have updated the list so that all symbols contained within it have the same start and end dates.
When you add this script to a chart area it will look like this: Note that the chart is showing ILF and the CCI(20) area is showing CCI for ILF, but the Darrell2 area is calculating based off of other symbols (SPY and MSFT).
When you run this script in the security selector in the entries and exits tab, you will see something like this: Note here that every time the condition is true, all symbols that are in the symbol list are selected.
Code: Select all
cond1:= FML('MSFT', 'CCI(20)[CCI]') < 200;
cond2:= FML('SPY', 'C') > FML('SPY', 'MA(75)');
event: cond1 & cond2;
When using this script it is important that your active symbol list contains both MSFT and SPY and that you have updated the list so that all symbols contained within it have the same start and end dates.
When you add this script to a chart area it will look like this: Note that the chart is showing ILF and the CCI(20) area is showing CCI for ILF, but the Darrell2 area is calculating based off of other symbols (SPY and MSFT).
When you run this script in the security selector in the entries and exits tab, you will see something like this: Note here that every time the condition is true, all symbols that are in the symbol list are selected.