Announcement

Collapse
No announcement yet.

Allowing Charts to load faster

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

  • Allowing Charts to load faster

    If you are like me and have a multitude of charts with a multitude of studies within each one, it takes an age for everything to get up and running on first loading, and then when you want to change anything or switch to another interval or symbol on a chart then you have to wait an age also and you go through the same long winded process when selecting another layout.

    I have done my best to use every trick in the book (my book anyway) to improve system design, coding practice and formula methodology, but in the end you will come to a point where there is nothing more you can do in this area. However I came up with a neat fix which may not detract too much from the data being displayed (except in the case of iterated computations such as those found in EMAs, however even then the differences based on the number of bars to be displayed is within reason).

    /************
    Before preMain
    ************/

    // Used in preMain() for user selection
    var aPArrG = new Array();

    // Bar Counter
    var nBrCntrG= 0;

    /*************
    Add to preMain:-
    ************/
    // =========================
    function preMain(){
    // --------------------------------------------

    // VARIABLES
    var k;

    // USER SELECTION
    k = 0;

    aPArrG[k] = new FunctionParameter( "bCutOffP", FunctionParameter.STRING);
    with( aPArrG[k] ) {
    addOption("T");
    addOption("F");
    setDefault("F"); // set to "T" as default
    }
    k++;

    aPArrG[k] = new FunctionParameter( "nCutOffP", FunctionParameter.NUMBER);
    with( aPArrG[k] ) {
    setLowerLimit( 1 );
    setDefault( 150 ); // change this to suit data
    // to be displayed
    }
    k++;

    // ------------------------------------------
    } // end PreMain
    // =======================

    /**********
    ADD to main
    **********/

    // ========================
    function main(bCutOffP, nCutOffP){
    // ------------------------------------------

    // ****************************************
    if ( getBarState() == BARSTATE_NEWBAR ){
    // ----------------------------------------

    // update counters
    nBrCntrG++

    // ----------------------------------------
    } // end Newbar
    // ========================================

    ////////////////////////////////////////////
    if (bCutOffP == "T"){
    // ------------------------------------------

    if (nBrCntrG <= (getNumBars()-nCutOffP)) return;

    // ------------------------------------------
    } // END CutOff
    /////////////////////////////////////////////

    //-------------------------------------------
    } // end main
    // =======================

    I hope that these routines may help in getting those charts to load faster!

    Robert

  • #2
    Robert,

    I use a similar method, this is an excellent way to minimize the time it takes to reload your charts!

    Regards,

    Comment

    Working...
    X