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

 

Hello Gabor thank you for taking the time to reply, I really appreciate it.

You can't access data from a lower timeframe, only higher. So, running someting on the 5-min, you can compress that to get the 15-min or daily data but you can't get access to 1-min, even if the db base timeframe is 1-min.

I didn't know this, I guessed you couldn't go a lower timeframe than the db base timeframe though.

To overcome this, you need to run exploration on a 1-min and store what you need in a StaticVar, which then can be accessed at a higher timeframe.

My real time program is running in a separate chart pane, not in the analysis/exploration window.

You may also opt for chart refresh, if you keep a 1-min chart open and add this to its code:
if(Interval() == in1Minute) {
//SetBarsRequired(-2, -2);
RequestTimedRefresh(in1Minute, False);
}

I did insert the above request timed refresh coding in my function as below


function timestamp()
{
      _TRACE( "#Function Timestamp has been called");
    if(!(Interval() == in1Minute))
       {
       
         SetForeign("SPY");
         RequestTimedRefresh(in1Minute, False);
         SetBarsRequired(-2, -2);
         TimeFrameSet(in1Minute);
         TimeStamptime = LastValue(TimeNum());
         _TRACE( "#Timestamp in function is" + timestamptime);
         TimeFrameRestore();
         RestorePriceArrays();
         }
   
     return timestamptime;
}   
    _TRACE( "#Timestamp out of function is" + timestamp());


 It worked fine as long as I set the timeframe of the chart window to be one-minute. As soon as I changed the chart timeframe to say, 1hr the code came up with an error because the if statement being false it skips the rest of the code inside the braces and comes up with a undefined variable timestamp () in the trace statement.

I guess I have two problems that I really should be split up.

1) My main problem is the function does not access the timestamp from the set foreign ticker "spy". LastValue(TimeNum()); just returns the timestamp of ticker in the chart pane window.

2) The second problem (not so critical) is the command "TimeFrameSet(in1Minute);" does not seem to override the timeframe that has been set in the chart pane window.

I know there will be away to get it done because amibroker is bloody awesome! I haven't come across something that AFL can't do yet, there is always a way...

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 (3)

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