Dear Rajiv Thanks for your code. Can you post a simple coding with price and MACD with your newbar code. Since I cant code,I am requesting this rvlv-Hyderabad --- On Mon, 8/17/09, Rajiv Arya <[email protected]> wrote:
From: Rajiv Arya <[email protected]> Subject: RE: [amibroker] Re: Question regarding real-time trading To: [email protected] Date: Monday, August 17, 2009, 12:04 PM I do this for timed based bar PrevTN = StaticVarGet( "TimeNumber" ); TN = LastValue(TimeNum( )); NewBar = TN != PrevTN; StaticVarSet( "TimeNumber" ,TN); This should work for any bar type newday=day() !=ref(day( ),-1); PrevBN=StaticVarGet ("BarofDay" ); BN=lastvalue( barssince( newday,1) ); newbar=BN!=PrevBN; StaticVarSet( "BarofDay" ,BN); if (newbar) {..... do trading code } To: amibro...@yahoogrou ps.com From: juliangoodsell@ yahoo.com. au Date: Mon, 17 Aug 2009 14:59:41 +0000 Subject: [amibroker] Re: Question regarding real-time trading I might be missing something in your question but if you want to know if a new bar has arrived, you could just check the value of barindex? LastBar = LastValue(BarIndex( )); prevLastBar = StaticVarGet( "prevlastbar" ); // Initialise if (IsNull(prevLastBar )){ prevLastBar = LastBar; StaticVarSet( "prevlastbar" , prevLastBar) ; } if (LastBar > prevLastBar) { _TRACE("New Bar"); StaticVarSet( "prevlastbar" , LastBar); } Regards, Jules. --- In amibro...@yahoogrou ps.com, "scourt2000" <steveh...@. ..> wrote: > > > Would it be of value to any other real-time traders here (besides me, of > course) to have Amibroker automatically notify a script when the 1st tick of > a new bar is coming into the script? This way, you don't have to know what > kind of bar you're dealing with (minute-based, tick-based, volume-based) and > try to do the calc yourself. > > I guess it would be something like a toggle trigger that you check in a > simple IF condition and that toggle is only entered into on the 1st tick of > each new bar. > > Just wanted to get an idea of the interest before going through the formal > procedure of entering it into the Amibroker wish list area. > > Thanks. > Windows Live: Keep your friends up to date with what you do online. Find out more.
