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

Re: [amibroker] Re: Testing for new bar using string manipulation and quotation time



PureBytes Links

Trading Reference Links

TJ - could you describe how AB handles data from DTN-IQ?
 
d

On Tue, Mar 17, 2009 at 11:42 AM, Tomasz Janeczko <groups@xxxxxxxxxxxxx> wrote:
>
> Note that AB does not change the bar until a tick comes in to set the open price. That can be a second or two for high volume
> trading periods but two minutes or never in
> thinly traded periods. I am not sure what AB does if there is never a tick in the bar. It may set the OHLC to the last bar that
> had actual data.

Not true. AmiBroker Pro will execute your formula with every new tick (but not more often than 10 times per second)
- if intraday refresh interval is set to zero.

It will also refresh the chart every second even if there is no new data because IB plugin sends "general update" every second.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "Barry Scarborough" <razzbarry@xxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, March 17, 2009 4:17 PM
Subject: [amibroker] Re: Testing for new bar using string manipulation and quotation time


> You are making this much more difficult than it needs to be. If you want to know if the bar has changed all you need to do is:
>
> // Check if new bar
> // NZ sets current bar in OldBarTime the first pass through the code.
> OldBarTime = Nz(StaticVarGet("BarTime"), LastValue(TimeNum()));
> NewBarTime = LastValue(TimeNum());
> if( OldBarTime != NewBarTime )
> NewBar = True;
> else
> NewBar = False;
> StaticVarSet("BarTime", LastValue(TimeNum()));
>
> NewBar is only true the first pass through your code. The next pass it will be set False. And this will be true the first tick of
> the new bar. The next scan through the code will find time number equal to the static var BarTime and will set NewBar false.

>
> Barry
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "ozzyapeman" <zoopfree@xxx> wrote:
>>
>> Hello, hoping someone can help out with this string conversion problem.
>>
>> In live trading, I am pulling quotation time using TimeNum(), and want
>> to test for the start of a new bar. So my thinking is to simply convert
>> the time to a number, extract the last two characters, convert back to a
>> number and see if it equals 0. If so, that means the last two digits in
>> the quotation time are "00" and hence we are at the start of a new bar.
>>
>> However, the sample code below is always thinking we have a new bar
>> whether the time is, for e.g.  :
>>
>> 10:37:31   or
>> 10:37:00
>>
>>   Obviously, only the second time should trip the 'new bar' print. But
>> instead, both do:
>>
>>
>> barTime       = 103731;  // we would normally use TimeNum() here, but
>> using a number for example
>>
>> barTimeStr    = NumToStr(barTime);
>>
>> NewBarSeconds = StrToNum ( StrRight(barTimeStr, 2) );
>>
>> printf("NewBarSeconds = " + NewBarSeconds);
>>
>> if (NewBarSeconds == 0)
>>
>> printf("    We have a new bar");
>>
>
>
>
>
> ------------------------------------
>
> **** 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/
>
> Yahoo! Groups Links
>
>
>



------------------------------------

**** 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/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
   http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
   Individual Email | Traditional

<*> To change settings online go to:
   http://groups.yahoo.com/group/amibroker/join
   (Yahoo! ID required)

<*> To change settings via email:
   mailto:amibroker-digest@xxxxxxxxxxxxxxx
   mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
   amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
   http://docs.yahoo.com/info/terms/




__._,_.___


**** 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

__,_._,___