hi,
 
I will send a reply to your yahoo Email adres,
 
rgds, Ed
 
 
----- Original Message -----
Sent: Monday, October 02, 2006 4:44 PM
Subject: [amibroker] Re: Different time frames problem

Sorry, I do understand it's a bit confusing.
I'll give you de afl code that I use now.

The problems are:
- The stopmode is op Nbar. Due to setting the periodicity to daily,
I have to change the Number of bars. I prefer to use Nbar = 3 months.

- I do now get buy/short signals during the month. I like to use
this system as a monthly system, so only buying at the beginning at
the month. It should be that first all conditions on monthly basis
should be true and then it has to look at the daily condition. If
that is also true then we have a valid buy/short signal.

I hope you can help me further. Spend already a lots of hours today
solving this question.

Thanks Ronald

TimeFrameSet(inMonthly);
MaMonth= MA(C,61);
MaMonth2= MA(C,38);
TimeFrameRestore();

TimeFrameSet(inDaily);
MaDay= MA(C,38);
TimeFrameRestore();

MaMonth=TimeFrameExpand(MaMonth,inMonthly,mode=expandFirst);
MaMonth2 = TimeFrameExpand( MaMonth2, inMonthly,mode=expandFirst );

Buy = Cross(C,MaMonth) AND MaMonth2 < MaMonth AND C > MaDay ;
Short = Cross(MAMonth,C) AND MaMonth2 > MaMonth AND C < MaDay ;
Sell = Short ;
Cover = Buy ;

LPos = Flip(Buy,Short);
SPos = Flip(Short,Buy);
LPT = Optimize("lpt",5,5,5,1);
SPT = Optimize("spt",5,5,5,1);
PT = IIf(LPos,LPT,IIf(SPos,SPT,True));

LSL = Optimize("lsl",90,90,90,1);
SSL = Optimize("ssl",90,90,90,1);
SL = IIf(LPos,LSL,IIf(SPos,SSL,True));

ApplyStop(stopTypeProfit,stopModePercent,PT,True);
ApplyStop(stopTypeNBar,stopModeBars,SL,True);

pds = 1;
SetTradeDelays(pds,pds,pds,pds) ;

PositionSize = 1000;

SetChartOptions(0, chartShowDates);
GraphXSpace = 5;
Plot(C,"C",1,64);
Plot(MaMonth,"MaMonth",colorGreen,1);
Plot(MaMonth2,"MaMonth2",colorBlue,1);
Plot(MaDay,"MaDay",colorOrange,1);

PlotShapes(IIf(Buy,shapeUpArrow,0),colorDarkOliveGreen, layer = 0,
yposition = O, offset = 0 );

--- In [EMAIL PROTECTED]ps.com, "Edward Pottasch" <empottasch@...>
wrote:
>
> i'm sorry I do not understand what you want to do. If you explain
in more detail I can show how to do it,
>
> rgds, Ed
>
>
> ----- Original Message -----
> From: optiekoersen
> To: [EMAIL PROTECTED]ps.com
> Sent: Monday, October 02, 2006 12:04 PM
> Subject: [amibroker] Re: Different time frames problem
>
>
> Thanks to all for the help. I get much closer to the solution
now,
> but there's still a problem. I make use of a NBar stop en this
is
> set on 3 months. When I insert your suggestions in my system I
get
> problems when I make use of the daily periodicity.
> 1) It start buying on every possible trading day in a Month and
I
> use the monthly periodicity, so that it will be the first of a
month.
> And I had to extend the Nbar stop from 3 bars to 90 or something
> like that. And that's not how I like it.
> 2) I have set the periodicity to monthly and changed your
> suggestions to:
>
> TimeFrameSet( inDaily );
> MaDay= MA( C, 25 );
> TimeFrameRestore();
>
> // now expand this array
> > MaDay = TimeFrameExpand( MaDay, inDaily,mode = expandFirst );
>
> > MaMonth= MA( C, 25 );
> > MaMonth2= MA( C, 10 );
>
> But I still have some problems yet. I think it's the daily MA
which
> gives me the problems. On the Chart the Daily Close is lower
than
> MaDay, but it still gives me a but signal. Maybe it looks 1
month in
> the past? I tried to figure this out by changing the quotes, but
> that doesn't change anything.
>
> Maybe has one of you an idea?
>
> Greetz Ronald
>
> --- In [EMAIL PROTECTED]ps.com, "Edward Pottasch"
<empottasch@>
> wrote:
> >
> > hi,
> >
> > your arrays need to have the same length and the elements of
the
> arrays need to have the same date when you want to compare them.
> >
> > So when you are for instance working in the daily time frame
and
> you want to compare a timeseries in this timeframe with a
timeseries
> in the monthly timeframe it is done like:
> >
> >
> > TimeFrameSet( inMonthly );
> > MaMonth= MA( C, 25 );
> > MaMonth2= MA( C, 10 );
> > TimeFrameRestore();
> >
> > // now expand this array
> > MaMonth = TimeFrameExpand( MaMonth, inMonthly,mode =
> expandFirst );
> > MaMonth2 = TimeFrameExpand( MaMonth2, inMonthly,mode =
> expandFirst );
> >
> > // assuming you are in the daily time fame
> > MaDay= MA( C, 25 );
> >
> > Buy = Cross(C,MaMonth) AND MaMonth2 < MaMonth AND C > MaDay ;
Buy
> = Ref(Buy,-1);
> >
> > SetChartOptions(0, chartShowDates);
> > GraphXSpace = 5;
> > Plot(C,"C",1,64);
> > Plot(MaMonth,"MaMonth",colorGreen,1);
> > Plot(MaMonth2,"MaMonth2",colorBlue,1);
> > Plot(MaDay,"MaDay",colorWhite,1);
> >
> > PlotShapes(IIf(Buy,shapeUpArrow,0),colorWhite, layer = 0,
> yposition = O, offset = 0 );
> >
> >
> >
> > rgds, Ed
> >
> >
> >
> >
> > ----- Original Message -----
> > From: optiekoersen
> > To: [EMAIL PROTECTED]ps.com
> > Sent: Monday, October 02, 2006 10:03 AM
> > Subject: [amibroker] Different time frames problem
> >
> >
> > Hello,
> >
> > I hope that anybody can help me to fix the next problem.
> >
> > I like to get a buy signal if the Monthly Close crosses the
> Monthly
> > MA_25 and the Daily close (at the end of the month) also has
to
> be
> > higher than the Daily MA-25.
> > It also has to be that Monthly MA-10 is lower than the Monthly
> MA-25.
> > I use the following code:
> >
> > TimeFrameSet( inDaily );
> > MaDay= MA( C, 25 );
> > TimeFrameRestore();
> >
> > TimeFrameSet( inMonthly );
> > MaMonth= MA( C, 25 );
> > TimeFrameRestore();
> >
> > TimeFrameSet( inMonthly );
> > MaMonth2= MA( C, 10 );
> > TimeFrameRestore();
> >
> > Buy = cross(C,MaMonth) and MaMonth2 < MaMonth and c > MaDay ;
> >
> > The periodicity settings are set on monthly. I tried to use
> > timeframeexpand on different ways, but I am clearly doing
> something
> > wrong. Hope that anyone knows the solution..
> >
> > Greets Ronald
> >
>

__._,_.___

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 other support material please check also:
http://www.amibroker.com/support.html






SPONSORED LINKS
Software support Small business finance Business finance online
Business finance training Business finance course

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to