# Set Take Profit Relative To Stop Loss (Risk:Reward Ratio)

54

I've been struggling to solve this. Based on what I saw I should use OrderSelect() but have been unsuccessful. See "SL" and "TP" below. SL works everytime because it is set to the low of the previous candle, however I'm trying to base the TP off of the SL to have the Risk:Reward ratio of my liking (1:2 currently).

Can someone more experienced point me in the right direction?

I used an EAbuilder but it doesn't have everything I want/need (like ObjectGetDouble) so I've been trying to learn a little coding. This is my first real challenge that I've been struggling to get through.

```//Open Buy Order
if(iLow(NULL, PERIOD_CURRENT, 1) < ObjectGetDouble(0,"SLCbp",1,0)
&& iClose(NULL, PERIOD_CURRENT, 1) > ObjectGetDouble(0,"SLCbp",1,0)
&& iLow(NULL, PERIOD_CURRENT, 1) < iLow(NULL, PERIOD_CURRENT, 2)
&& iLow(NULL, PERIOD_CURRENT, 1) < iLow(NULL, PERIOD_CURRENT, 3)
&& (((MathAbs(iOpen(NULL, PERIOD_CURRENT, 1) - iClose(NULL, PERIOD_CURRENT, 1)))/(iHigh(NULL, PERIOD_CURRENT,1) - iLow(NULL, PERIOD_CURRENT, 1))) < (maxBMIpercent/100))
&& (ObjectDescription("S.L.Clus#grbpv") >= 2.0)
&& (ObjectDescription("S.L.Clus#grbpv") < 9.0)
)
{
RefreshRates();
SL = iLow(NULL, PERIOD_CURRENT, 1); //Stop Loss = Candlestick Low
{
TP = OrderOpenPrice() + ((OrderOpenPrice() - iLow(NULL, PERIOD_CURRENT, 1)) + (OrderOpenPrice() - iLow(NULL, PERIOD_CURRENT, 1)));
}
if(price - SL < MinSL) SL = price - MinSL;