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

Re: [amibroker] Help with buy formula



PureBytes Links

Trading Reference Links

To everyone,
I have removed the condition1 and condition10 so that the buy, sell, short, and cover are now.
//Buy and Sell orders 

Buy = Cond1 AND Cond7; 
Sell = Cond11 AND Cond17; 

//Short and Cover conditions 

Short = Sell; 
Cover=buy;

I still do not get a cover or buy on 3/15 when I backtest. Therefore, the problem is with these 2 conditions. 
It just dawned on me that it could be because I didn't use barssince. I will check it out. 
Thanks,
Tom

  ----- Original Message ----- 
  From: Dave 
  To: amibroker@xxxxxxxxxxxxxxx 
  Sent: Monday, December 11, 2006 4:30 AM
  Subject: RE: [amibroker] Help with buy formula



  Place your increase statement above your condition statements.



  -----Original Message-----
  From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of M. Smith
  Sent: Monday, 11 December 2006 1:46 PM
  To: amibroker@xxxxxxxxxxxxxxx
  Subject: Re: [amibroker] Help with buy formula



  I loaded this formula and it gave me an error message.  "condition 10=c<increase AND Ref(c,-1)>ref increase. Message was variable 'increase' used without having been initialized.  Can you help me out, Please.   Marshall

    ----- Original Message ----- 

    From: professor77747 

    To: amibroker@xxxxxxxxxxxxxxx 

    Sent: Sunday, December 10, 2006 3:23 PM

    Subject: [amibroker] Help with buy formula



    When I backtest my formula, all the buys and sells are shown 
    correctly except one. I cannot figure out what is wrong. Here is the 
    buy and sell code: 
    //Buy Signals 

    Condition1 = C > Dropline AND Ref(C,-1) < Ref(Dropline,-1); 
    Cond1=StochK() - Ref(StochK(),-1) >1; 
    Cond2=MACD() > Ref(MACD(),-1); 
    Cond6=StochD()<25; 
    Cond7=BarsSince(Cond6) <=7; 

    //Sell Signals 

    Condition10 = C < Increase AND Ref(C,-1) > Ref(Increase,-1); 
    Cond11=StochK() - Ref(StochK(),-1) < 1; 
    Cond12=MACD() < Ref(MACD(),-1); 
    Cond16=StochD()>75; 
    Cond17=BarsSince(Cond16) <=7; 

    //Buy and Sell orders 

    Buy = BarsSince(Condition1) <=5 AND Cond1 AND Cond7; 
    Sell = BarsSince(Condition10) <=5 AND cond11 AND Cond17; 

    //Short and Cover conditions 

    Short = Sell; 
    Cover=buy; 

    Graham wrote the code for the Condition1 and Condition10. It plots an 
    arrow on the graph so I know that it works. I have checked the 
    stochastic and macd for the buy in question and these are the 
    figures: 

    3/10 Stok = 20.06 
    3/13 Stok = 26.42 
    3/14 Stok = 34.98 

    3/13 Macd = -1.74 
    3/14 Macd = -1.54 
    3/14 Green up arrow 

    The formula should have covered my short and placed a buy. 

    It held my short and did not place a buy. 

    Everything else is perfect except that one day. I have backtested 
    from 9/2/05 and have 12 trades. 

    Thanks, 
    Tom




------------------------------------------------------------------------------
  I am using the free version of SPAMfighter for private users.
  It has removed 570 spam emails to date.
  Paying users do not have this message in their emails.
  Try SPAMfighter for free now!


   
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.16/582 - Release Date: 12/11/2006 4:32 PM