I am using excel/VBA and i am not yet familiar with c/c++, or other programming languages If you think this is the type of problem that is more easily solved in another language, please say so and i'll take this as my time to start learning something else. if you can also point out a good reference to begin learning i would appreciate it. i'm trying to program my spreadsheet to do the following: if a trade is on, look at the P&L as it moves through time, if the loss is x or below or z # intervals have passed, close the trade. If the gain is y or above, set a stop at y*some threshhold and if it continues higher keep moving the stop until it is hit. any ideas?