Hi, 

 

There's lots of mistakes in this code:

1.       You're missing timeframeexpand

2.       IIF cannot be use like this, I wonder if it returned you a result
at all

 

Ok. I'm not sure about your Stochastic-Thingie, but you should be able to
customize my example to your needs. Furthermore check the tutorial.
http://www.amibroker.com/guide/h_timeframe.html

5min-Chart, your smallest interval, could be anything, 15min, 1hr, I take
5min for now. I wanna buy if the Close (5min) is greater than EMA(C,200)
indaily and only before 12 o'clock in the morning. 

 

 

TimeFrameSet(inDaily);

EMA1=EMA(C,200);

TimeFrameRestore();

 

Buy=IIf(C>TimeFrameExpand(EMA1,inDaily) AND TimeNum()<=120000,1,0);

Sell=0;

 

Anyways, you don't really need IIF here. Works like this, too

 

TimeFrameSet(inDaily);

EMA1=EMA(C,200);

TimeFrameRestore();

 

Buy=C>TimeFrameExpand(EMA1,inDaily) AND TimeNum()<=120000;

 

Sell=0;

 

Matthias

 

From: amibroker@yahoogroups.com [mailto:amibro...@yahoogroups.com] On Behalf
Of Jonathan Lee
Sent: Dienstag, 27. Juli 2010 19:47
To: amibroker@yahoogroups.com
Subject: [amibroker] Multiple Time Frames

 

  

Hi amibroker experts,

 

I'm a little stuck with multiple time frames - and was hoping someone could
assist. It's probably a straight forward solution as I'm pretty much a
newbie at this.

 

I've got a basic oscillator (similar to stochastics) in which I have
determined that <30 is oversold, >70 is overbought and 50 at mid range. i'm
using the higher time frame as a condition, so looking at the hourly chart,
I only want a buy signal to be actioned if the daily chart (%K and %D) is
less than the mid range (50).

 

I put all my daily parameters between:

TimeFrameSet (inDaily) and TimeFrameRestore ();

 

And my buy/sell instruction (in the hourly setting) is as follows:

 

IIf((DailySK<=DailyMid AND DailySD<=DailyMid),Buy=SK<=Lower AND SD<=Lower
AND Cross(SK,SD),0);

IIf((DailySK>=DailyMid AND DailySD>=DailyMid),Sell=SK>=Upper AND SD>=Upper
AND Cross(SD,SK),0);

Short=Cover=0;

 

For some reason I am getting results which ignore the higher time frame? 

Much appreciated.

Jonathan 

 

 



Reply via email to