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

[amibroker] Re: Time range causes buys and Analysys to fail



PureBytes Links

Trading Reference Links

Thank you very much. 

One of these days when you are bored out of your skull you will have 
to explain why use inRange worked and the discrete logic would not 
work. I mean what is the difference between 

buy = MA1 >= MA2 AND C >MA2 AND inRange;
and 
buy = MA1 >= MA2 AND C >MA2 AND tod >= timeopen AND tod <= timeclose;
except the latter WILL NOT work.

They seem like identical statements. AMI blows my mind at times. 

Thanks again,
Barry

--- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxx> wrote:
>
> timeopen = 50000;       // 05:00
> timeclose = 153000;     // 15:30
> tod = TimeNum();
> 
> inRange = tod >= timeopen AND tod <= timeclose;
> 
> buy = MA1 >= MA2 AND C >MA2  and inRange;
> 
> -- 
> Cheers
> Graham Kav
> AFL Writing Service
> http://www.aflwriting.com
> 
> 
> 
> 
> On 19/01/2008, Barry Scarborough <razzbarry@xxx> wrote:
> > I changed the code to the following and it fails completely.
> >
> > buy = IIf(tod >= timeopen AND tod <= timeclose AND MA1 >= MA2 AND 
C >
> > MA2 , 1, 0);
> >
> > I removed the AND tod <= timeclose and it fails completely.
> > So I found something two other things that don't work.
> >
> > How can we code to limit trading within a time frame?
> >
> > Barry
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Barry Scarborough" <razzbarry@>
> > wrote:
> > >
> > > I am trying to limit the time I trade to 5:50 AM to 3:30 PM.
> > > Everything seems to work correctly until I move the chart to 
3:30
> > PM.
> > > When I do that all the arrows disappear, even the ones that were
> > > active a minute bar before. Also, back test does not produce any
> > > results. The code I am using is the following:
> > >
> > > timeopen = 50000;     // 05:00
> > > timeclose = 153000;   // 15:30
> > > tod = TimeNum();
> > > bartime = SelectedValue(tod);
> > > // take trade between hours of 5 am to 3:30 pm
> > > if( bartime >= timeopen AND bartime < timeclose)
> > > {
> > >    buy and sell code
> > > }
> > >
> > > later I plot up and down arrows at the buy and sell locations.
> > >
> > > Why do all the arrows disappear when I move out of the active
> > trading
> > > time period? It probably has to do with the array processing but
> > why
> > > that would happen eludes me. What would I have to change to 
allow
> > it
> > > to process the trading period correctly?
> > >
> > > Thanks,
> > > Barry
> > >
> >
> >
> >
> >
> > 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
> >
> >
> >
> >
>




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/