Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 192
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
Then do you think this function won't work? I haven't tested it, but it seems to me to be part of a working code (this Ilan was obviously rebuilt from something debugged at best). Or is it still a crummy code?
Use it:
You are using:
Your function does not handle trade server errors. The OrderModify() function should be designed as a separate full-fledged function with error handling and adequate error response.
And again, what for?
What's the oil for?
Use:
No, we do not use this kind of g.
It would be strange to buy bread at 20, come home and change the purchase price to 5 roubles, and then see in your wallet the arrival of 15 roubles of difference... Fantastic... ;)
You could resell the bread for 35 roubles (15 roubles profit) but the broker wouldn't give you a commission :=)
Good afternoon. Started studying MQL a couple of days ago, reread the site but can't find the answer. (Don't judge a newbie)
If i had already tried that, i would have seen that many orders are now closed. Here is a simple code which should close an order when crossing a MA(5) and MA(21)
Here is the code to close the order by crossing MA(5) and MA(21). Thank you.
double ma50;
double ma51;
double ma210;
double ma211;
double ma550;
double Stoh;
int start()
{
//Open Orders--------------------------------------------------------------------------------
{
ma50=iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,0);
ma51=iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,1);
ma210=iMA(NULL,0,21,0,MODE_EMA,PRICE_CLOSE,0);
ma211=iMA(NULL,0,21,0,MODE_EMA,PRICE_CLOSE,1);
ma550=iMA(NULL,0,55,0,MODE_EMA,PRICE_CLOSE,0);
Stoh=iStochastic(Symbol(),5,5,3,3,MODE_SMA,1,MODE_MAIN,0);
if(OrdersTotal()==0 && ma50 > ma51 && ma50 > ma210 && ma51 < ma211 && ma210 > ma550 )
OrderSend(Symbol(),OP_BUY,Lots,Ask,0,0,0,"BUY",123,0,Red);
}
//Close Orders--------------------------------------------------------------------------------
{
if(OrdersTotal()==1 && ma50 < ma210 )
if(OrderSelect(10,SELECT_BY_POS)==true)
OrderClose(OrderMagicNumber(),Lots,Bid,1,CLR_NONE);
}
}
Good afternoon. Started studying MQL a couple of days ago, re-read the website, but can't find the answer. (Don't judge a newbie)
If i had already tried that, i would have seen that many orders are now closed. Here is a simple code which should close an order when crossing a MA(5) and MA(21)
Thank you.
Whether the code is correct or not depends directly on what you, and nobody else, mean by this term.
Here you are trying to open an order with a similar but slightly more incorrect attempt to close it.
The only thing I can advise you on is to go and study the language further, there is no hurry, because too small a base is the main reason for misunderstanding.
The parameters in OrderClose are not correct . + If you have one order OrderSelect is taken with number 0. + are you sure that after the next tick or two "ma50 < ma210" will not be executed by eating your spread?
and the code is inserted through the button SRC on the toolbar.
Good afternoon.
In the code of the indicator we need to catch the moment when a new trend appears on the chart, and get the name of this trend.
Besides tracking the list of all objects on every tick, fixing the moment of change in the number of objects and then going through the entire list in the hope to find the object that has just been applied... Is there any other, less expensive way? If so, how can this be implemented more easily?
Good afternoon.
In the code of the indicator we need to catch the moment when a new trend appears on the chart, and get the name of this trend.
Besides tracking the list of all objects on every tick, fixing the moment of change in the number of objects and then going through the entire list in the hope to find the object that has just been applied... Is there any other, less expensive way? If so, how can this be implemented more easily?
and in the part where the object is directly applied, add a link to the block with the processing of the above?
and in the part where the object is directly applied, add a link to the block with the processing of the above?