hi guys i just starting using mt5.the problem is that i cant see my costume indicator on the chart .the code has no errors i put the chart on foreground i checked the indicators list in chart and i can see my indicator, i refresh i closed and open the mt5 , i deleted and redownloaded but still any costume indicator that i make doesnt show up in the chart .any thought
Dear All, I need your help please. I am trying to code an expert advisor and I have been having issues with my code which i cant seem to resolve. I want to delete all buy limit orders when there are no buy positions and also do same for sell limit orders when there are no sell positions. Below is the code i've written and I called the deleteAllBuyOrders() and deleteAllSellOrders() functions in my onTick() section but it just wont work. The code compiles fine however, while testing it, when all buy positions are closed, the buy limit pending orders don't get deleted as i want it to. Please help me out
NoobDaytrader checked the list of indicators on the chart and I can see my indicator , I updated I closed and opened mt5 , I uninstalled and reloaded but still any suit indicator I make is not showing on the chart .Any thoughts
See the articles here - it's all explained. Search for custom indicator type and see the articles.
Dear all, I need your help please. I am trying to create an EA and I have some problems with the code that I can't solve in any way. I want to delete all buy limit orders when there are no buy positions, and do the same for sell limit orders when there are no sell positions. Below is the code I wrote, and I called deleteAllBuyOrders() and deleteAllSellOrders() in my onTick() section, but it just doesn't work. The code compiles fine, but when testing, when all buy positions are closed, the pending orders with a buy limit are not deleted as I want. Please help me ...
Hello. Please insert the code into the message using a special input window (the picture shows the button to call it):
Now about the code. You have done correctly that you have looped through all open positions, but for some reason you have not selected any position on the ticket to work with it further:
PositionGetTicket
Функция возвращает тикет позиции по индексу в списке открытых позиций и автоматически выбирает эту позицию для дальнейшей работы с ней
при помощи функций PositionGetDouble, PositionGetInteger, PositionGetString.
ulongPositionGetTicket(
int index // номер в списке позиций
);
Yuriy Bykov CopyBuffer inMQL5. Only with it. The usual MQL4 style of working with indicator data does not work in MQL5.
It's clear, everything works on mql5, I wrote how to make this code work on mql4, I highlighted in yellow what I wrote, but in the places where it is highlighted in red, the error is outputting an error of exceeding the array limits
Hello. Please insert the code into the message using a special input window (the picture shows the button to call it):
Now about the code. You have done correctly that you have looped through all open positions, but for some reason you have not selected any position on the ticket to work with it further:
Regards, Vladimir.
Hello. Thank you for your response. Below is the inserted code as requeted.
void deleteAllBuyOrders()
{
int totalPositions = PositionsTotal();
bool hasOpenBuyPosition = false;
// Check if there are any open buy positionsfor (int i = 0; i < totalPositions; i++)
{
if (PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY)
{
hasOpenBuyPosition = true;
break;
}
}
// If there are no open buy positions, delete all pending buy limit ordersif (!hasOpenBuyPosition)
{
int totalOrders = OrdersTotal();
for(int i = OrdersTotal()-1; i >= 0; i--)
{
ulong ticket = OrderGetTicket(i);
if(OrderGetInteger(ORDER_MAGIC) == InpMagic && OrderGetInteger(ORDER_TYPE) == ORDER_TYPE_BUY_LIMIT)
{
trade.OrderDelete(ticket);
}
}
}
}
void deleteAllSellOrders()
{
int totalPositions = PositionsTotal();
bool hasOpenSellPosition = false;
// Check if there are any open sell positionsfor (int i = 0; i < totalPositions; i++)
{
if (PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_SELL)
{
hasOpenSellPosition = true;
break;
}
}
// If there are no open sell positions, delete all pending buy limit ordersif (!hasOpenSellPosition)
{
int totalOrders = OrdersTotal();
for(int i = OrdersTotal()-1; i >= 0; i--)
{
ulong ticket = OrderGetTicket(i);
if(OrderGetInteger(ORDER_MAGIC) == InpMagic && OrderGetInteger(ORDER_TYPE) == ORDER_TYPE_SELL_LIMIT)
{
trade.OrderDelete(ticket);
}
}
}
}
It is enough to use NormaliseDouble() to pass to the methods of opening positions and orders. The second parameter can be obtained using
C_info.Digits()Hello. Please insert the code into the message using a special input window (the picture shows the button to call it):
Now about the code. You have done correctly that you have looped through all open positions, but for some reason you have not selected any position on the ticket to work with it further:
Regards, Vladimir.
I want to make the code from mql5 work on mql4.
Example code of zig zag indicator with Mql5, how to implement it correctly without CopyBuffer, something does not work.
It will not work inMQL5 withoutCopyBuffer. Only with it. The usual MQL4 style of working with indicator data does not work in MQL5.
It's clear, everything works on mql5, I wrote how to make this code work on mql4, I highlighted in yellow what I wrote, but in the places where it is highlighted in red, the error is outputting an error of exceeding the array limits
Hello. Please insert the code into the message using a special input window (the picture shows the button to call it):
Now about the code. You have done correctly that you have looped through all open positions, but for some reason you have not selected any position on the ticket to work with it further:
Regards, Vladimir.
Hello. Thank you for your response. Below is the inserted code as requeted.