Your code and words don't match. I assume that your words are correct. "I want the buy condition to be when the MACD is below the Signal and the gap is closing"
buy = macd() < signal() and hist < ref(hist, -1); "and the sell to be when the MACD is above the signal and closing" sell = macd() > signal() and hist < ref(hist, -1); Bill ----- Original Message ----- From: [EMAIL PROTECTED] To: [email protected] Sent: Friday, October 26, 2007 9:13 PM Subject: Re: [amibroker] MACD Histogram Bill, Thank you. I didn't notice that. I guess that I am doing this all wrong. What I want is to have the condition met when the gap between the MACD and Signal is closing. I want the buy condition to be when the MACD is below the Signal and the gap is closing and the sell to be when the MACD is above the signal and closing. Would this work? //Buy Signals Hist1 = MACD() - Signal(); Hist2 = Signal() - MACD(); Condition1 = MACD() > Ref(MACD(),-1); Condition3 = Hist1 < Ref(Hist1, -1); //Sell Signals Condition11 = MACD() < Ref(MACD(),-1) AND MACD() > 0; Condition3 = Hist1 < Ref(Hist1, -1); //Buy and Sell orders Buy = Condition1 AND Condition3; Sell =Condition11 AND Condition3; //Short and Cover conditions Short=Sell; Cover=Buy; I Tried it, but it didn't work. ----- Original Message ----- From: wavemechanic To: [email protected] Sent: Friday, October 26, 2007 12:19 PM Subject: Re: [amibroker] MACD Histogram I don't think so. Your buy = macd > ref(macd) and hist < ref(hist). However, the data you presented has macd > ref(macd) and hist > ref(hist) so the buy condition was not satisified. Bill . ------------------------------------------------------------------------------ No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.15.10/1091 - Release Date: 10/24/2007 2:31 PM
