Announcement

Collapse
No announcement yet.

2007 Jun: How Effective are Rectangles, by Markos Katsanos

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

  • 2007 Jun: How Effective are Rectangles, by Markos Katsanos

    File Name: RectangleBO.efs

    Description:
    This study is based on the June 2007 article, How Effective are Rectangles, by Markos Katsanos.

    Formula Parameters:
    Color: blue
    Thickness: 2


    Notes:
    Instructions:
    The formula is a drawing tool that will draw the rectangle and calculate the predicted targets based on the algorithm provided in the article. Click on the "Draw Rectangle" button in the lower left corner of the chart. Then double click on the chart where the left side of the rectangle is to begin followed by a double click on the chart for the end of the rectangle period. The upper and lower bounds of the rectangle will then appear with a text label for the height of the rectangle. There will also be a line drawn at the target price level for both a long and short targets. To redraw the rectangle at a different location, click on the "Draw Rectangle" button and repeat the process. To remove the rectangle, click on the "Reset" button.

    1 - Click on Draw Rectangle
    2 - Double click on chart for beginnng of rectagle.
    3 - Double click on chart for end of rectangle.
    4 - Click Reset to remove the rectangle.

    The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com.

    Download File:
    RectangleBO.efs



    EFS Code:
    PHP Code:
    /***************************************
    Provided By : eSignal (c) Copyright 2007
    Description:  How Effective Are Rectangles?
                  by Markos Katsanos

    Version 1.0  4/11/2007

    Notes:
    * June 2007 Issue of Stocks and Commodities Magazine
    * Study requires version 8.0 or later.

    Instructions:
        1 - Click on Draw Rectangle
        2 - Double click on chart for beginnng of rectagle.
        3 - Double click on chart for end of rectangle.
        4 - Click Reset to remove the rectangle.
        

    Formula Parameters:                     Default:
    Color                                   blue
    Thickness                               2
    ****************************************/

    function preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("Rectangle Breakout ");
        
    setShowTitleParameters(false);
        
    setShowCursorLabel(false);    

        var 
    fp1 = new FunctionParameter("cColor"FunctionParameter.COLOR);
            
    fp1.setName("Color");
            
    fp1.setDefault(Color.blue);
        var 
    fp2 = new FunctionParameter("nThick"FunctionParameter.NUMBER);
            
    fp2.setName("Thickness");
            
    fp2.setDefault(2);
    }

    // Global Variables
    var bVersion  null;    // Version flag
    var bInit     false;   // Initialization flag
    var gColor    null;
    var 
    gThick    null;

    function 
    main(cColornThick) {
        if (
    bVersion == nullbVersion verify();
        if (
    bVersion == false) return;    

        
    //Initialization
        
    if (bInit == false && getCurrentBarIndex() == 0) {
            
    gColor cColor;
            
    gThick nThick;
            
    drawButtons();
            
    nA getGlobalValue("nA"+getInvokerID());
            
    nB getGlobalValue("nB"+getInvokerID());
            
    drawRectangle();
            
    bInit true;
        }

        
        return;
    }


    var 
    sLabel "Draw Rectangle";

    function 
    drawButtons() {
        
    drawTextRelative(520sLabel+"@URL=EFS:click"nullnull
            
    Text.RELATIVETOLEFT|Text.RELATIVETOBOTTOM|Text.BOLD|Text.LEFT|Text.BUTTON
            
    null12"button1");
        
    drawTextRelative(545"Reset@URL=EFS:reset"nullnull
            
    Text.RELATIVETOLEFT|Text.RELATIVETOBOTTOM|Text.BOLD|Text.LEFT|Text.BUTTON
            
    null12"button2");
        
        return;
    }

    function 
    reset() {
        
    removeLine("top");
        
    removeLine("bottom");
        
    removeLine("long");
        
    removeLine("short");
        
    removeText("h");
        
    removeText("Lt");
        
    removeText("St");
        
    nClick 0;
        
    sLabel "Draw Rectangle";
        
    drawButtons();
        
    nA null;
        
    nB null;
        
    setGlobalValue("nA"+getInvokerID(), nA);
        
    setGlobalValue("nB"+getInvokerID(), nB);
        
    Alert.playSound("pop.wav");
        
        return;
    }


    var 
    nClick 0;
    var 
    nA null;
    var 
    nB null;

    function 
    click() {
        if (
    nClick == 0nClick++;
        
        if (
    nClick == 1) {
            
    sLabel "Double Click Left Side";
            
    drawButtons();
        } 

        
    Alert.playSound("click.wav");
        
        return;
    }

    function 
    onLButtonDblClknBarIndexnYValue) {
        if (
    nClick == 1) {
            
    nA nBarIndex;
            
    nClick++;
            
    sLabel "Double Click Right Side";
            
    drawButtons();
        } else if (
    nClick == 2) {
            
    nB nBarIndex;
            
    nClick 0;
            
    sLabel "Draw Rectangle";
            
    drawButtons();
            
    drawRectangle();
            
    nA null;
            
    nB null;
        }
        
        
    //debugPrintln(nA + "   " + nB);
        
        
    return;
    }


    function 
    drawRectangle() {
        if (
    nA == null || nB == null) return;
        
        var 
    tempA nA;
        var 
    tempB nB;
        
        if (
    nB nA) {
            
    nA tempB;
            
    nB tempA;
        }
        
        if (
    nA 0nA 0;
        if (
    nB 0nB 0;
        
        
    setGlobalValue("nA"+getInvokerID(), nA);
        
    setGlobalValue("nB"+getInvokerID(), nB);

        var 
    nMax high(nA);
        var 
    nMin low(nA);
        
        var 
    Math.max(nAnB);
        var 
    end Math.min(nAnB);
        while (
    >= end) {
            
    nMax Math.max(high(i), nMax);
            
    nMin Math.min(low(i), nMin);
            
    i--;
        }
        
        var 
    len Math.max(20, (Math.abs(nA) - Math.abs(nB)) *5);
        var 
    nMax nMin;
        var 
    2.3 Math.pow(h0.8);

        
    drawTextRelative(nA, (nMax*1.01), "H = " +(h).toFixed(2), gColornullText.LEFT|Text.BOTTOM"Arial"12"h");
        
    drawLineRelative(nAnMaxnBnMaxPS_SOLIDgThickgColor"top");
        
    drawLineRelative(nAnMinnBnMinPS_SOLIDgThickgColor"bottom");

        
        
    drawTextRelative(nBnMax+b"Target = " +(nMax+b).toFixed(2), gColornullText.RIGHT|Text.VCENTER"Arial"12"Lt");
        
    drawLineRelative(nBnMax+bnB+lennMax+bPS_SOLIDgThickgColor"long");
        
    drawLineRelative(nBnMin-bnB+lennMin-bPS_SOLIDgThickgColor"short");
        
    drawTextRelative(nBnMin-b"Target = " +(nMax-b).toFixed(2), gColornullText.RIGHT|Text.VCENTER"Arial"12"St");
        
        return;
    }

    function 
    verify() {
        var 
    false;
        if (
    getBuildNumber() < 779) {
            
    drawTextAbsolute(535"This study requires version 8.0 or later."
                
    Color.whiteColor.blueText.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
                
    null13"error");
            
    drawTextAbsolute(520"Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp"
                
    Color.whiteColor.blueText.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
                
    null13"upgrade");
            return 
    b;
        } else {
            
    true;
        }
        
        return 
    b;

    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
Working...
X