[amibroker] Reference the most recent timestamp of a foreign ticker.

 

Hello.
I am having problems referencing that most latest timestamp of a foreign symbol in real time database (in this instance the spy with interactive brokers plug-in). Based time interval set in database is 1min.
The function I have written below just returns the timestamp from what ticker is shown in the chart pane window. It also just returns whatever timeframe the chart pane window is in at the time, not the one-minute timestamp as requested in the timeframeset(in1minute) function.

function timestamp()
{

      _TRACE( "#Function Timestamp has been called");
   
     SetForeign("SPY");
     TimeFrameSet(in1Minute);
     TimeStamptime = LastValue(TimeNum());
    _TRACE( "#Timestamp in function is" + timestamptime);
     TimeFrameRestore();
     RestorePriceArrays();
   
     return timestamptime;
}   
    _TRACE( "#Timestamp out of function is" + timestamp());

I did try
TIMESTAMPTIME = GetRTDataForeign( "Updatetime" ," SPY" );

but this gave me an empty/null answer from IB, and seems like a slow way of going about it.

From the notes for the foreign function in the AFL reference it seems that the foreign function synchronises the data with the currently selected symbol in the chart pane, hence timenum() returns timestamp synchronised to current symbol in chart pane.

What I'm chasing is a function I can call from the main program to basically get the market clock for trading times irrespective of what symbol or timeframe is in the chart pane window. I would prefer not to use the now() function as I would rather reference the exchange time not my computer time.


Any help would be much appreciated.
Cheers Brent




__._,_.___

Posted by: poo1971@yahoo.com.au
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.

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


.

__,_._,___


EmoticonEmoticon