How does one create a function to return multiple exist prices

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!

hello

if you read the Example 4: partial exit , you will take an idea of how to set different SellPrice
https://www.amibroker.com/guide/h_pyramid.html

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.