This is of course straightfoward in the Python interface, but can be achieved in the visual interface as well. See here for an example. Here we use two variables - "trade", "px". The first one is used to mark the time whether we are recording the price (trade=False) or trading (trade=True). We set trade to False in before_trading_starts, then after 30 mins (or any time you prefer) we record the prices into px and set trade to True. Finally every thirty minute we check if trade is True, and if it is, we do some trades using the already recorded px. It is important to use two variables instead of one, so that we do not have a situation where we are trying to use px without recording prices, or we use px with stale data. Also, if you click the "view code" button on the visual interface and examine the generated Python code, it might be a bit more clear.