Announcement

Collapse
No announcement yet.

closing value from user specified date

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

  • closing value from user specified date

    How can I call the closing value from the next trading day at a user specific date?

    The user specific input value should be the date, so that eSignal can calculate the rate of change from a trade, opend one day after the specified date.

    Thanks for help.

  • #2
    solution...

    Well, the way I would accomplish this is as follows...

    store the date of the current bar as mmddyy as a number...

    var tradedate = (month*10000)+(day*100)+year;

    would equal 21605 (for today).

    Now, you would simply want to calculate the date for each bar and check for ...

    if ((todaysdate > tradedate) && (tradedate != null)) {
    // one day after close ==
    tomorrowsclose = close();
    tradedate = null;
    }

    now, this is a process for running in backtest mode. Obviously, we don't know tomorrows close in realtime (if we did, then we would all be rich).

    To use these examples, you will want to use date functions - I've included some examples.. You have to declare the variables (globally) as follows...

    var vHour;
    var vMin;
    var vSec;
    var vDay;
    var vMonth;
    var vYear;
    var vTime = new Date();

    then use this in your code.. main()

    //--[ calc time/date variables ]-------------------------------------------------
    vTime = getValue("Time", 0);
    vHour = vTime.getHours();
    vMin = vTime.getMinutes();
    vSec = vTime.getSeconds();
    vDay = vTime.getDate();
    vMonth = vTime.getMonth() +1;
    vYear = vTime.getYear();
    var nMinTime = ((vHour*60)+vMin);
    var nDate = ((vMonth*100)+vDay);

    year is reported as 105 (for 2005). This is accomplished as (1900+105 = 2005).

    I simply subtract 100 from the year to get a 2 digit year value.

    Hope this helps..

    B
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Could You please give me a short example to build this in an efs please?

      For example: plot a horizontal line in the price chart at next day close following the date the user can enter by hand.

      Thank You.

      Comment

      Working...
      X