Syn chart with gui button

Hello. i use exploration to find opportunity trades, at the same time, i trade index Futures regularly.
The issues i face is that while i can see the ticker synced via the exploration, i also want to switch quickly back to the Indices. For that, there are couple of ways of doing it. Yet, i want to do it with mouse click, on a GUI button.
So i have figured to created the GUI buttons with it's "Click" functionality. But i can't seem to figure out the code which sets the active chart to the desired ticker symbol.
Pic below

i am sure the function exists, but i can't seem to get my head around it.

@Maxis, you can use a one-shot OLE call. Please, read this old thread.

Thanks beppe. kindly post the correct link. the one given is reference to this post.

I corrected the link. Thanks.

I had read the post u linked for, and that's why i stated that i could not get my head around the precise code. While waiting for the reply, i was also surfing this.

and your message confirmed it. Thank You !

am posting the whole code and a pic of it for any novices like me.

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

x1= Status( "pxchartleft" )+ 600;
y1= Status( "pxcharttop" );
y2=y1 + 15;

    click = GetCursorMouseButtons() == 9;
    Px = GetCursorXPosition( 1 );
    Py = GetCursorYPosition( 1 );
    GfxSetBkMode( 0 );
    GfxSelectFont( "Tahoma", 13, 100 );

    ex1 = x1;
    ex2 = ex1 + 50;
    GfxSelectSolidBrush(  ColorGreen);//Buy
    GfxRoundRect( ex1, y1-3, ex2, y2 , 7, 7 ) ;
    GfxSetTextColor( ColorWhite);
    GfxTextOut( "NF5i", ex1 + 12, y1 -5 );
    gx1 = ex2 + 10;
    gx2 = gx1 + 50;
    GfxSelectSolidBrush(  ColorDarkGreen );
    GfxRoundRect( gx1, y1-3, gx2, y2 , 7, 7 ) ;
    GfxSetTextColor( colorBlack );
    GfxTextOut( "BNFi", gx1 + 12, y1 - 5 );
    if ( px > ex1 AND px<ex2 AND py>y1-3 AND py < y2 AND Click )	{
        AB = CreateObject( "Broker.Application" );
    doc = AB.ActiveDocument;
    doc.Name = "NIFTY-I";

    if ( px > gx1 AND px<gx2 AND py>y1-3 AND py<y2 AND Click )	{
         AB = CreateObject( "Broker.Application" );
    doc = AB.ActiveDocument;
    doc.Name = "BANKNIFTY-I";



Regards, :slight_smile:

1 Like

coming back after a while, somehow, single left mouse click is not working. am having to do either dual left mouse clicks or ctrl + left mouse click. both have defined activity of drawing vertical lines so i want to make this work with a single mouse click only. my click value is set to 9, which is for single left mouse click only, yet not working as intended.
Any suggestions?

Funny. working perfectly again now.
So it's working in live market, i,e when live feed is incoming, But acting weird when no live feed.
will check some more and let know. :slight_smile: