easylanguage: date and time management

Discussion in 'Programming' started by eros1973ms, Oct 25, 2011.

  1. Hi all,

    I am new to this forum, glad to contribute with my little experience (tradestation).
    I have re-written the DeMark indicators for Tradestation, after reading the book, this way I can say I have understood all the aspects that would be not considered if I got the indicators already programmed.
    Now I am trying to make some helpful adjustments, creating a square on the chart with some information about indicator counting.
    What I am trying to do is to place this square dynamically on the chart, in a way that when resizing or moving it, it remain always visible.
    I understood that the information I need are the one collected with getappinfo(aiLeftDispDateTime), but I have to extracte date and time separatly in order to use them in text_new(date, time, price, text) function.
    Do you have any idea?
    Maybe the date can be obtained with datetojulian(getappinfo(aiLeftDispDateTime)), but what about the time?

    thanks a lot
  2. Eros:

    I just happened to run across your post. I am learning this in TradeStation Easy Language myself.

    I think you are on the right track. But the function to use is not datetojulian but the other way around: juliantodate.

    The TradeStation date (e.g. 2111030) can be obtained by:

    DateStr = NumToStr(juliantodate(getappinfo(aiLeftDispDateTime), 0);

    As for the TradeStation time, I did it a clumpsy way. I am not sure if there is a more efficient way to do it (would love to learn): (e.g. 1245)

    TimeStr = NumToStr(HoursFromDateTime(getappinfo(aiLeftDispDateTime)), 0) +
    NumToStr (MinutesFromDateTime(getappinfo(aiLeftDispDateTime)), 0);

    Where both DateStr and TimeStr are declared as string variables.
  3. Correction: missing one parenthesis:

    DateStr = NumToStr(juliantodate(getappinfo(aiLeftDispDateTime)), 0);