Announcement

Collapse
No announcement yet.

Should results between methods not match?

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

  • Should results between methods not match?

    I was having problems matching results between playback and using an efsInternal study (two different scripts) ... Wrote the following script to check out close() every minute in both playback and historical. Loaded on the EUR 60 min and downloaded 1 day of last weeks tics to check one candle's prices. Image shows the two println results and the obvious differences, although in some cases they are close. Is my understanding of efsInternal out to lunch or am i coding incorrectly?

    function preMain() {
    setPriceStudy(true);
    setShowTitleParameters(false);
    setIntervalsBackfill(true);
    }

    var bInit;
    var oMin = null;
    var MySeries;
    var gMinute;
    var gSecond;

    function main() {

    if (!bInit && getSymbol() != "$PLAYBACK") {
    if (!MySeries) {
    MySeries = efsInternal("Inter", inv("1"));
    }
    daySeries = getSeries(MySeries, 0);
    hourSeries = getSeries(MySeries, 1);
    minuteSeries = getSeries(MySeries, 2);
    secondSeries = getSeries(MySeries, 3);
    closeSeries = getSeries(MySeries, 4);
    bInit = true;
    }
    if(getSymbol() == "$PLAYBACK"){
    gMinute = minute(0,inv("1"));
    gSecond = second(0,inv("5s"));

    if(getMonth(0) == 4 && day(0) == 9 && hour(0) == 9){
    if(oMin != gMinute){
    debugPrintln("At " + hour(0) + ":" + gMinute + ":" + gSecond + ", close() is " + close() + "\n");
    oMin = gMinute;
    }
    }
    }

    if (getBarState() === BARSTATE_NEWBAR) {
    if(getMonth(0) == 4 && day(0) == 9 && hour(0) == 9){
    if(getSymbol() != "$PLAYBACK"){
    n = 59;
    while(n >= 0){
    var day1 = daySeries.getValue(-n);
    var hour1 = hourSeries.getValue(-n);
    var minute1 = minuteSeries.getValue(-n);
    var second1 = secondSeries.getValue(-n);
    var close1 = closeSeries.getValue(-n);

    if(oMin != minute1){
    debugPrintln("At " + hour1 + ":" + minute1 + ":" + second1 + ", close() is " + close1 + "\n");
    oMin = minute1;
    }
    n--;
    }
    }
    }
    }
    }

    function Inter() {
    return [day(0), hour(0), minute(0), second(0), close(0)];
    }




    any thoughts would be greatly appreciated,
    Chris
    Attached Files
Working...
X