OK, then as I understand it, we get three different custom functions with the return of the right one (if we look for three different parameters)
ArraySort
then
ArrayBsearch by the right number
and then how to deal with it?
Exactly the transition from an array to a structure element
You don't understand.
You need to make a single function that will populate and sort the array declared globally. The array will need to be passed to the function by reference.
And you need additional functions that will take out the data you need from this array.
Please advise how the condition should look like. If a stop loss is triggered, then the lot is multiplied by 2, and if the next order triggers a take profit, the lot would return to the original lot, which was before the stop loss.
I understand it like this, but I don't know how to go on...
for (int i=OrdersHistoryTotal()-1; i>=0; i--) { if (OrderSelect(i,SELECT_BY_POS,MODE_HISTORY) { if (OrderMagicNumber()==magic) { if (OrderStopLoss()==OrderClosePrice()) { lot=lot*4; } } }
You are trying to delete a market order, they are not deleted, they are closed using the OrderClose() function. For the loop to delete or close correctly, we have to distinguish the order by its type.
if(OrderType()<=OP_SELL) - for market orders, if(OrderType()>OP_SELL) - for pending orders.
Please advise how the condition should look like. If a stop loss is triggered, then the lot is multiplied by 2, and if the next order triggers a take profit, the lot would return to the original lot, which was before the stop loss.
I understand it like this, but I don't know how to go on...
for (int i=OrdersHistoryTotal()-1; i>=0; i--) { if (OrderSelect(i,SELECT_BY_POS,MODE_HISTORY) { if (OrderMagicNumber()==magic) { if (OrderStopLoss()==OrderClosePrice()) { lot=lot*4; } } }
}
If you've done it quickly, the last losing order will show up, what to do with it and what parameters to correct, I think you'll understand.
Please advise how the condition should look like. If a stop loss is triggered, then the lot is multiplied by 2, and if the next order triggers a take profit, the lot would return to the original lot, which was before the stop loss.
I understand it like this, but I don't know how to go on...
for (int i=OrdersHistoryTotal()-1; i>=0; i--) { if (OrderSelect(i,SELECT_BY_POS,MODE_HISTORY) { if (OrderMagicNumber()==magic) { if (OrderStopLoss()==OrderClosePrice()) { lot=lot*4; } } }
}
The solution to this problem depends on the Expert Advisor's full logic, you can trace the triggering of stoploss or takeprofit by its comment.
You need to make a single function that fills and sorts the arraydeclared at global level. The array will need to be passed to the function by reference.
And you need additional functions that will take out the data you need from this array.
Artem, you are wrong. The array, declared on a global level is visible in all parts of the program, and you don't have to pass it somewhere from somewhere. It's just filled in one place in the program, sorted in another, and read in the third, it doesn't matter.
If you compare it to the balance, that's how it is:
Thank you.
OK, then as I understand it, we get three different custom functions with the return of the right one (if we look for three different parameters)
ArraySort
then
ArrayBsearch by the right number
and then how to deal with it?
Exactly the transition from an array to a structure elementYou don't understand.
You need to make a single function that will populate and sort the array declared globally. The array will need to be passed to the function by reference.
And you need additional functions that will take out the data you need from this array.
You don't understand.
You need to make a single function that fills and sorts the array declared globally. The array will need to be passed to the function by reference.
And you need additional functions that will take the data you need from this array.
ok, can you demonstrate how to take something out of an array of structures? let's say it's full and sorted
how to transfer by reference and write
Please advise how the condition should look like. If a stop loss is triggered, then the lot is multiplied by 2, and if the next order triggers a take profit, the lot would return to the original lot, which was before the stop loss.
I understand it like this, but I don't know how to go on...
for (int i=OrdersHistoryTotal()-1; i>=0; i--)
{
if (OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)
{
if (OrderMagicNumber()==magic)
{
if (OrderStopLoss()==OrderClosePrice())
{
lot=lot*4;
}
}
}
}
another question, what did I write wrong in the block on deleting orders? it does not always delete orders, in the log it says
market order #1 cannot be deleted
{
for(int n=OrdersTotal()-1;n>=0;n--)
{
if(OrderSelect(n,SELECT_BY_POS))
{
if(OrderMagicNumber()==magic)
{
bool del=OrderDelete(OrderTicket());
if (del==true)
{
otl_b=0; otl_s=0; //обнуляем переменные отложек
}
}
}
}
}
Another question, what did I write wrong in the block to delete orders? It doesn't always delete orders, in the log it says
market order #1 cannot be deleted
{
for(int n=OrdersTotal()-1;n>=0;n--)
{
if(OrderSelect(n,SELECT_BY_POS))
{
if(OrderMagicNumber()==magic)
{
bool del=OrderDelete(OrderTicket());
if (del==true)
{
otl_b=0; otl_s=0; //обнуляем переменные отложек
}
}
}
}
}
You are trying to delete a market order, they are not deleted, they are closed using the OrderClose() function. For the loop to delete or close correctly, we have to distinguish the order by its type.
if(OrderType()<=OP_SELL) - for market orders, if(OrderType()>OP_SELL) - for pending orders.
There's a thing calledCHARTEVENT_MOUSE_MOVE
Question: does this work on mobile devices where there is no mouse?
Please advise how the condition should look like. If a stop loss is triggered, then the lot is multiplied by 2, and if the next order triggers a take profit, the lot would return to the original lot, which was before the stop loss.
I understand it like this, but I don't know how to go on...
for (int i=OrdersHistoryTotal()-1; i>=0; i--)
{
if (OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)
{
if (OrderMagicNumber()==magic)
{
if (OrderStopLoss()==OrderClosePrice())
{
lot=lot*4;
}
}
}
}
Please advise how the condition should look like. If a stop loss is triggered, then the lot is multiplied by 2, and if the next order triggers a take profit, the lot would return to the original lot, which was before the stop loss.
I understand it like this, but I don't know how to go on...
for (int i=OrdersHistoryTotal()-1; i>=0; i--)
{
if (OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)
{
if (OrderMagicNumber()==magic)
{
if (OrderStopLoss()==OrderClosePrice())
{
lot=lot*4;
}
}
}
}
The solution to this problem depends on the Expert Advisor's full logic, you can trace the triggering of stoploss or takeprofit by its comment.
if(StringFind(OrderComment(),"tp")>=0)// сработал тейкпрофит
...
You don't understand.
You need to make a single function that fills and sorts the array declared at global level. The array will need to be passed to the function by reference.
And you need additional functions that will take out the data you need from this array.