Or better use:
Condition = IIf ( Minute() == 4 + 0*5, True,
IIf (
Minute() == 4 + 1*5, True,
IIf ( Minute() == 4 + 2*5, True,
IIf (
Minute() == 4 + 3*5, True,
IIf ( Minute() == 4 + 4*5, True,
IIf (
Minute() == 4 + 5*5, True,
IIf ( Minute() == 4 + 6*5, True,
IIf (
Minute() == 4 + 7*5, True,
IIf ( Minute() == 4 + 8*5, True,
IIf (
Minute() == 4 + 9*5, True,
IIf ( Minute() == 4 + 10*5, True,
IIf (
Minute() == 4 + 11*5,
True,False))))))))))));
----------------------------------------------------------
---
In amibroker@xxxxxxxxxps.com,
"apfxtrader" <apforex@xxx> wrote:
> Maybe thats beacuse you
have left PlotShapes () outside the loop.
>
> you may want to try
anthoer way:
> Detecting when a new timeframe begins by identifying a
change in a
> respective value :
>
>
TimeFrameSet(in15Minute);
> LongSetup15min =
Random(1)>=0.3;
> shortSetup15min =
Random(1)>=0.3;
> TimeFrameRestore();
>
LongSetup15min = TimeFrameExpand (LongSetup15min, in15Minute);
>
shortSetup15min = TimeFrameExpand (shortSetup15min, in15Minute);
>
> TimeFrameSet(in5Minute);
> LongSetup5min=
Random(1)>=0.3;
> shortSetup5min=
Random(1)>=0.3;
> detect = C;
>
TimeFrameRestore();
> LongSetup5min= TimeFrameExpand
(LongSetup5min, in5Minute);
> shortSetup5min= TimeFrameExpand
(shortSetup5min, in5Minute);
> detect= TimeFrameExpand (detect,
in5Minute);
> Condition = Ref(detect, -1)!= detect;
>
> Buy
= LongSetup15min && LongSetup5min && Condition;
> Short
= shortSetup15min && shortSetup5min && Condition;
>
PlotShapes(Buy * shapeUpArrow, colorGreen, 0, L);
> PlotShapes(Short*
shapeDownArrow, colorRed, 0, H);
>
>
>
>
>
> --- In amibroker@xxxxxxxxxps.com,
Ed Middleton <jjj_98@> wrote:
> >
> >
apfxtrader,
> >
> > Ooops, I thought it was working ok but
it only is grabbing the
long
> and short trades that line up on the
55 minute time frame and not
any
> of the others. Not sure why this
is. From the code it looks like
it
> will check for a buy every 1
minute or whatever my base timeframe
is
> and execute only when the
5 minute entrylong is true and the
> condition is true.
> >
> > Got any thoughts on what might be happening? Here's my code
below:
> >
> >
> >
for(j=0;j<12;j++)
> >
> > {
> >
>
> EntryTimeCondition = (Minute() == (4 + j*5));
> >
> >
Buy = TimeFrameExpand(LongSignal, in5Minute) AND
>
TimeFrameExpand(SignalLatchLong, in15Minute)
> >
> >
AND (TimeNum()>93400) AND (TimeNum() <153000) AND
>
EntryTimeCondition;
> >
> > Short =
TimeFrameExpand(ShortSignal, in5Minute) AND
>
TimeFrameExpand(SignalLatchShort, in15Minute)
> >
>
> AND (TimeNum()>93400) AND (TimeNum() <153000) AND
>
EntryTimeCondition;
> >
> > }
> >
> >
----- Original Message -----
> > From: apfxtrader
> > To:
amibroker@xxxxxxxxxps.com
> > Sent: Thursday, June 21, 2007 4:48 PM
> > Subject:
[amibroker] Re: Multi Timeframe Question
> >
> >
>
>
> > Just an idea:
> >
> >
TimeFrameSet(in5Minute);
> > entryLong = Cross(MACD(),
Signal());
> > TimeFrameRestore();
> > entrylong =
TimeFrameExpand (entrylong, in5Minute, expandFirst);
> >
> > for ( i = 0; i< 12; i++)
> > {
> >
Condition = Minute() == i*5 ;
> > Buy = entrylong &&
Condition;
> > PlotShapes(Buy * shapeUpArrow, colorGreen, 0,
L);
> > }
> >
> > Plot( C, "", 39,
styleBar);
> >
> > --- In amibroker@xxxxxxxxxps.com,
"jjj_98" <jjj_98@> wrote:
> > >
> > >
Hi,
> > >
> > > I've got a program running that I
only want to "buy" or
"short"
> at
> > the
> >
> end of each 5 minute bar. My larger timeframe is 15 minutes
and
> I
> > use
> > > those signals to select which
5 minute signals to go with. I
> run
> > the
> >
> progam on 1 minute time basis for stops and profit target
> >
accuracy. Is
> > > there a way in the code to have the buy and
short entries
> triggered
> > > only on the end of each 5
minute bar.
> > >
> > > What is happening now is that
say I exit a signal on a
trailing
> > stop at
> > >
2:02 pm. At 2:03 I get another signal based on the 15 minute
> and 5
> > > minute signals generated at 2:00 pm rather. what I'd like
is
> for
> > the
> > > next entry to use the
2:05 pm 5 minute signal with the 2:00
pm
> 15
> > >
minute signal.
> > >
> > > Can you help,
> >
>
> > > Fred
> > >
> >
> >
> >
> > #ygrp-mlmsg { FONT-SIZE: small; FONT-FAMILY:
> arial,helvetica,clean,sans-serif}#ygrp-mlmsg TABLE {
}#ygrp-mlmsg
> SELECT { FONT: 99%
arial,helvetica,clean,sans-serif}INPUT
> { FONT: 99%
arial,helvetica,clean,sans-serif}TEXTAREA { FONT:
> 99%
arial,helvetica,clean,sans-serif}#ygrp-mlmsg PRE { FONT:
100%
> monospace}CODE { FONT: 100% monospace}#ygrp-mlmsg * {
LINE-
> HEIGHT: 1.22em}#ygrp-text { FONT-FAMILY:
Georgia}#ygrp-text P
> { MARGIN: 0px 0px 1em}#ygrp-tpmsgs { CLEAR:
both; FONT-
> FAMILY: Arial}#ygrp-vitnav { FONT-SIZE: 77%; MARGIN:
0px; PADDING-
> TOP: 10px; FONT-FAMILY: Verdana}#ygrp-vitnav A {
PADDING-
> RIGHT: 1px; PADDING-LEFT: 1px; PADDING-BOTTOM: 0px;
PADDING-TOP:
> 0px}#ygrp-actbar { CLEAR: both; MARGIN: 25px 0px; COLOR:
#666;
> WHITE-SPACE: nowrap; TEXT-ALIGN: right}#ygrp-actbar .left
{
> FLOAT: left; WHITE-SPACE: nowrap}..bld { FONT-WEIGHT:
>
bold}#ygrp-grft { PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-
> SIZE:
77%; PADDING-BOTTOM: 15px; PADDING-TOP: 15px; FONT-FAMILY:
> >
Verdana}#ygrp-ft { PADDING-RIGHT: 0px; BORDER-TOP: #666 1px
>
solid; PADDING-LEFT: 0px; FONT-SIZE: 77%; PADDING-BOTTOM: 5px;
>
PADDING-TOP: 5px; FONT-FAMILY: verdana}#ygrp-mlmsg #logo {
>
PADDING-BOTTOM: 10px}#ygrp-vital { PADDING-RIGHT: 0px; PADDING-
> LEFT:
8px; MARGIN-BOTTOM: 20px; PADDING-BOTTOM: 8px; PADDING-TOP:
> 2px;
BACKGROUND-COLOR: #e0ecee}#ygrp-vital #vithd { FONT-WEIGHT:
>
bold; FONT-SIZE: 77%; TEXT-TRANSFORM: uppercase; COLOR: #333; FONT-
>
FAMILY: Verdana}#ygrp-vital UL { PADDING-RIGHT: 0px; PADDING-
>
LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 2px 0px; PADDING-TOP:
>
0px}#ygrp-vital UL LI { CLEAR: both; BORDER-RIGHT: #e0ecee
1px solid;
> BORDER-TOP: #e0ecee 1px solid; BORDER-LEFT: #e0ecee 1px solid;
BORDER-
> BOTTOM: #e0ecee 1px solid; LIST-STYLE-TYPE:
none}#ygrp-vital UL LI
> .ct { PADDING-RIGHT: 0.5em; FONT-WEIGHT: bold;
FLOAT:
right; WIDTH:
> 2em; COLOR: #ff7900; TEXT-ALIGN:
right}#ygrp-vital UL LI .cat
{ FONT-
> WEIGHT: bold}#ygrp-vital
A { TEXT-DECORATION: none}#ygrp-vital
> A:hover {
> >
TEXT-DECORATION: underline}#ygrp-sponsor #hd { FONT-SIZE:
> 77%;
COLOR: #999}#ygrp-sponsor #ov { PADDING-RIGHT: 13px; PADDING-
> LEFT:
13px; MARGIN-BOTTOM: 20px; PADDING-BOTTOM: 6px; PADDING-TOP:
> 6px;
BACKGROUND-COLOR: #e0ecee}#ygrp-sponsor #ov UL { PADDING-
> RIGHT:
0px; PADDING-LEFT: 8px; PADDING-BOTTOM: 0px; MARGIN: 0px;
>
PADDING-TOP: 0px}#ygrp-sponsor #ov LI { PADDING-RIGHT: 0px;
PADDING-
> LEFT: 0px; FONT-SIZE: 77%; PADDING-BOTTOM: 6px;
PADDING-TOP: 6px;
> LIST-STYLE-TYPE: square}#ygrp-sponsor #ov LI A
{ FONT-SIZE:
> 130%; TEXT-DECORATION: none}#ygrp-sponsor #nc {
PADDING-
RIGHT: 8px;
> PADDING-LEFT: 8px; MARGIN-BOTTOM: 20px;
PADDING-BOTTOM: 0px;
PADDING-
> TOP: 0px; BACKGROUND-COLOR:
#eee}#ygrp-sponsor .ad { PADDING-
> RIGHT: 0px; PADDING-LEFT: 0px;
PADDING-BOTTOM: 8px; PADDING-TOP:
> 8px}#ygrp-sponsor .ad #hd1 {
FONT-WEIGHT: bold; FONT-SIZE: 100%;
> COLOR: #628c2a; LINE-HEIGHT:
122%; FONT-FAMILY: Arial}#ygrp-sponsor
> .ad A { TEXT-DECORATION:
none}#ygrp-sponsor .ad A:hover
> { TEXT-DECORATION:
> >
underline}#ygrp-sponsor .ad P { MARGIN: 0px}o { FONT-SIZE:
>
0px}..MsoNormal { MARGIN: 0px}#ygrp-text TT { FONT-SIZE:
>
120%}BLOCKQUOTE { MARGIN: 0px 0px 0px 4px}..replbq { }
> >
>
> ---------------------------------
> > Choose the
right car based on your needs. Check out Yahoo! Autos
> new Car Finder
tool.
>
>
>