I'm looking to set SellPrice at various points in the trade.
Example.
I'd like to sell at breakeven when breakeven level is hit.
I'd like to sell at 1R when 1R stop loss is hit.
I'm thinking I need a custom function to do what I want. Essentialy there are two scenarios that are each exclusive of each other. I want to make it such that scenario 1 happens then function breaks out and returns the value for scenario 1 and if scenario 2 happens then function returns the value for scenario 2. Is there some sample code I can reference that does something similar?
SellPrice = IIf( High>=initialStopLocation, initialStopLocation, Open); // Initial stop exit.
SellPrice = IIf( oneRReachedBreakEvenStop && BarsSinceEntry>=2, risk+BuyPrice, close); // 1R exit
Thanks!