Announcement

Collapse
No announcement yet.

forex, time zone & getFirstBarIndexOfDay()

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • forex, time zone & getFirstBarIndexOfDay()

    note: i am not sure which forum i should place this post of mine. and i am not sure whether this is actually a data matter or programming matter. therefore, if anybody knows whichever the forum is the most appropriate place for this post, please forward this to there.


    according to my broker, a new calendar trading day for forex start at 5pm (or 5:15pm) ny time. meaning,
    a monday session of forex trading should begin at 5pm sunday of ny time,
    and a friday session of forex trading should ends at 5pm friday of ny time, and unfortunately, i have no idea which local exchange forex belongs to.
    and this is a reminder for those who are working on the time zone issue in the next esignal release. this is because my getFirstBarIndexOfDay() never works correctly for any of my forex data.

    thanks.

  • #2
    dietcoke2000
    For information on Forex data in eSignal (including the start/end times used for the trading session) you may want to see this article in the eSignal KnowledgeBase
    As to the function getFirstBarIndexOfDay() that will return the first bar index of a day ie the index of the first bar where a change of date occurred and not the first bar index of a trading session (which with Forex and many futures will occurr on the prior day).
    If you want to determine the first bar of a session you will need to write that logic yourself. To do this you need to check for the first bar at [or after] the specified time and retrieve its corresponding bar count value using the function getCurrentBarCount().
    PHP Code:
    if(myTime==true){//here use your own method to determine the bar time
        
    myBarIndex getCurrentBarCount();

    Then to determine the bar index of that bar all you need to do is subtract the current bar count value [using again the getCurrentBarCount() function] from the one you saved
    PHP Code:
    var myFirstBarOfSession myBarIndex getCurrentBarCount(); 
    This will return the bar index of the first bar that met your criteria.
    In the enclosed screenshot where I am using a script based on the logic described above you can see that at 05:00 on a 60 minute chart the bar index of the bar time stamped 17:00 is -12. If I used the getFirstBarIndexOfDay() function the returned value would instead be -5 as that is the first bar on which a change of date occurred.
    Alex



    Originally posted by dietcoke2000
    note: i am not sure which forum i should place this post of mine. and i am not sure whether this is actually a data matter or programming matter. therefore, if anybody knows whichever the forum is the most appropriate place for this post, please forward this to there.


    according to my broker, a new calendar trading day for forex start at 5pm (or 5:15pm) ny time. meaning,
    a monday session of forex trading should begin at 5pm sunday of ny time,
    and a friday session of forex trading should ends at 5pm friday of ny time, and unfortunately, i have no idea which local exchange forex belongs to.
    and this is a reminder for those who are working on the time zone issue in the next esignal release. this is because my getFirstBarIndexOfDay() never works correctly for any of my forex data.

    thanks.

    Comment

    Working...
    X