[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Daily system as a filter for intraday system



PureBytes Links

Trading Reference Links

James,
Would this tweak of Ed's code do what you want?
Cheers,
Ian

// set timeframe
TimeFrameSet( inDaily );
buyDaily = YOUR BUY CONDITION GOES HERE;
shortDaily = YOUR SHORT CONDITION GOES HERE;

// Once buyDaily=1, InLongDaily stays 1 till shortDaily=1
InLongDaily = Flip(buyDaily, shortDaily);
// Once shortDaily=1, InShortDaily stays 1 till buyDaily=1
InShortDaily = Flip(shortDaily, buyDaily);
// restore to current time frame
TimeFrameRestore( );
 
// expand the Daily timeframe array to the timeframe you are using 
currently
buyDaily = TimeFrameExpand( InLongDaily, inDaily );
 
// now you can use this array in your buy/sell constraints
Buy = Cross (High, BuyUpper) AND buyDaily; 



--- In amibroker@xxxxxxxxxxxxxxx, James <jamesmemphis@xxx> wrote:
>
> Ed,
>  
> Sorry for the delay, seems volatility has picked up. I believe the 
problem with your code below is that in my daily system, there is not 
a continuous condition for buyDaily as C > emaDaily. There is a set 
of conditions that trigger a buy and the system is long until it goes 
short. Therefore, buyDaily is only true, or equal to 1, on the day 
the daily system has a buy. I need a different way to define long or 
short, perhaps based on the last signal. Any ideas?
>  
> James
> 
> 
> 
> ----- Original Message ----
> From: Edward Pottasch <empottasch@xxx>
> To: amibroker@xxxxxxxxxxxxxxx
> Sent: Tuesday, September 16, 2008 2:22:31 AM
> Subject: Re: [amibroker] Daily system as a filter for intraday 
system
> 
> 
> 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 ----- 
> From: James 
> To: amibroker@xxxxxxxxx ps.com 
> 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
>



------------------------------------

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/