Trendy: Hello, I'm currently studying MQL4 tutorial by Sergey Kovalev and I haven't found yet how to access time series arrays of other currency pairs. I.e., I need to upload into one EA arrays of time series of several currency pairs. I know that some data can be accessed using the MarketInfo() function, but the problem is that in the request IDs, there are no close or other parameters for price series. Please, advise where I can read how to organize work (if any) with arrays-timeseries and several instruments, or maybe how to circumvent this limitation.
double iClose(
string symbol, int timeframe, int shift)
Returns the closing price value of the bar specified by the shift parameter from the corresponding chart(symbol,timeframe). In the case of error, the function returns 0. For more information about the error, call GetLastError(). For the current chart, information about closing prices can be found in predefined array Close[].
Parameters:
symbol
-
Symbol name of the symbol. NULL means current symbol.
Hello friends. There is a need to implement the following thing: stochastic crosses some level from top to bottom n-number of times and on condition that it happens within a certain time interval the variable is assigned a value (+). Well, if for example in 30 minutes stochastic crosses 80 three times from top to bottom. Thank you in advance)
I am using this indicator, but it tends to freeze after every new bar opens. I think it's because of the large number of bars being recalculated. I tried to limit the number of bars but it doesn't work - the indicator changes its appearance. Can someone help me with this function? I would be very grateful!
Hello! The only profit-taker in the EA is Trailing Stop, which effectively closes trades. There is no separate StopLoss and TakeProfit.
Of course, there are situations when the EA opens in one direction, while the market goes in another one.
In such cases, deals are closed with minimal profit, but 2 deals of the testing period were closed with -2.40 and -2.50 losses.
In the test results, StopLoss is set several points above or even below the opening price of the trade.
Here is the Trailing code from MacdSample below. Please help to understand!
//-------------------------Trailing Stop----------------------------------+for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL && // check for opened position
OrderSymbol()==Symbol()) // check for symbol
{
if(OrderType()==OP_BUY) // long position is opened
{
// check for trailing stopif(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
return(0);
}
}
}
}
else// go to short position
{
// check for trailing stopif(TrailingStop>0)
{
if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
{
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
return(0);
}
}
}
}
}
}
return(0);
The thing is, I can't figure out why Trailing Stop closes a trade at all before the distance between the present price and the opening price has exceeded the TS value, after the price has moved in the opposite direction to the opening and then returned to the opening price?
Good afternoon. I want to open an order with 0.01 volume on my account $12.93, stop loss and take profit 0, but the program says not enough money, why?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Half an hour yesterday, and half an hour today, and half an hour in the forum before it got to!!!!!!!! Thanks!!!!!!!!!!
...you can also go like this: -yeah, thanks. I'm good as it is, clear and simple function!
Hello, I'm currently studying MQL4 tutorial by Sergey Kovalev and I haven't found yet how to access time series arrays of other currency pairs. I.e., I need to upload into one EA arrays of time series of several currency pairs. I know that some data can be accessed using the MarketInfo() function, but the problem is that in the request IDs, there are no close or other parameters for price series. Please, advise where I can read how to organize work (if any) with arrays-timeseries and several instruments, or maybe how to circumvent this limitation.
For the current chart, information about closing prices can be found in predefined array Close[].
Print("Current bar for USDCHF H1: ",iTime("USDCHF",PERIOD_H1,i),", ", iOpen("USDCHF",PERIOD_H1,i),", ", iHigh("USDCHF",PERIOD_H1,i),", ", iLow("USDCHF",PERIOD_H1,i),", ", iClose("USDCHF",PERIOD_H1,i),", ", iVolume("USDCHF",PERIOD_H1,i);It's like this.
There is an indicator compiled in ex4 which is a
a strip of blue and red dots as a signal to buy or sell.
I need code for a condition to enter a trade when the bar chart changes colour.
I would be very grateful, even for an outline.
Greetings all!
I am using this indicator, but it tends to freeze after every new bar opens. I think it's because of the large number of bars being recalculated. I tried to limit the number of bars but it doesn't work - the indicator changes its appearance. Can someone help me with this function? I would be very grateful!
Tried it. EMA on mql and in dll.
It's quite noticeable. If the calculations are more complex, it will be more noticeable.
I'll let you know. I've got a lot of cycles in there as well.
Hello! The only profit-taker in the EA is Trailing Stop, which effectively closes trades. There is no separate StopLoss and TakeProfit.
Of course, there are situations when the EA opens in one direction, while the market goes in another one.
In such cases, deals are closed with minimal profit, but 2 deals of the testing period were closed with -2.40 and -2.50 losses.
In the test results, StopLoss is set several points above or even below the opening price of the trade.
Here is the Trailing code from MacdSample below. Please help to understand!
Hello...
Probably a swap.
Probably a swap.
The thing is, I can't figure out why Trailing Stop closes a trade at all before the distance between the present price and the opening price has exceeded the TS value, after the price has moved in the opposite direction to the opening and then returned to the opening price?
I want to open an order with 0.01 volume on my account $12.93, stop loss and take profit 0, but the program says not enough money, why?