I'm struggle to set my TP the range of the previous bar
I've manage to set my SL for a sell trade above the previous bar range but i want to set my TP in the same way
https://c.mql5.com/3/362/3465294851212.png
Code for opening a sell position, but I'm not getting the Take profit section to work
Any advise ?
{
RefreshRates();
price = Bid;
SL = High[1] + 5 * myPoint; //Stop Loss = Candlestick High + fixed value
TradeSize = MM_Size(SL - price);
TP = (High[1] - Low[1]) ; //Take Profit = Candlestick Range
if(!TradeDayOfWeek()) return; //open trades only on specific days of the week
if(IsTradeAllowed())
{
ticket = myOrderSend(OP_SELL, price, TradeSize, "");
if(ticket <= 0) return;
}
else //not autotrading => only send alert
myAlert("order", "");
myOrderModify(ticket, SL, 0);
myOrderModify(ticket, 0, TP);
}
}
I've manage to set my SL for a sell trade above the previous bar range but i want to set my TP in the same way
https://c.mql5.com/3/362/3465294851212.png
Code for opening a sell position, but I'm not getting the Take profit section to work
Any advise ?
{
RefreshRates();
price = Bid;
SL = High[1] + 5 * myPoint; //Stop Loss = Candlestick High + fixed value
TradeSize = MM_Size(SL - price);
TP = (High[1] - Low[1]) ; //Take Profit = Candlestick Range
if(!TradeDayOfWeek()) return; //open trades only on specific days of the week
if(IsTradeAllowed())
{
ticket = myOrderSend(OP_SELL, price, TradeSize, "");
if(ticket <= 0) return;
}
else //not autotrading => only send alert
myAlert("order", "");
myOrderModify(ticket, SL, 0);
myOrderModify(ticket, 0, TP);
}
}