Announcement

Collapse
No announcement yet.

missing most recent bars in study

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

  • missing most recent bars in study

    This study (shown below)works properly as written in an historical basis (going backward in time) . But the most recent bars DO NOT SHOW UP.
    Sometime this is for 5,6,7 bars and sometimes for 15 or more bars. What am I doing wrong ?
    Thanks in advance for your help.

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("MARC");
    setShowCursorLabel(false);
    }

    var vColor = null;

    function main() {
    if (getBarState() == BARSTATE_NEWBAR)
    vColor = null;

    var c = close();
    var c1 = close(-1);
    var o = open();
    var h = high();
    var h1 = high(-1);
    var h2 = high(-2);
    var h3 = high(-3);
    var h4 = high(-4);
    var h5 = high(-5);
    var h6 = high(-6);
    var h7 = high(-7);
    var h8 = high(-8);
    var h9 = high(-9);
    var h10 = high(-10);
    var l = low();
    var l1 = low(-1);
    var l2 = low(-2);
    var l3 = low(-3);
    var l4 = low(-4);
    var l5 = low(-5);
    var l6 = low(-6);
    var l7 = low(-7);
    var l8 = low(-8);
    var l9 = low(-9);
    var l10 = low(-10);

    if (c == null || c1 == null)
    return;

    if (c >= c1 && l <= l1 && l <= l2 && l <= l3 && l <= l4 && l <= l5 && l <= l6 && l <= l7 && l <= l8 && l <= l9 && l <= l10)
    vColor = Color.red;
    if (c <= c1 && h >= h1 && h >= h2 && h >= h3 && h >= h4 && h >= h5 && h >= h6 && h >= h7 && h >= h8 && h >= h9 && h >= h10)
    vColor = Color.red;

    if (vColor != null)
    setPriceBarColor(vColor);

    return;
    }

  • #2
    Re: missing most recent bars in study

    mjforex
    Whenever you use the setPriceBarColor() function you need to add in preMain a setColorPriceBars(true) statement and a setDefaultPriceBarColor() command to define a default color for the price bars when none of the conditions that paint the price bars are true (see the respective articles in the EFS KnowledgeBase for more information).
    If you do not specify a default price bar color the efs engine will paint the bar in white which on a white background will give the impression that no bars are being plotted (you can see this effect by setting the chart background to a light grey for example)
    Hope this helps
    Alex



    Originally posted by mjforex
    This study (shown below)works properly as written in an historical basis (going backward in time) . But the most recent bars DO NOT SHOW UP.
    Sometime this is for 5,6,7 bars and sometimes for 15 or more bars. What am I doing wrong ?
    Thanks in advance for your help.

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("MARC");
    setShowCursorLabel(false);
    }

    var vColor = null;

    function main() {
    if (getBarState() == BARSTATE_NEWBAR)
    vColor = null;

    var c = close();
    var c1 = close(-1);
    var o = open();
    var h = high();
    var h1 = high(-1);
    var h2 = high(-2);
    var h3 = high(-3);
    var h4 = high(-4);
    var h5 = high(-5);
    var h6 = high(-6);
    var h7 = high(-7);
    var h8 = high(-8);
    var h9 = high(-9);
    var h10 = high(-10);
    var l = low();
    var l1 = low(-1);
    var l2 = low(-2);
    var l3 = low(-3);
    var l4 = low(-4);
    var l5 = low(-5);
    var l6 = low(-6);
    var l7 = low(-7);
    var l8 = low(-8);
    var l9 = low(-9);
    var l10 = low(-10);

    if (c == null || c1 == null)
    return;

    if (c >= c1 && l <= l1 && l <= l2 && l <= l3 && l <= l4 && l <= l5 && l <= l6 && l <= l7 && l <= l8 && l <= l9 && l <= l10)
    vColor = Color.red;
    if (c <= c1 && h >= h1 && h >= h2 && h >= h3 && h >= h4 && h >= h5 && h >= h6 && h >= h7 && h >= h8 && h >= h9 && h >= h10)
    vColor = Color.red;

    if (vColor != null)
    setPriceBarColor(vColor);

    return;
    }

    Comment


    • #3
      Alexis,

      That seems to have done it.
      Thanks so much !

      Comment


      • #4
        mjforex
        You are most welcome
        Alex


        Originally posted by mjforex
        Alexis,

        That seems to have done it.
        Thanks so much !

        Comment

        Working...
        X