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

[amibroker] Re: Trendlines



PureBytes Links

Trading Reference Links

Hi Bill,
This might be an answer.

Try replacing the + in your buy statements with an OR or
perhaps an AND.  It depends on what you are looking for.

Regards,

Tony  


--- In amibroker@xxxxxxxxxxxxxxx, "acesheet" <acesheet@xxxx> wrote:
> Tomasz (or anybody),
> 
> Now I'm really confused. I can get AFL to recognize either of these 
> trend line break signals alone, when the other is not involved, but 
> when I put them together, only one of them registers. 
> 
> This works by itself:
> 
> Buy=Cross(C,Study("D1",1));
> Sell=Cross(Study("U1",1),C);
> 
> And this works by itself:
> 
> Buy=Cross(C,Study("D2",1));
> Sell=Cross(Study("U2",1),C);
> 
> But this doesn't work.
> 
> Buy=Cross(C,Study("D1",1))+Cross(C,Study("D2",1));
> Sell=Cross(Study("U1",1),C)+Cross(Study("U2",1),C);
> 
> Am I doing something wrong? It seems like you can never use one set 
> of trendlines, ever.
> 
> Help?
> 
> -ace  
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "acesheet" <acesheet@xxxx> wrote:
> > I messed up the loop code it should be set to i<4 for this case.
> > 
> > One thing I've noticed while experimenting with this code is that 
> > the "Buy" and "Sell" variables will only store the buy and sell 
> > values for the last iteration of 'i' in my loop.
> > 
> > 
> > //-------------------------------------------
> > //---------------Start Code------------------
> > //-------------------------------------------
> > // Trendline trading study
> > //-------------------------
> > // Initialize Buy & Sell
> > Buy=0;
> > Sell=0;
> > for( i = 1; i < 4; i++ )
> > {
> > LinUp=Study("U"+i,1045);
> > LinDn=Study("D"+i,1045);
> > // Make Buy & Sell equal the sum of all the trades from 
> > // the individual TL signals
> > Buy = Cross( Close, LinDn) + Buy;
> > Sell = Cross( LinUp, Close) + Sell;
> > }
> > 
> > Short=0;
> > Cover=0;
> > //-------------------------------------------
> > //-----------------End Code------------------
> > //-------------------------------------------
> > 
> > This code also only uses the first set of trendlines that I drew. 
> > Can anyone help me get this to work on several trendlines? 
> > 
> > Its my intention to get it to work so that I can use trendlines 
to 
> > extract certain data using the Explore routine.
> > 
> > -ace
> > 
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "acesheet" <acesheet@xxxx> 
wrote:
> > > Thanks Tomasz.
> > > 
> > > My goal is to use multiple lines for explorations and 
> backtesting 
> > so 
> > > let me run this code by you. Maybe there is something very 
> simple 
> > > that I'm doing wrong. I have a chart on which I've placed three 
> > sets 
> > > of up and down trendlines that I manually 
> > > labelled "U1", "U2", "U3", "D1", "D2", and "D3". I'm trying to 
> > write 
> > > a simple trendline break system that uses all three lines. I'd 
> > like 
> > > to use as many as 9 different lines, but let's start here.
> > > 
> > > Here's the AFL code that I programmed:
> > > 
> > > //-------------------------------------------
> > > //---------------Start Code------------------
> > > //-------------------------------------------
> > > // Trendline trading study
> > > //-------------------------
> > > // Initialize Buy & Sell
> > > Buy=0;
> > > Sell=0;
> > > for( i = 1; i < 2; i++ )
> > > {
> > > LinUp=Study("U"+i,1045);
> > > LinDn=Study("D"+i,1045);
> > > // Make Buy & Sell equal the sum of all the trades from 
> > > // the individual TL signals
> > > Buy = Cross( Close, LinDn) + Buy;
> > > Sell = Cross( LinUp, Close) + Sell;
> > > }
> > > 
> > > Short=0;
> > > Cover=0;
> > > //-------------------------------------------
> > > //-----------------End Code------------------
> > > //-------------------------------------------
> > > 
> > > This code also only uses the first set of trendlines that I 
> drew. 
> > > Can anyone help me get this to work on several trendlines? 
> > > 
> > > Its my intention to get it to work so that I can use trendlines 
> to 
> > > extract certain data using the Explore routine.
> > > 
> > > -ace
> > > 
> > > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" 
> > <amibroker@xxxx> 
> > > wrote:
> > > > Hello,
> > > > 
> > > > If you have multiple lines with the SAME identifier on single 
> > > chart pane
> > > > only FIRST will be used by Study.
> > > > 
> > > > You should use different studyID's for multiple lines.
> > > > 
> > > > Best regards,
> > > > Tomasz Janeczko
> > > > amibroker.com
> > > > ----- Original Message ----- 
> > > > From: "acesheet" <acesheet@xxxx>
> > > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > > Sent: Sunday, August 10, 2003 12:52 AM
> > > > Subject: [amibroker] Trendlines
> > > > 
> > > > 
> > > > > Can more than one trendline of each type (per stock 
> analyzed) 
> > be 
> > > > > used in Scans, Explorations and Backtesting?
> > > > > 
> > > > > I've been messing around with the feature and I can't seem 
> to 
> > > get 
> > > > > AFL to recognize more than one trendline of each label type 
> at 
> > a 
> > > > > time. 
> > > > > 
> > > > > For instance the following code would be a very simple 
> > trendline 
> > > > > break buy and sell system:
> > > > > 
> > > > > DTL=Study("DN");
> > > > > UTL=Study("UP");
> > > > > 
> > > > > Buy = Cross( High, DTL+.1 ); 
> > > > > Sell = Cross( UTL-.1, Low );
> > > > > Short=0;
> > > > > Cover=0;
> > > > > 
> > > > > I've drawn two trendlines on my chart that I labelled "DN" 
> > using 
> > > > > the "Properties" dialogue that pops up when you doubleclick 
> a 
> > > > > trendline you've drawn. I also set two others up 
> labelled "UP" 
> > > to 
> > > > > give sell signals for the downtrend break signals.
> > > > > 
> > > > > When I run a scan or a backtest AFL only recognizes one set 
> of 
> > > > > trendlines, but I've labelled them all.
> > > > > 
> > > > > Can someone explain what I'm doing wrong, or am I even 
doing 
> > > > > anything wrong?
> > > > > 
> > > > > Tnaks.
> > > > > 
> > > > > -ace
> > > > > 
> > > > > 
> > > > > 
> > > > > Send BUG REPORTS to bugs@xxxx
> > > > > Send SUGGESTIONS to suggest@xxxx
> > > > > -----------------------------------------
> > > > > Post AmiQuote-related messages ONLY to: 
> > amiquote@xxxxxxxxxxxxxxx 
> > > > > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > > > > --------------------------------------------
> > > > > Check group FAQ at: 
> > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > > > > 
> > > > > Your use of Yahoo! Groups is subject to 
> > > http://docs.yahoo.com/info/terms/ 
> > > > > 
> > > > > 
> > > > >


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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