Exploration over list needing information from symbol linked chart

hi, i wonder what is the best way to do an exploration over a list of symbols when you need information from a chart that is "symbol linked". So to illustrate I have the charts below:


the second pane on the right side of the image is calculated using the top left (floating) chart. This floating chart is in the "tick" timeframe and calculates the so-called "volume delta" or "delta volume". The chart on the right side I have in the 5Min timeframe and is "symbol linked" to the floating top left chart which is in the "tick" timeframe. In the tick timeframe chart the "delta volume" is calculated and saved inside a static variable which is then called inside the 5min timeframe.

Now if I want to do an explore over a list it will need to get information from the tick dataframe of all the symbols in the list.

Currently I solved it like this. I do an explore in the 5min timeframe over a list of symbols and then I make an attempt to activate each symbol in the chart so that the "delta volume" array is calculated in the tick chart. This "delta volume" array is then saved to a static variable and is called inside the 5min chart and then can be used during the explore.

if( Status( "action" ) == actionExplore )
    if( status( "stocknum" ) == 0 )
        Say( "explore" );
        #include "C:\Program Files\AmiBroker\MyFormulas\misc\loopthroughlist.afl"
    //Filter = ( Buy2 OR Sell1 OR Buy1 OR Buy3 OR Sell2 OR Sell3 OR Buy0 OR Sell0 );
    Filter = ( Buy2 OR Sell1 OR Buy0 OR Sell0 );
    //AddColumn( Buy1, "Buy1 (Regular)", 1.2, colorBlack, IIf( Buy1, colorBullishRegular, colorWhite ) );
    AddColumn( Buy2, "Buy2 (Hidden)", 1.2, colorBlack, IIf( Buy2, colorBullishHidden, colorWhite ) );
    //AddColumn( Buy3, "Buy3 (Affirmative)", 1.2, colorBlack, IIf( Buy3, colorBullishAffirmative, colorWhite ) );
    AddColumn( Sell1, "Sell1 (Regular)", 1.2, colorBlack, IIf( Sell1, colorBearishRegular, colorWhite ) );
    //AddColumn( Sell2, "Sell2 (Hidden)", 1.2, colorBlack, IIf( Sell2, colorBearishHidden, colorWhite ) );
    //AddColumn( Sell3, "Sell3 (Affirmative)", 1.2, colorBlack, IIf( Sell3, colorBearishAffirmative, colorWhite ) );
    AddColumn( Buy0, "Buy0 (ATR)", 1.2, colorBlack, IIf( Buy0, colorBrightGreen, colorWhite ) );
    AddColumn( Sell0, "Sell0 (ATR)", 1.2, colorBlack, IIf( Sell0, colorRed, colorWhite ) );

where the code in the include file is:

SymList = "QCL#,QNG#,QPL#,QSI#,QGC#,QHG#,@NQ#,@ES#,@YM#,@RTY#"; // any comma separated list can be result of CategoryGetSymbols for example

AB = CreateObject( "Broker.Application" );
ABDocs = AB.Documents;

if( ABDocs.Count > 0 )
    AD = ABDocs.Item( 0 );
    ADWindows = AD.Windows;

    if( ADWindows.Count > 0 )
        AW = ADWindows.Item( 0 );

        for( i = 0; ( sym = StrExtract( SymList, i ) ) != ""; i++ )
            AD.Name = sym;
            AW.SelectedTab = 2;
            _TRACE( "Symbol is: " + sym );

so this seems to work but not very reliable. What would be the correct way to do this?

Hi Ed,

one possible solution to avoid the "strobuskop lamp" would be to migrate the chart windows into individual explorations which would allow staging of the chart windows currently calculating your values.

The single results could be written as ascii to disk or managed in global variables/matrix. Your realtime exploration list ( left bottom ) would then only publish the computed results of your standalone explorations on your symbol array or step by step via input queues.

You could take advantage of multithreading, background processing so to speak. To handle the communication between your running/auto scheduled exploration could be via ascii on harddisk or static params.

... just spoken this is high level and an idea to sequence your complex task and automate that process. I understand this process as an staging system in realtime. The challenge is on sync the explorations so it would be necessary the state additional the results, hopeful to provide an idea for you.

Best regards,

hi Pietro, thanks for your reply. You mean to setup a chart (or rather a chart couple: the higher timeframe chart plus the symbol linked tick chart) for every symbol? Not sure if you meant that but this I want to avoid because that would slow down the computer tremendously and will use up a lot of power. Or maybe you can explain your idea (the individual explorations) a bit further? You have a simple example? thanks

i possibly have an alternative idea. I could skip the symbol linked chart all together and have the tick chart loop though the symbol list and save the "delta volume" that I want to use in the other chart as composities. Will try this out

hi Ed, here the simple idea:

  1. Setup a AB watchlist for QCL#,QNG#,QPL#,QSI#,QGC#,QHG#,@NQ#,@ES#,@YM#,@RTY#
  2. Migrate your Calculation from Chart Window AFL to a corresponding Analysis ( apx )
  3. Configure every apx with your necessary settings
  4. Start now 3 Analysis with inside code from your current Chart Windows AFLs
// _exp_delta_volume_tick ( Chart Window - Top left )

// Analysis Window - Settings - Auto-Repeat (AR) : Active, AR Interval : 1s 
// Apply to: *Filter ( your watchlist ) := "QCL#,QNG#,QPL#,QSI#,QGC#,QHG#,@NQ#,@ES#,@YM#,@RTY#"
// Settings: Perodicity : tick

... your code ...

xdv = Name() + "_exp_delta_volume_tick";
zdv = LastValue( V ) ; // dummy/sample array
svndv = StaticVarSet( xdv, zdv );

Filter = 1;
AddColumn( zdv, "delta volume", 1, colorBlack, colorWhite, 150 );

// _exp_atr_5m ( Chart Window - Right side )

// AB - Analysis - Auto-Repeat (AR) : Active, AR Interval : 1s 
// Apply to: *Filter ( your watchlist ) := "QCL#,QNG#,QPL#,QSI#,QGC#,QHG#,@NQ#,@ES#,@YM#,@RTY#"
// Settings: Perodicity : 5m 

... your code ...

xatr = Name() + "_exp_atr_5m";
zatr = LastValue( ATR(10) ); // dummy, sample array
svnatr = StaticVarSet( xatr, zatr );

Filter = 1;
AddColumn( zatr, "ATR 5m", 1.2, colorBlack, colorWhite, 150 );

// _exp_rt_results ( Chart Window - Bottom left )

// AB - Analysis - Settings - Auto-Repeat (AR) : Active, AR Interval : 1s
// Apply to: *Filter ( your watchlist ) := "QCL#,QNG#,QPL#,QSI#,QGC#,QHG#,@NQ#,@ES#,@YM#,@RTY#"
// Settings: Perodicity : < does not matter >

// ... here only read your results from multiple Explorations

xdv = Name() + "_exp_delta_volume_tick"; // <= Exploration V tick
zdv = StaticVarGet( xdv );

xatr = Name() + "_exp_atr_5m"; // <= Exploration ATR 5m
zatr = StaticVarGet( xatr );

Filter = 1;

AddColumn( zdv, "delta volume tick", 1, colorBlack, colorWhite, 150 );
AddColumn( zatr, "ATR 5m", 1.2, colorBlack, colorWhite, 150 );

1 Like

thanks Pietro,

I will try to implement it but can only test on Monday, so will get back on it if I get it to work.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.