Will IBC place trades for charts on inactive (non visible) tabs?

Just as the title suggests, I'd like to know if AMI+IBC will place trades on charts that are not currently visible?

Say I'm trading different symbols with different strategies, will I need to lay my charts out in such a way that every chart I'm trading is visible in order for auto trades to take place?

I know I could test this fairly easily but figured I ask, that way the information would be out there for the community, too.

Thank you!

There are two kind of "tabs" in AmiBroker:

  1. MDI chart tabs (upper)
  2. Chart sheet tabs (lower)

image

These two are fundamentally different. MDI chart tabs represent entire chart windows. Chart sheet tabs represent sheets WITHIN chart window.

One has to understand that AmiBroker runs circles to save resources and to do so:

  1. Does NOT refresh windows that are NOT visible (unless you force refreshes using RequestTimedRefresh)
  2. Does not create sheets that are not visible (in other words only VISIBLE sheet in any chart window actually exist, the remaining ones (invisible) do NOT really exist, they are created only when you click on chart sheet and invisible sheet stops its existence).

So, short answer is: YES you can place trades from not-visible chart but only IF:

  • you use RequestTimedRefresh() with 'onlyvisible' set to False
  • you place your code in selected chart SHEET
5 Likes

Thank you for the thorough answer, this even helped answer a follow up question. :grinning:

Actually, I do have one follow up question:
How does it handle while AMI Broker itself is minimized within Windows 10?

@Pinecone Tomasz has already answered your question, besides it is all described in the docs - especially here:

AFL Function Reference - REQUESTTIMEDREFRESH
AmiBroker Knowledge Base » When and how often AFL code is executed?

It was also discussed on the forum before. For example:

2 Likes

For example this formula (applied on a chart) runs some part of the code only every n-seconds and you can decide whether it will be executed when the chart is visible or not:

_SECTION_BEGIN( "Timer" );
TimerON = ParamToggle( "Timer", "Off|On", 1 );
HowOften = Param( "How often (seconds)", 10, 1, 180 );
OnlyWhenVisible = ParamToggle( "Only when visible", "No|Yes", 1 );

if( TimerON )
{
    RequestTimedRefresh( HowOften, OnlyWhenVisible );
    GfxTextOut( "Timer is ON ", 5, 30 );

    if( Status( "RedrawAction" ) )
    {
        GfxTextOut( "This part of the code is executed every " + HowOften + " seconds", 5, 45 );
        Say( "This part of the code is executed every " + HowOften + " seconds", 1 );
    }
}
else GfxTextOut( "Timer is OFF ", 5, 30 );
_SECTION_END();

Play with it. Minimize AmiBroker and check for yourself.

3 Likes

Thanks @Milosz,
Am I right in thinking this method has a slower refresh rate than having charts visible?
There was some talk about the speed in the documentation, but no mention as to how it relates to default behavior (that I saw).

When and how often the chart is executed depends on many things (link above) but in general no, because you can even force the chart to be refreshed 10 times per second, but of course I don't recommend it! Read the docs and examples above. It's all there. Code something and see for yourself.

3 Likes

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