I'm trying to calculate the price with certain MACD condition. This doesn't seem to return the value I want to find, so I appreciate any help. Thank you in advance!
BP = ValueWhen(Cross(MACD(5,10),Signal(5,10,3)), BuyPrice, 1);
SP = ValueWhen(Cross(Signal(5,10,3),MACD(5,10)), SellPrice, 1);
@skymage142 I think you are asking how to predict a price in advance, at which the MACD crossover will occur?
If so, read the articles in Technical Analysis of Stocks and Commodities.
"Reversing MACD" January 2012 "Reversing the MACD: The Sequel" November 2013
There are articles in which the author "Johnny Dough" (in previous correspondence he assures me that is not his real name) discusses how to do this and luckily he is an AmiBroker user and includes afl codes. In fact the Jan 2012 article code is one of the "Trader Tips". Good luck.
@portfoliobuilder I guess I wasn't very clear at first, it's true that I want to find the price point in the future where crossover happens. Thank you for the suggestion, I already found the code for it and testing at the moment.