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.
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:
Does NOT refresh windows that are NOT visible (unless you force refreshes using RequestTimedRefresh)
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
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.
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.