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

Re: [amibroker] Help with buy formula



PureBytes Links

Trading Reference Links

Marshall,

I did not include the entire formula. Condition1 and Condition10 will cause an error code. I know that they are correct because if I just use them  as the buy and sell conditions, the formula works perfectly. However, when I add the other conditions to the buy and sell conditions, the backtest misses one of the buys. It has to be something with the other conditions.

Thanks,
Tom

  ----- Original Message ----- 
  From: M. Smith 
  To: amibroker@xxxxxxxxxxxxxxx 
  Sent: Sunday, December 10, 2006 7:46 PM
  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




   
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.15/581 - Release Date: 12/9/2006 3:41 PM