[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 23
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
My code makes it easier to determine the number of iterations via ArrayRange.
Why do I get 0 when I write xDelH[countDH][0]=HBar[countH][0]; (although HBar[countH][0] is already filled and has its own value)? Can I do this at all?
Please tell me which function remembers the Take Profit price of the last open order
If you need to remember exactly, just save theTakeProfit value in a variable each time you open an order.
I just need to
//average by calculating the average price
double averageprice = NormalizeDouble(sum/allots, Digits);
//modify all orders of the series by moving the same TakeProfit for each open order
for ( trade = OrdersTotal() - 1; trade >= 0; trade-- )
{
if ( OrderSelect(trade, SELECT_BY_POS, MODE_TRADES) && OrderMagicNumber() == Magic && OrderSymbol() == Symbol())
{
//take profit for a BUY order
if ( OrderType() == OP_BUY) tp = averageprice + TP * Point;
//take profit for a SELL order
if ( OrderType() == OP_SELL) tp = averageprice - TP * Point;
//modify the order belonging to the series
OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), NormalizeDouble(tp, Digits), 0, Yellow);
}
}
}
modified old orders, changed their TakeProfit to TakeProfit of the new opened order (if the price closes the last order at Stop then all previous orders will be closed too)
I just need to
//averaging by calculating the average price
double averageprice = NormalizeDouble(sum/allots, Digits);
//modify all the orders of the series by moving the same TakeProfit for each open order
for ( trade = OrdersTotal() - 1; trade >= 0; trade-- )
{
if ( OrderSelect(trade, SELECT_BY_POS, MODE_TRADES) && OrderMagicNumber() == Magic && OrderSymbol() == Symbol())
{
//Profit for BUY order
if ( OrderType() == OP_BUY) tp = averageprice + TP * Point;
//take profit for a SELL order
if ( OrderType() == OP_SELL) tp = averageprice - TP * Point;
//modify an order that belongs to the series
OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), NormalizeDouble(tp, Digits), 0, Yellow);
}
}
}
modify old orders, change their TakeProfit to TakeProfit of a new open order (if the price closes the last order at stop, all previous orders will also close)
The previous ones will close if you set a single stoploss for the whole series. This will help to save the profit made on these orders, or reduce the loss if the price has changed. If you leave the stop loss different for each order (without changing it), then only one order will be closed. The TakeProfit value for other orders of the series will have to be either recalculated or set equal to the previous value.
How do you check the value of xDelH[countDH][0] after this assignment operation?
Via Print
Good day!!! you know, I place two orders with this place - by design, one with a stop and one without. In the tester, both are deleted!!!!
I have absolutely no idea what's going on here.
Good day!!! you know, I place two orders with this place - by design, one with a stop and one without. In the tester, both are deleted!!!!
I have absolutely no idea what's going on here.
Look closely, you set stoploss for both of them and takeprofit for only one. So it's like you wrote: both will be closed at stoploss and only one will be closed at takeprofit.
Good day!!! you know, I place two orders with this place - by design, one with a stop and one without. In the tester, both are deleted!!!!
I don't understand what's going on here at all.