Announcement

Collapse
No announcement yet.

Get bar problem

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

  • Get bar problem

    i got this problem every time plot this formula The TRIN indicator start 19 bars late (5m chart), also the same problem in any other time frame.
    part of the formulla formula:

    function main() {
    var f = call("/Downloads/VIDYA.efs");
    var Slow_MA = MASlow.getValue(MAStudy.MA);

    var nTrinLong = 1.40; // Habilita Long bajo esto
    var nTrinShort = 0.70; // Habilita Short por sobre esto
    var marcotiempo = "1" // Intervalo de la Carta

    var nBarState = getBarState();
    if (nBarState == BARSTATE_ALLBARS){
    vSymbol = "$TRIN," + marcotiempo ;
    }

    if ( f == null || Slow_MA == null)
    return;

    var nTRIN = close(0, 1, vSymbol);
    if (nTRIN == null)
    return;

    //* var nBarState2 = getBarState();
    //* if (nBarState2 == BARSTATE_ALLBARS){
    //* vSymbol2 = "$TICK,1";
    //* } *//


    // var nTICK = close(0, 1, "$TICK,5");
    // if (nTICK == null)
    // return;


    var vtime = getValue("Time");
    if (vtime == null)
    return;
    var tag1 = 60 * vtime.getHours() + vtime.getMinutes();
    if(tag1 >= 720 && tag1 <= 810) {
    tag2 = 1;
    } else tag2 =0;


    any ideas?

    best regards
    Attached Files

  • #2
    Hello juano,

    Some of your code was missing in your post. I'm assuming that your MASlow study was created with an 18 for length.

    var MASlow = new MAStudy(18, 0, "Close", MAStudy.Simple);

    Your MAStudy requires 18 bars before we can calculate a valid 18 period moving average. The 18th bar is the first bar with a valid 18 period moving average. That's why your indicator doesn't start until that bar.
    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #3
      Hello Jason,

      Thanks, you are rigt mA length=18 i got the ma problem an also vidya. (could you see the attach file) i wonder if i fix that, the TRIN delay is gonna get fix too. if not could you lend me a hand to do it right.

      Best Regards

      Comment


      • #4
        I would add a line

        debugPrintln(vtime.getHours()+" " + vtime.getMinutes());

        just before

        var tag1 = 60 * vtime.getHours() + vtime.getMinutes();

        and see what time the computer thinks it is.

        Comment


        • #5
          Thanks, you are rigt mA length=18 i got the ma problem an also vidya. (could you see the attach file) i wonder if i fix that, the TRIN delay is gonna get fix too. if not could you lend me a hand to do it right.
          This is the problem.

          f ( f == null || Slow_MA == null)
          return;

          Until your study has enough data to produce a value it will produce a null. One thing you could do that is an easy work around...load more bars (ie: if you want to test 5 days of data, instead load 5 days + 19 bars of data (call it 6 days to make it easy)).

          You could also fix your code so that it doesn't try to work with anything but TRIN until after these studies start to return values:

          if (f == null || Slow_MA == null){
          <Put all of your MA and VIDYA code here>
          }

          <Put your TRIN code here>
          Garth

          Comment


          • #6
            Hi juano,

            I saw the .png file. Please post your entire formula so we can take a look.

            Thanks,
            Jason K.
            Project Manager
            eSignal - an Interactive Data company

            EFS KnowledgeBase
            JavaScript for EFS Video Series
            EFS Beginner Tutorial Series
            EFS Glossary
            Custom EFS Development Policy

            New User Orientation

            Comment


            • #7
              TRIN data problem

              I have had a similar problem with TRIN data when coding some strategies.

              It seems to me that the origin of the problem is that some TRIN intraday data is missing and if, for example, you have a 1 min advchart with TRIN and you check carefully all the bars, probably you will find that one or more bars are not present ( for example : the 12:35 bar exists, the 12:36 bar exists and the next one is 12:38).

              When working with ES chart (where there are no missing bars) and trying to capture TRIN data through getvalue.... , there is perfect correspondence until we reach the missing TRIN data. If for example there are 2 minutes of NO TRIN data, then ES bar and TRIN bars are out of phase in 2 minutes. This problem is cumulative, depending the number of bars you are using and depending of the "holes" in TRIN date found.

              Is there any way to fix this problem or to check the "time" correspondance of each bar, and if some data is missing, then to use the previous bar data to be always in phase ?

              Thanks in advance

              Comment


              • #8
                Hey Mauro

                I checked yesterday (01/10) 1 min chart for TRIN and I found that there are missing bars !!! For example at 14:24 and 14:29

                This will put the strategy out of sync !!!

                How can we fix this ?

                Comment


                • #9
                  As stated below, I suspect (but don't know for sure) that this problem is related to the "night session" bug, where no change in OHLC or V data will cause eSignal to have bars get out of synch.

                  If you consider the low volatility associated with TRIN, combined with the short interval you are using for TRIN, this may account for the bug.

                  My guess is if you changed this to a 5 minute chart and a 5 minute TRIN you will not see this problem (or even a three minute, should work). I have a TRIN based formula that works flawlessly, but I don't do work on charts of less that 5 minutes, and usually not on charts of less than 15.

                  As suggested previously, it might help to post up the entire code so we can make sure there are not other issues.
                  Garth

                  Comment

                  Working...
                  X