I am trying on a code which contains ref function. But when I take ref function as -1 it count it as 5 candles and give scan result after 5 candles. Even when I divide it by 5 it wont work properly. I tried in 3 diff version of amibroker. Kindly help
TimeFrameSet(in5Minute); a =StochD( periods = 14, Ksmooth=3, Dsmooth=3 ) ; b= StochK( periods = 14, ksmooth=3 ); r=MACD(12,26); s=Signal(12,26,9); D1 =Cross(Ref(r,s),-1) ; d11= D1 AND (b>a); TimeFrameRestore(); Buy = d11; Buy = TimeFrameExpand(d11,in5Minute); AlertIf( Buy, "SOUND C:\\Windows\\Media\\Notify.wav", "Audio alert", 2 );
This code will give scan result on next candle where macd cross occur if stochastic is +ve. Check this code is right or wrong . If wrong plz correct it. And if right kindly give me example where u r using ref -1 functions.