Save text box based on symbol

how to use below code with multiple symbols

i enter number in the text box and i hit enter to save it
if i insert it for symbol A and save it and i insert it for symbol B in new chart text box will show the saved number in symbol A

how to save the textbox based on symbol name ?

function EIOWEditNumber( idEdit, initialValue, x, y, width, height, textColor, bgColor )
{  // this function hold the text for the next restart of Amibroker
    global _x0, _y0;
    local rc ;

    x = x + _x0;     y = y + _y0;
    rc = GuiEdit( idEdit, x, y, width, height, notifyHitReturn ); //

    ID = GuiGetEvent( 0, 0 );     event = GuiGetEvent( 0, 1 );
    if( ID == idEdit ) StaticVarSetText( "sV" + idEdit,  GuiGetText( idEdit ), 1 );

    if( rc == guiNew )
    {  // after restart Amibroker read FIRST these Static Line
        txt = StaticVarGettext( "sV" + idEdit );
        GuiSetText( txt, idEdit );
    }

    GuiSetColors( idEdit, idEdit, 1, textColor, bgColor, textColor );

    return GuiGetValue( idEdit );
}

thank you

change the static variable name when saving/reading to include each ticker separately.

... StaticVarSetText( "sV" + Name() + idEdit, ...
//and here
... StaticVarGettext( "sV" + Name() + idEdit ...
1 Like

thank you for your help