That's not a trivial thing to do. If I understand your idea correctly, you want to create an initial grid distance that will be modified later in time when other conditions are met. I see you are using variables, and that is the correct thing to do. However, several consideratios are to be included. Are all frid levels equidistant or not? Where is the initial price level for each new iteration? Can different iterations be combined? I don't know if you see what I mean.
T