Set TP the same as the SL distance?

 

Hi,

I am trying to make the distance of the take profit the same as the stop loss distance. The stop loss is based on an indicator and I need to get the distance of the open price and the indicator to duplicate this distance for the take profit? Can anyone help me please?

 
gangsta1:

Hi,

I am trying to make the distance of the take profit the same as the stop loss distance. The stop loss is based on an indicator and I need to get the distance of the open price and the indicator to duplicate this distance for the take profit? Can anyone help me please?


Prior to placing the Order or afterwards using OrderModify ?
 

Prior to placing the order. I have this so far:

I want to make the TP the same distance as the stop loss

double SL = NormalizeDouble(iBands(NULL, NULL,Periods,Deviations,0,PRICE_CLOSE,MODE_LOWER,0), NDigits) -Buffer*PipValue*Point;
    if (iBands(NULL, NULL,20,2,0,PRICE_CLOSE,MODE_LOWER,0) == 0) SL = 0;
    double TP = Ask + TakeProfit*PipValue*Point;
    if (TakeProfit == 0) TP = 0;
 

I have tried:

double TP = Ask + NormalizeDouble(iBands(NULL, NULL,Periods,Deviations,0,PRICE_CLOSE,MODE_LOWER,0), NDigits) + Buffer*PipValue*Point;
 
gangsta1:

I have tried:


Why not . . .

double TP;

TP = Ask + (Ask - SL);

You don't need the NormalizeDoubles

 
Perfect thank you, I was over complicating things!
Reason: