Announcement

Collapse
No announcement yet.

Logical operator, drawing question (Newby)

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

  • Logical operator, drawing question (Newby)

    Hello

    Could someone please explain to me on the attached code:

    1.) The box drawn on line 42 does not appear on the chart immediately when the EFS is loaded but sometimes after the third or fourth bar sometimes not.
    I thought that this line should be executed immediately on loading the efs?
    For an action like this that I only want to be executed once, is there a more efficient way to "call" it or does the current way not place additional strain on resources as it would seem to me to be "called" every tic?

    2.) If I change a function parameter on this EFS, eSignal freezes for 5.5seconds (despite this being a Dual Core with 3 g of ram). Presumably there is some code causing this issue; could you give me an idea what it could be?

    3.) Can I call a drawing function outside of main() as per lines 65 and 77? The butons are not being drawn and I cannot see why.

    Thanks in anticipation

    [code]

    function preMain() {
    setStudyTitle("IB Trade");
    setPriceStudy(true);
    setShowCursorLabel(false);

    // default parameters

    var fp0 = new FunctionParameter("PSL", FunctionParameter.NUMBER);
    fp0.setName("PSL");
    //fp0.setLowerLimit(1);
    fp0.setDefault(20);

    var fp1 = new FunctionParameter("Risk", FunctionParameter.NUMBER);
    fp1.setName("Risk");
    fp1.setDefault(1500);


    var nSize


    }
    function main(PSL,Risk){


    var bLong = false
    var nLast = close()
    var nAsk = getMostRecentAsk()
    var nBid = getMostRecentAsk()
    var nRiskC = (nLast - PSL)


    //Draw the PSL line

    drawLineAbsolute(-40, PSL, 20, PSL, PS_SOLID, 2,Color.red,105 );



    //Draw the box for the buttons

    drawTextAbsolute(5, 15, " ",
    Color.black, Color.lightgrey,
    Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM | Text.FRAME | Text.BOLD | Text.CENTER,
    "Arial", 60, "border");

    // Draw Edit parameter button

    drawTextAbsolute(5, 17, "Parameters @URL=EFS:editParameters", Color.black, Color.grey,
    Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM | Text.ONTOP | Text.CENTER,
    "Arial", 10, "msg");



    //Specify long trade: true or false


    if(nLast > PSL) {
    bLong = true
    }
    debugPrintln("This is a long trade? " +bLong)


    if(bLong) {
    DrawBuy();
    } else {

    DrawSell();
    }
    }
    // Button to change parameters
    function editParameters(nButtonPressed){
    if(nButtonPressed == BUTTON_RIGHT) nClick++;
    askForInput("Trading Parameters")
    }

    function DrawBuy(){
    drawTextAbsolute(5, 49, " Buy @URL=EFS:BuyCallBack",
    Color.white, Color.green,
    Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM | Text.FRAME | Text.ONTOP | Text.BOLD | Text.CENTER,
    "Arial", 12, "OB");
    }

    function DrawSell(){
    drawTextAbsolute(5, 29, " Sell @URL=EFS:SellCallBack",
    Color.white, Color.red,
    Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM | Text.FRAME | Text.ONTOP | Text.BOLD | Text.CENTER,
    "Arial", 12, "OS");
    }
    [/code ]

  • #2
    I have just noticed that if I drag the chart to the left across the space where five bars would form, the box appears .??

    Any suggestions?

    Comment


    • #3
      Patch227
      What version of eSignal are you running?
      Alex


      Originally posted by Patch227
      I have just noticed that if I drag the chart to the left across the space where five bars would form, the box appears .??

      Any suggestions?

      Comment


      • #4
        Hi Alexis

        10.0.0 (build 858) 08/22/2007

        Comment


        • #5
          Patch227
          What you are seeing is caused by a known issue in eSignal 10 with the Text.RELATIVETOLEFT flag used in the drawTextXxx() functions. As I understand it this is slated to be fixed in a maintenance release due sometime in the near future.
          In the mean time see this thread for a workaround.
          Alex

          Comment


          • #6
            Thanks for that information Alexis.

            I appreciate it


            Originally posted by Alexis C. Montenegro
            Patch227
            What you are seeing is caused by a known issue in eSignal 10 with the Text.RELATIVETOLEFT flag used in the drawTextXxx() functions. As I understand it this is slated to be fixed in a maintenance release due sometime in the near future.
            In the mean time see this thread for a workaround.
            Alex

            Comment


            • #7
              Patch227
              My pleasure
              Alex


              Originally posted by Patch227
              Thanks for that information Alexis.

              I appreciate it

              Comment

              Working...
              X