Hello, In real-time trading you need to use not the LAST bar (incomplete bar, which is dynamically updated as new data arrive) but from the one bar BEFORE the last bar - the one that is COMPLETE.
Buy = Ref( Buy1 AND Buy2 AND Buy3, -1 ); // use PREVIOUS bar That way guarantees that you only use close price from COMPLETED bar. This is similar to using 1-bar delay in AA settings. Best regards, Tomasz Janeczko amibroker.com ----- Original Message ----- From: "Aron" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Saturday, December 06, 2008 9:46 AM Subject: Re: [amibroker] Re: Why so signals change after the bar closes? > professor77747 wrote: >> >> It is just a simple test code, but the buy changes as explained. >> Buy1 = MACD(5,26) > Ref(MACD(5,26), -1); // macd 1 is going up. >> Buy2 = MACD(12,26) > Ref(MACD(12,26), -1); // macd 2 is going up >> Buy3 = StochK(14,3) > Ref(StochK(14.3), -1); >> // Buy and Sell orders >> Buy = Buy1 AND Buy2 AND Buy3; >> >> I just don't understand why 2 bars later that the buy signal changes. >> I get a buy arrow on my chart and the backtest will also change 2 >> bars later and show a buy when it didn't show it before. >> >> Tom >> >> > With this code the signals do not change, maybe maybe there is smth. > else you are doing wrong. > > > ------------------------------------ > > **** IMPORTANT **** > This group is for the discussion between users only. > This is *NOT* technical support channel. > > ********************* > TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to > SUPPORT {at} amibroker.com > ********************* > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > http://www.amibroker.com/devlog/ > > For other support material please check also: > http://www.amibroker.com/support.html > > ********************************* > Yahoo! Groups Links > > >
