MQL5 Indicator - Sizing indicator sub-window

 

I am building an indicator that I want to be full-screen. The underlying price-bars do not matter because this is multi-currency.

I am able to size the window dynamically using the following code, and it works, but it feels "ugly" to me.

int OnInit()
{
        const int MAIN_WINDOW = 0;
        const int SUB_WINDOW = 1;
        long heightMain = ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS,MAIN_WINDOW);
        long heightSub = ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS,SUB_WINDOW);
        PrintFormat("MAIN_WINDOW height [%d]", (int) heightMain);
        PrintFormat("SUB_WINDOW height [%d]", (int) heightSub);
        ChartSetInteger(0,CHART_HEIGHT_IN_PIXELS,SUB_WINDOW,heightMain + heightSub);

        . . . 
}

The range of the indicator values is -20 to +20, which do not correspond to the MAIN_WINDOW chart prices; so, I did not use #property indicator_chart_window

Question: Is there a better way to do this?