Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 74
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
there is a variable
int Level = 0;
While the program is running, it is constantly changing. Help me write a condition: if Level has NOT changed, then do nothing. If Level has changed (no matter if it has changed up or down), then do some action { operator }
enter another variable
int Level1 = 0;
int Level = 0;
if (Level !=Level1)
{};
and then Level1 =Level
but I really don't understand why we need to pull an array on every tick if we can do it after any trade operation
enter another variable
int Level1 = 0;
int Level = 0;
if (Level !=Level1)
{};
and then Level1 =Level
I don't really understand why I need to pull an array at every tick, if I can do it after any trade operation
{
ObjectCreate("Sell no loss level", OBJ_HLINE, 0, 0, SELL_NoLossLevel);
}
Further, I need it to happen when SELL_Lvl increases:
But, since theSELL_Lvl>0 condition is fulfilled, the line is redrawn again, but by a new value ofSELL_NoLossLevel. Is there an easier and more obvious way to redraw the line, depending onSELL_Lvl?
{
ObjectCreate("Sell no loss level", OBJ_HLINE, 0, 0, SELL_NoLossLevel);
}
Then I need to increase SELL_Lvl to be redrawn:
But since theSELL_L_Lvl>0 condition is fulfilled, the line should be redrawn again, but at a new value ofSELL_NoLossLevel. Is there an easier and more obvious way to redraw the line, depending on the value ofSELL_Lvl?
Transfer the object to the new value without deleting it or re-creating it:
Transfer the object to the new value without deleting it or re-creating it:
This is certainly an option, but I would like the line to be redrawn by value ofSELL_NoLossLevel depending on whetherSELL_Lvlhas changed
like this if(ObjectGet("Sell no loss level", 1) !=SELL_NoLossLevel{ObjectDelete("Sell no loss level");}
The line is redrawn at every tick while I need it to be redrawn only ifSELL_Lvl changes
Of course it is a variant, but I would like the line to be redrawn bySELL_NoLossLevel depending on ifSELL_Lvl has changed
like this if(ObjectGet("Sell no loss level", 1) !=SELL_NoLossLevel{ObjectDelete("Sell no loss level");}
The line is redrawn on every tick, while I need it to be redrawn only ifSELL_Lvl changes
Explain the condition of line redrawing clearly, with real price values.
For the highlighted line: how much did it change? What indicates the fact that SELL_Lvl has changed?
i want to know what function to use to close a pending order in mcl5.
It is better to loop through, determine the right one and by documentation
Delete Pending Order
Trade order to delete a pending order. Requires 2 fields to be specified:
Better to cycle through, identify the right one and follow the documentation
Write down the condition for line redrawing clearly, with real price values, and then you will understand what you need to do.
On the highlighted: changed by how much? What indicates the fact that SELL_Lvl has changed?
I know how to find the price of a minimum order. I would appreciate if you could tell me how to find a minimum order ticket.
There is an example in the documentation.
It would probably be better to go through the orders in the loop and, provided that the next order is lower than the previous one, select it for further work with it. Thus, when we exit the loop, the order to be deleted will be selected.
Or you can first save its position in the order list in the loop and after the exit from the loop select it by the saved index.