To void the withdraw penalty, it's recommended to wait at least for 2 settlements after your deposit. For example, if the vault settles each Monday and you deposit on Friday of week 1, wait after Monday of week 3 to withdraw. You are in profit assuming price moves in your favor during these two periods:
Friday of week 1 to Monday of week 2
Monday of week 2 to Monday of week 3
Below explains the underlying vault logic:
Each depositor receives tokens that represents shares in the vault. The value of the deposit is (share price * number of shares). So how is the share price determined?
The share prices of depositing and withdrawing are calculated differently:
Let vault deposits in Curve be C, pending Curve yield be PC, pending gmx position margin be PG, total vault shares be TS
share price of depositing = (C + PC + PG) / TS
share price of withdrawing = C / TS
The share price of withdrawing is lower than depositing. It means if you immediately withdraw after deposit, there's a loss of ((PC + PG)/TS * (your shares)). This is designed intentionally to prevent people from gaming the system by depositing right before the vault settlement and withdrawing right after.
Each week when the settlement happens, PG becomes part of C, when the GMX position is closed and reinvested into Curve. PC becomes PG, as pending curve yield is harvested and used to open position on GMX.
To withdraw with profit, the share price of withdrawing must be higher than depositing, meaning current week's C must be higher than the deposited week's C + PC + PG. This is more likely to happen after 2 subsequent settlments assuming the sum profit of the two settlements is positive.