/*[[ Name := EMA_v0.1 Author := Hapsa Link := http://www.metaquotes.net/ Separate Window := No Separate Window := No First Color := Blue First Draw Type := Symbol First Symbol := 200 Use Second Data := Yes Second Color := Red Second Draw Type := Symbol Second Symbol := 202 ]]*/ Input : FastPeriod(5), SlowPeriod(17); Variable : shift(0); Variable : iMASlowPrevious(0), iMaSlowCurrent(0), iMaFastPrevious(0), iMaFastCurrent(0); Variable : val1(0), val2(0); SetLoopCount(0); For shift=Bars-1 Downto 0 Begin val1=0; val2=0; iMaSlowPrevious = iMAEx(SlowPeriod, MODE_EMA, 0, PRICE_CLOSE, shift+1); iMaSlowCurrent = iMAEx(SlowPeriod, MODE_EMA, 0, PRICE_CLOSE, shift); iMaFastPrevious = iMAEx(FastPeriod, MODE_EMA, 0, PRICE_CLOSE, shift+1); iMaFastCurrent = iMAEx(FastPeriod, MODE_EMA, 0, PRICE_CLOSE, shift); If iMaFastPreviousiMASlowCurrent Then val1=Low[shift]; If iMaFastPrevious>iMaSlowPrevious and iMaFastCurrent