Newbie needs some Amibroker AFL help

#1
All - perhaps some kind soul could help me. I'm not great at programming. I use Amibroker and it's been hard getting help. I would like to have a system that trades the ES S & P mini futures intraday, planning to use 1 minute bars. Here is what I want to look at:

1) I want to backtest trade entry only on the 2nd or 3rd touch of the same new high or low of day, obviously when a higher high or lower low wasn't also hit. In other words, each touch of that new level would have to be the highest or lowest to that point. So if the ES traded up to 2140.25, HOD, then pulled back a couple of ticks, then went back up to 2140.25, that would be the 2nd touch, and would trigger a trade entry. I would backtest 2nd touch only, 3rd touch only, etc. You can comment scenarios and leave the one active, and I will backtest each one separately. Sometimes the system will trade in the direction of the new HOD/new LOD, and sometimes it will fade it for a few ticks, depending on values of some indicators.

2) One of the indicators will look at 4 ETF tickers to determine underlying strength/trend day up or trend day down. Perhaps user-defined function such as MktLeaders would simplify the entry rules. So I need to determine if they are up ON THE DAY over the previous days' close. I would like this to look at all 4 to see how many of these are up, and also how many are down, on the day. For example, I will backtest entry long when 2 of the 4 are up on the day, 3 are up, or all 4. Conversely, if X number of these 4 ETFs are down, a sell signal is created. For now I will simply call out these tickers A, AA, B, and C. I did get some suppost (please see below) but feel that it is not correct, as this is an intraday trading system. I look to see if those 4 ETFs are up on the day over the previous days' close. So don't we need a '-1' at the end of the 2nd half of the code? No telling when/if I will get response using standard channels so any help would be appreciated! I'm not even totally sure how to integrate that last line of code into the entry rules.

Poorboy

'you could check the condition for a list of symbols and sum up the values, e.g. like this:

cond1 = Foreign("symbol1", "C") > Foreign("symbol1", "O");
cond2 = Foreign("symbol2", "C") > Foreign("symbol2", "O");
cond3 = Foreign("symbol3", "C") > Foreign("symbol3", "O");
total = cond1 + cond2 + cond3;
condFilter = total == 3;///'
 

Similar threads