Hi All

I am trying to change the TakeProfit of trades that are already open
i.e. if I open a new trade so that they all have the same TakeProfit

I don't know where I am getting this wrong

here is the code:

int AfterFirstTrade ()
{
//Selling Again
if(TradeIsShort==1 && NumOpenShort > 0.0 && NumOpenShort < MaxShort)
{
if (Bid - TradePriceOpen >= PipStep*PIP )
{
enterShort(pow(2,NumOpenShort));

}
for(open_trades){
TradeProfitLimit -= TakeProfit;
}
return 16; // trigger tmf at next event
}

//Buying Again
if(TradeIsLong==1 && NumOpenLong > 0.0 && NumOpenLong < MaxLong)
{
if (TradePriceOpen - AskPrice >= PipStep*PIP )
{
enterLong(pow(2,NumOpenLong));

}
for(open_trades){
TradeProfitLimit -= TakeProfit;
}
return 16; // trigger tmf at next event
}
}