Robin -- You may need to "adjust" your thinking, so it's in line with how Metastock works. It might help to visualize by assuming you (and Metastock) are traversing a timeline --
like an X-AXIS on a chart -- from left to right, one bar at a time. It's a bit like Excel, so any "formula" you write will process each bar like an Excel "column" -- each bar starting with five "rows" already (OHLCV), plus a row for each formula/indicator you create; something like this:
1. Open
2. High
3. Low
4. Close
5. Volume
6. Formula/Indicator
.
.
.
x. Formula/Indicator
IMPORTANT NOTE: You are ALWAYS better off making a Custom Indicator and dragging it
on a Chart, so you can see EXACTLY what formula code is doing. Only
after that looks correct, should you try the code it in the System Tester. You can use the FML() and FMLVAR() functions to use EXACTLY the same code in the System Tester as you see on the chart.
Now, I'll try to answer your questions:
1. >>Unfortunately, I need something that refers to the day after a signal - in this case EngulfingBull()- has formed.
Using a "power tool" when all you need is a screwdriver. Don't use a "look ahead"; that's cheating and you will come to a bad end.<g>
2. >>Doesn't Ref(EngulfingBull(),-1 refer to the day before the signal?
Yes. You need to be a bit more precise -- to which signal do you refer, the Engulfing or the White?
Your original post SEEMED to say that you want to "filter" the EngulfingBull(); I would interpret that as follows:
On the day AFTER an EngulfingBull() signal, see if that day is a White() day. If so, use that as a BUY signal.
The code I posted says EXACTLY that:
Code:
WhiteDayFollows:=Ref(EngulfingBull(),-1) { Yesterday }
AND White(); { Today }
Your original code tried to say "If tomorrow is EngulfingBull() and tomorrow is White()," which refer to the same bar.
Hope that helps. Here is a "screen shot" of the code I posted:
3. If you still get bad results in System Tester, you need to post ALL the code you are using in the System Tester TABS, plus the settings you've used for the Simulation.
Code:
Here is an example:
**************************
PERFORM TRADING SIMULATION
**************************
Dates: 3024 periods (12 years)
Default Size: % of Available Equity: 100
Portfolio: "Check" Close all positions on the last bar.
----------
BROKER Tab
----------
Interest Rates: Set all to "0".
Margin Requirements (avoid use of margin):
Long Initial: 100%
Long Maintenance: 0%
Short Initial: 200%
Short Maintenance: 101%
Commissions:
{ Using $1.00 will match the trade count }
Type: Points per Transaction
Entry: 1
Exit: 1
-------------------
TRADE EXECUTION Tab
-------------------
"Uncheck" Realistic Market Prices
Prices: Set all to OPEN
Slippage: Set all to "0"
Delay order opening: 0
4. HOW TO POST CODE: Put your code between these two lines, but take out the space after the first asterisk:
* code*
Put your code here.
* /code*
So it looks like this:
5. HOW TO POST A CHART: In Metastock, use the "Save as HTML" option. Find the folder you just saved to, then use your web browser and go to
www.IMGUR.com, drag the JPG or PNG file to the browser and UPLOAD it. Then click the BBCODE option, and switch back to the Forum and PASTE the image code.
Hope that helps,