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

Re: [amibroker] Re: Learning



PureBytes Links

Trading Reference Links




Peter,
Thank you for the suggestion, but it still is not 
what I want.  I added my prevCRoc = Ref(CRoc,-1) to your suggested 
code and here is what I got (Minus a few columns).  I ran an Explore on SPX 
starting with 3/8/02..
 


  
  
    
      Date
    
      Close
    
      ROC
    
      P Col
    
      N Col
  
    
      03/10/02
    
      1,164.31
    
      0.58
    
      0.58
    
      -0.45
  
    
      03/11/02
    
      1,168.26
    
      0.34
    
      0.34
    
      0.58
  
    
      03/12/02
    
      1,165.58
    
      -0.23
    
      0.34
    
      -0.23
  
    
      03/13/02
    
      1,154.09
    
      -0.99
    
      -0.23
    
      -0.99
  
    
      03/14/02
    
      1,153.04
    
      -0.09
    
      -0.99
    
      -0.09
  
    
      03/15/02
    
      1,166.16
    
      1.14
    
      1.14
    
      -0.09
  
    
      03/18/02
    
      1,165.55
    
      -0.05
    
      1.14
    
      -0.05
  
    
      03/19/02
    
      1,170.29
    
      0.41
    
      0.41
    
      -0.05
 
 
I did not want the P Col or N Col to change if the 
ROC is the opposite sign.
 


  
  
    
      Date
    
      Close
    
      ROC
    
      P Col
    
      N Col
  
    
      03/08/02
    
      1,164.31
    
      0.58
    
      0.58
    
      -0.45
  
    
      03/11/02
    
      1,168.26
    
      0.34
    
      0.34
    
      -0.45
  
    
      03/12/02
    
      1,165.58
    
      -0.23
    
      0.34
    
      -0.23
  
    
      03/13/02
    
      1,154.09
    
      -0.99
    
      0.34
    
      -0.99
  
    
      03/14/02
    
      1,153.04
    
      -0.09
    
      0.34
    
      -0.09
  
    
      03/15/02
    
      1,166.16
    
      1.14
    
      1.14
    
      -0.09
  
    
      03/18/02
    
      1,165.55
    
      -0.05
    
      1.14
    
      -0.05
  
    
      03/19/02
    
      1,170.29
    
      0.41
    
      0.41
    
      -0.05
 
<FONT face=Arial 
size=2>If you or anyone else can help me with this (simple?) example, I would 
appreciate it.
<FONT face=Arial 
size=2>I can do it in Excel but really want to learn 
AFL.
 
Thanks
Stan Solak
<FONT face=Arial 
size=2> 
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  <A title=amiabilityy@xxxxxxxxx 
  href="">amiabilityy 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Friday, April 25, 2003 12:37 
  AM
  Subject: [amibroker] Re: Learning
  Hi sjsolak.Im not sure of what yopu want but this 
  formula places all the positive ROC in 1 column and the negative ROC in 
  another column.It also has 2 other column, 1 has the last time the 
  positive ROC was true,and the other contains the last time the negative 
  ROC was true.  Run it as an exploration.CRoc = 
  ROC(C,1);PosRoc = IIf (CRoc >= 0, CRoc, prevCRoc);NegRoc = IIf 
  (CRoc < 0, CRoc, prevCRoc);barnumberpos = Cum(PosRoc);lastbarpos = 
  barnumberpos == LastValue( barnumberpos );lastbarpos 
  =Cross(Lastbarpos,0.1);barnumberneg = Cum(NegRoc );lastbarneg = 
  barnumberneg == LastValue( barnumberneg );lastbarneg 
  =Cross(Lastbarneg,0.1);Filter = 
  Croc;//1;AddColumn(Ref(C,-1),"yesterdaysclose 
  today");AddColumn(C,"close 
  today");AddColumn(CRoc,"ROC");AddColumn(PosRoc,"P 
  Col");AddColumn(NegRoc,"N 
  Col");AddColumn(Lastbarpos,"Lastpos");AddColumn(Lastbarneg,"Lastneg");Peter.--- 
  In amibroker@xxxxxxxxxxxxxxx, "sjsolak" <sjsolak@xxxx> wrote:> I 
  am still trying learn Amibroker.  I have a question.  I am OK 
  with > Excel so I can explain my question using an Excel 
  example.> > Col A is the ROC for the Close (of SPX in my 
  test)> > I want Col B to be the ROC if the Close ROC is postive 
  and the last > postive value if the new ROC is negative.> 
  > I want Col C to be the ROC if the Close ROC is negative and the 
  last > negative value if the new ROC is postive.> > 
  Will someone please help?  Here is the code I have, but willing to 
  > start over.  This gives values for the prevCRoc and I don't want 
  that > value.> > In Excel it is (B1) 
  =If(a1>=0,a1,b2)>                
  (C1) =If (a1<0,a1,c2)   > > AmiBroker Test:> 
  > CRoc = ROC(C,1);> prevCRoc = Ref(CRoc,-1);> > 
  PosRoc = IIf (CRoc >= 0, CRoc, prevCRoc);> NegRoc = IIf (CRoc < 
  0, CRoc, prevCRoc);>  > Filter = Close >1;>  
  > AddColumn(C,"close today");> AddColumn(CRoc,"ROC");> 
  AddColumn(PosRoc,"P Col");> AddColumn(NegRoc,"N Col");> > 
  > // Not sure below is correct.   Why do you need Buy and 
  Sell for > Explore?> Buy = Cross( Close, EMA( Close, 45 ) 
  );> Sell = Cross( EMA( Close, 45 ), Close );> > Stan 
  SolakSend 
  BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor












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 the Yahoo! Terms of Service.