[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] Re: Question regarding real-time trading



PureBytes Links

Trading Reference Links



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: amibroker@xxxxxxxxxxxxxxx
From: juliangoodsell@xxxxxxxxxxxx
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 amibroker@xxxxxxxxxps.com, "scourt2000" <stevehite@x..> 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.

__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___