Announcement

Collapse
No announcement yet.

SystemHappyFace, drawShape

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

  • SystemHappyFace, drawShape

    Hello all,
    In the following function, I have 2 problems:
    1. debug says "SystemHappyFace not defined". so i put a var SystemHappyFace stmt in the function. It stopped complaining but nothing draws.
    2. nothing draws with the drawShapeRelative stmt either.
    I know it's executing the function because the debugPrintln is printing all the appropriate bars.
    Do I need to initialize something? or define where the images are?
    Thanks in advance,
    phil


    function funcTrade(trade, i,bar) {
    debugPrintln("[funcTrade] " + trade + ": "+i+" bar="+bar);
    //drawImageRelative(xBar, yValue, Image, Url, Flags, TagName);
    drawImageRelative(0, low() - vVar, SystemHappyFace, "", Image.BOTTOM, "buyShp" + getValue("time"));
    drawShapeRelative(0, low() - 1, Shape.UPARROW, null, Color.green, Shape.ONTOP, getValue("rawtime") + "B");
    }

  • #2
    correction

    please use this:

    function funcTrade(trade, i,bar) {
    debugPrintln("[funcTrade] " + trade + ": "+i+" bar="+bar);
    //drawImageRelative(xBar, yValue, Image, Url, Flags, TagName);
    drawImageRelative(0, low() - 1, SystemHappyFace, "", Image.BOTTOM, "buyShp" + getValue("time"));
    drawShapeRelative(0, low() - 1, Shape.UPARROW, null, Color.green, Shape.ONTOP, getValue("rawtime") + "B");
    }

    Comment


    • #3
      http://forum.esignalcentral.com/show...wImageRelative toward the bottom

      will help, but I suspect you need to add the TAG variable to the end of the definition, something like

      bartag=bartag+1
      drawImageRelative(0, low() - vVar, SystemHappyFace, "", Image.BOTTOM, "buyShp" + getValue("time"),bartag);

      Comment


      • #4
        I believe my stmts had tags:

        drawImageRelative(0, low() - 1, SystemHappyFace, "", Image.BOTTOM, "buyShp" + getValue("time"));
        drawShapeRelative(0, low() - 1, Shape.UPARROW, null, Color.green, Shape.ONTOP, getValue("rawtime") + "B");

        I also cut/pasted your stmt anyway, with small modifications and it also didn't draw anything.

        I also cut/pased the stmt from the url and it also didn't draw anything.

        BTW, I am installed into the D drive, not C: where my system folder is. I'm wondering if that is part of the problem.



        final code used:

        function funcTrade(trade, i,bar) {
        var SystemHappyFace;
        var vHL = high() - low();
        var vVar = vHL * 0.25;
        debugPrintln("[funcTrade] " + trade + ": "+i+" bar="+bar);

        //drawImageRelative(xBar, yValue, Image, Url, Flags, TagName);
        //drawImageRelative(0, low() - 1, SystemHappyFace, "", Image.BOTTOM, "buyShp" + getValue("time"));

        // x, y, shape, url, color, flags, tag name
        drawShapeRelative(0, low() - 1, Shape.UPARROW, null, Color.green, Shape.ONTOP, getValue("rawtime") + "B");
        drawShapeRelative(0, low() - 1, Shape.DIAMOND, "", Color.blue, Shape.RELATIVETOBOTTOM, "NewDay" + getValue("time"));
        drawImageRelative(0, low() - 1, SystemHappyFace, "", Image.BOTTOM, "buyShp" + getValue("time"),bar);
        }

        Comment


        • #5
          This

          //{{EFSWizard_Description
          //
          // This formula was generated by the Alert Wizard
          //
          //}}EFSWizard_Description 7532


          //{{EFSWizard_Declarations

          var vLastAlert = -1;
          var bar=0;

          //}}EFSWizard_Declarations 2482


          function preMain() {
          /**
          * This function is called only once, before any of the bars are loaded.
          * Place any study or EFS configuration commands here.
          */
          //{{EFSWizard_PreMain
          setPriceStudy(true);
          setStudyTitle("happyF");
          //}}EFSWizard_PreMain 6643

          }

          function main() {
          /**
          * The main() function is called once per bar on all previous bars, once per
          * each incoming completed bar, and if you don't have 'setComputeOnClose(true)'
          * in your preMain(), it is also called on every tick.
          */

          //{{EFSWizard_Expressions
          //{{EFSWizard_Expression_1
          if (
          2 < 5
          ) onAction1();
          //}}EFSWizard_Expression_1 4308

          //}}EFSWizard_Expressions 16125


          //{{EFSWizard_Return
          return null;
          //}}EFSWizard_Return 2256

          }

          function postMain() {
          /**
          * The postMain() function is called only once, when the EFS is no longer used for
          * the current symbol (ie, symbol change, chart closing, or application shutdown).
          */
          }

          //{{EFSWizard_Actions
          //{{EFSWizard_Action_1
          function onAction1() {
          //drawShapeRelative(0, low(), Shape.CIRCLE, "", Color.RGB(155,0,0), Shape.LEFT);
          vLastAlert = 1;
          bar=bar+1;
          //setBarImage(SystemLightOn);
          drawImageRelative(0, low() , "SystemHappyFace", null, Image.ONTOP, "buy image" + bar);
          //drawImageRelative(0, low() - 1, SystemHappyFace, "", Image.BOTTOM, "buyShp" + getValue("time"),bar);

          }
          //}}EFSWizard_Action_1 15331

          //}}EFSWizard_Actions 25225


          draws this
          Attached Files

          Comment


          • #6
            Thanks.
            I took the wizard output and ran it and sure enough it works.

            What I found with my code:

            1. SystemHappyFace has to be in quotes
            2. Shape.RELATIVETOBOTTOM changed to Shape.ONTOP worked.
            3. the first one worked without change. I probably missed it.

            original code:
            drawShapeRelative(0, low() - 1, Shape.UPARROW, null, Color.green, Shape.ONTOP, getValue("rawtime") + "B");
            drawShapeRelative(0, low() - 1, Shape.DIAMOND, "", Color.blue, Shape.RELATIVETOBOTTOM, "NewDay" + getValue("time"));
            drawImageRelative(0, low() - 1, SystemHappyFace, "", Image.BOTTOM, "buyShp" + getValue("time"),bar);

            Anyways, all ok. Thanks.

            Comment

            Working...
            X