Need to use entry price as indicator. How to create some form of recursion

Im trying a strategy where, the bot would just enter a trade (without any indicator.) and then measure future trades using that entry price as a base. 



Something like:

  1. Go long- record price into variable X
  2. Check current candle close aganst X (and then perform more functions based on this logic)



    Im not sure how to achieve the first step. 



    Iv been using block based coding fyi (so if the solution can be achieved using the blocks it would be great)

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.