Announcement

Collapse
No announcement yet.

How do you maintain synchronization with 2 or more symbols in multi timeframe mode?

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

  • How do you maintain synchronization with 2 or more symbols in multi timeframe mode?

    I have tried various techniques to maintain synchronization from multiple symbols from a higher time frame into a lower time frame without resorting to use of symbol spreads as I wish to perform various actions on each symbo, to then bring together into a unified indicator. As a simple example to highlight the issue, I have given the following code to just look at 2 symbols and find the MA of each and combining them into one indicator:-

    PHP Code:
    // ###################################################################
    // GLOBAL VARIABLES
    // -------------------------------------------------------------------
    // Used in preMain() for user selection
    var aPArrG = new Array();

    var 
    xExample null;
    var 
    myStudy1 null;
    var 
    myStudy2 null;
    var 
    bInit false;

    // ###################################################################
    function preMain(){
    // ###################################################################
    // STUDY FIXED PARAMETERS

        
    setPriceStudy(false);
        
    setStudyTitle("MITst");
     
    // VARIABLES
    var k;

    // USER SELECTION
        
    k=0;

    // Symbol & Interval
        
    aPArrG[k] = new FunctionParameter"sSymbol1P"FunctionParameter.STRING);
        
    withaPArrG[k] ) {
            
    setDefault("$trin");
        }
        
    k++;

        
    aPArrG[k] = new FunctionParameter"sSymbol2P"FunctionParameter.STRING);
        
    withaPArrG[k] ) {
            
    setDefault("$trinq");
        }
        
    k++;

        
    aPArrG[k] = new FunctionParameter"nIntervalP"FunctionParameter.STRING);
        
    withaPArrG[k] ) {
            
    setDefault();
        }
        
    k++;
    // ==================================================================
    }    // END PreMain Function
    // ==================================================================


    // ##################################################################
    function main(sSymbol1PsSymbol2PnIntervalP) {

    // ****************************************
    if ( bInit == false ){
    // ----------------------------------------
    if(nIntervalP == nullnIntervalP getInterval();

    if(
    sSymbol1P == nullsSymbol1P getSymbol();
    vSymbol1M sSymbol1P+","+nIntervalP;

    if(
    sSymbol2P == nullsSymbol2P getSymbol();
    vSymbol2M sSymbol2P+","+nIntervalP;

    xExample efsInternal("testExample"sSymbol1PsSymbol2Pinv(nIntervalP));

    bInit=true;
    // ----------------------------------------
    }    
    // ========================================

    if (xExample != null) {
        if (
    myStudy1 == nullmyStudy1 getSeries(xExample);
        if (
    myStudy2 == nullmyStudy2 getSeries(xExample);
    }

    return -
    myStudy1-myStudy2;

    }

    function 
    testExample(vSymbol1vSymbol2) {
    var 
    MA1=ema(2sym(vSymbol1) )
    var 
    MA2=ema(2sym(vSymbol2) )

    return new Array( 
    MA1MA2 );

    Nothing I tried can make this work in terms of synchronization when putting an external interval into the study in a lower timeframe.

    Any help/guidance will be much appreciated.

    Robert

  • #2
    Question to Esignal Development Group (as per request):-

    Is it possible to synchronize 2 or more external symbols with the same external interval and plot a combined indicator so it is properly updated in the current (lower time frame) chart which is displaying a different symbol.

    I have provided a simple example which does not synchronize at all and if there is a method I am missing using built in functions I would appreciate to see the coding that enables this capability.

    Robert
    Last edited by rcamrn123; 08-15-2013, 03:59 AM.

    Comment

    Working...
    X