Announcement

Collapse
No announcement yet.

Vertical time lines

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Vertical time lines

    hello,
    I am trying to get this efs study to work have tried everything

    I am wanting vertical lines for selected time plots ie; 4am, 930am, 935am, 940am, 1130am, 1pm

    It keep returning error line 57 1,

    I am using eSignal 12 latest release 2016


    var vLastAlert = -1;


    function preMain() {

    setPriceStudy(true);
    setStudyTitle("Time Lines");

    }

    function main() {

    if (
    (hour(0)*100)+minute(0) == 400

    ) onAction1();

    if (
    (hour(0)*100)+minute(0) == 930

    ) onAction2();

    if (
    (hour(0)*100)+minute(0) == 935

    ) onAction3();

    if (
    (hour(0)*100)+minute(0) == 940

    ) onAction4();

    if (
    (hour(0)*100)+minute(0) == 1130

    ) onAction5();

    if (
    (hour(0)*100)+minute(0) == 1600

    ) onAction6();

    return null;

    }

    function postMain() {

    }

    function onAction1() {
    drawLineRelative(0, 0, 0, 999999, PS_DOT, 1, Color.aqua, "line"+rawtime(0));
    vLastAlert = 1;
    }
    function onAction2() {
    drawLineRelative(0, 0, 0, 999999, PS_DOT, 1, Color.paleyellow, "line"+rawtime(0));
    vLastAlert = 2;
    }
    function onAction3() {
    drawLineRelative(0, 0, 0, 999999, PS_DOT, 1, Color.lightgrey, "line"+rawtime(0));
    vLastAlert = 3;
    }
    function onAction1() {
    drawLineRelative(0, 0, 0, 999999, PS_DOT, 1, Color.lightgrey, "line"+rawtime(0));
    vLastAlert = 4;
    }
    function onAction2() {
    drawLineRelative(0, 0, 0, 999999, PS_DOT, 1, Color.lightgrey, "line"+rawtime(0));
    vLastAlert = 5;
    }
    function onAction3() {
    drawLineRelative(0, 0, 0, 999999, PS_DOT, 1, Color.red, "line"+rawtime(0));
    vLastAlert = 6;
    }

  • #2
    NTSE
    In lines 31, 36 and 41 you are calling the functions onAction4(), onAction5() and onAction6() however those functions do not exist, hence the error(s)
    What I do see is that in lines 63, 67 and 71 you have three duplicate functions named onAction1(), onAction2() and onAction3() that you probably copied and pasted without actually renaming them appropriately as onAction4(), onAction5() and onAction6().
    Once you resolve that the script will work
    Alex


    Originally posted by NYSE View Post
    hello,
    I am trying to get this efs study to work have tried everything

    I am wanting vertical lines for selected time plots ie; 4am, 930am, 935am, 940am, 1130am, 1pm

    It keep returning error line 57 1,

    I am using eSignal 12 latest release 2016


    var vLastAlert = -1;


    function preMain() {

    setPriceStudy(true);
    setStudyTitle("Time Lines");

    }

    function main() {

    if (
    (hour(0)*100)+minute(0) == 400

    ) onAction1();

    if (
    (hour(0)*100)+minute(0) == 930

    ) onAction2();

    if (
    (hour(0)*100)+minute(0) == 935

    ) onAction3();

    if (
    (hour(0)*100)+minute(0) == 940

    ) onAction4();

    if (
    (hour(0)*100)+minute(0) == 1130

    ) onAction5();

    if (
    (hour(0)*100)+minute(0) == 1600

    ) onAction6();

    return null;

    }

    function postMain() {

    }

    function onAction1() {
    drawLineRelative(0, 0, 0, 999999, PS_DOT, 1, Color.aqua, "line"+rawtime(0));
    vLastAlert = 1;
    }
    function onAction2() {
    drawLineRelative(0, 0, 0, 999999, PS_DOT, 1, Color.paleyellow, "line"+rawtime(0));
    vLastAlert = 2;
    }
    function onAction3() {
    drawLineRelative(0, 0, 0, 999999, PS_DOT, 1, Color.lightgrey, "line"+rawtime(0));
    vLastAlert = 3;
    }
    function onAction1() {
    drawLineRelative(0, 0, 0, 999999, PS_DOT, 1, Color.lightgrey, "line"+rawtime(0));
    vLastAlert = 4;
    }
    function onAction2() {
    drawLineRelative(0, 0, 0, 999999, PS_DOT, 1, Color.lightgrey, "line"+rawtime(0));
    vLastAlert = 5;
    }
    function onAction3() {
    drawLineRelative(0, 0, 0, 999999, PS_DOT, 1, Color.red, "line"+rawtime(0));
    vLastAlert = 6;
    }

    Comment


    • #3
      Originally posted by ACM View Post
      NTSE
      In lines 31, 36 and 41 you are calling the functions onAction4(), onAction5() and onAction6() however those functions do not exist, hence the error(s)
      What I do see is that in lines 63, 67 and 71 you have three duplicate functions named onAction1(), onAction2() and onAction3() that you probably copied and pasted without actually renaming them appropriately as onAction4(), onAction5() and onAction6().
      Once you resolve that the script will work
      Alex
      Thank you Alex that fixed it, however..

      It doesnt seem to recognize the 4am premarket time frame only from 930 on
      Last edited by NYSE; 08-04-2016, 03:49 PM.

      Comment


      • #4
        NYSE
        You already have the script and you can edit it as follows:
        In line 63 replace
        function onAction1() {
        with
        function onAction4() {
        In line 67 replace
        function onAction2() {
        with
        function onAction5() {
        and in line 71 replace
        function onAction3() {
        with
        function onAction6() {
        Alex


        Originally posted by NYSE View Post
        Thank you Alex would you mind posting the code in correct format so I can upload it?

        Also it doesnt seem recognize 4am time frame only from 930 on

        Comment


        • #5
          Thank you did that.

          However it does not post a line for 400 or 4am time frame only from 930 on

          Comment


          • #6
            Example missing 4 am time line, weird..



            Click image for larger version

Name:	Capture22.PNG
Views:	1
Size:	83.1 KB
ID:	243017

            Comment


            • #7
              NYSE
              As far as I can see it is drawing a line at 04:00 - assuming there is a bar time stamped as such - as you can see in the image enclosed below (note that I changed both the style and thickness of the lines so as to make them more visible)
              Alex




              Originally posted by NYSE View Post
              Thank you did that.

              However it does not post a line for 400 or 4am time frame only from 930 on

              Comment


              • #8
                Thank you yes my chart isnt showing a bar time stamp at 4am so that makes sense why.

                In regards to changing the colors and thickness of the lines, is there a code I can add to make it more customizable within the normal controls for example:

                Click image for larger version

Name:	Screenshot (3).png
Views:	1
Size:	13.9 KB
ID:	243018

                Comment


                • #9
                  NYSE
                  In order to accomplish that you would need to add a FunctionParameter for each item that you want to be able to edit
                  For information on the FunctionParameter object and examples of its use you may want to review this article in the EFS KnowledgeBase
                  Alex


                  Originally posted by NYSE View Post
                  Thank you yes my chart isnt showing a bar time stamp at 4am so that makes sense why.

                  In regards to changing the colors and thickness of the lines, is there a code I can add to make it more customizable within the normal controls for example:

                  [ATTACH=CONFIG]16848[/ATTACH]

                  Comment


                  • #10
                    Ok. Thank you so much for all your help Alex.

                    Comment


                    • #11
                      NYSE
                      You are welcome
                      FWIW if you are unfamiliar with programming in EFS I you may want to take some time to learn about it.
                      To this effect I would suggest that you review the JavaScript for EFS videos and the Core JavaScript Reference Guide. Those will provide you with a thorough introduction to programming in JavaScript which is at the foundation of EFS. Then go through the EFS KnowledgeBase and study the Help Guides and Tutorials which will provide you with the specifics of EFS. Also search the forums as they are an invaluable resource in as much as many of the things you may be trying to do may have already been discussed before
                      Alex


                      Originally posted by NYSE View Post
                      Ok. Thank you so much for all your help Alex.

                      Comment

                      Working...
                      X