hi James,
what you need to do is use the same timeframes in the Buy/Sell equations.
So for instance you are working in the 1-minute time frame then you define your daily constraints as:
// set timeframe
TimeFrameSet( inDaily );
emaDaily = EMA(C,50); buyDaily = C > emaDaily;
// restore to current time frame
TimeFrameRestore( );
// expand the Daily timeframe array to the timeframe you are using currently
buyDaily = TimeFrameExpand( buyDaily, inDaily );
// now you can use this array in your buy/sell constraints
Buy = Cross (High, BuyUpper) AND buyDaily;
regards,Ed
----- Original Message -----
Sent: Monday, September 15, 2008 11:16 PM
Subject: [amibroker] Daily system as a filter for intraday system
I would like to test using a daily system as a filter for an intraday system so that long positions are only taken if the daily system is long and vice-versa.
I understand the set time frame aspect, what I don't understand is how to set the daily system's position as a condition. See AFL thought illustration in red below. Could someone point me in the right direction.
Buy = Cross (High, BuyUpper) AND (Daily system is long);
Sell = Cross (StopLower, Low);
Short = Cross (SellLower, Low) AND (Daily system is short);
Cover = Cross (High, StopUpper);
Thank you,
James