My Expert Advisor analyses charts for a number of months, but there are charts that return the entire history on a minute chart, and there are charts that do not show more than a month and a half, and even that is if you scroll the chart back manually, it does not even scroll past a certain date.
pycha: My Expert Advisor analyses the chart for a certain number of months, but there are charts that return the entire history in the minute chart, and there are charts that do not want to return more than a month and a half, and even that's if you scroll the chart back manually, even beyond a certain date it does not scroll manually.
The broker decides exactly how much history to give. If the maximum number of bars is set in the terminal settings, and there are less of them on the chart, then the broker will not give more.
Hello Dear forum users. I would like to make a request. Would someone be able to post a piece of code with a working iEnvelopesOnArray() function? My all my attempts to tame it so far have been unsuccessful. I suspect it is the developers' fault. Here is an indicator to check its work.
//+------------------------------------------------------------------+//| Tester_EnvOnArray.mq4 |//| Copyright 2005 г. до нашей эры, MetaQuotes Software Company. |//| https://www.mql4.com |//+------------------------------------------------------------------+#property copyright"2005 г. до нашей эры, MetaQuotes Software Company."#property link"https://www.mql4.com"#property description"Пример индикатора для проверки работы функции iEnvelopesOnArray()"#property strict//--- indicator settings#property indicator_chart_window#property indicator_buffers2#property indicator_color1 Green
#property indicator_color2 Red
//--- indicator buffersdouble ExtEnvBuffer[];
double ExtPriceBuffer[];
//--- bars minimum for calculation#define DATA_LIMIT 100//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+voidOnInit(void)
{
IndicatorShortName("EnvOnArr");
//--- 1 additional buffer are used for counting.
IndicatorBuffers(2);
IndicatorDigits(Digits + 2);
//--- drawing settings
SetIndexStyle(0, DRAW_LINE);
SetIndexDrawBegin(0, DATA_LIMIT);
SetIndexStyle(1, DRAW_NONE);
SetIndexDrawBegin(1, DATA_LIMIT);
//--- all indicator buffers mappingSetIndexBuffer(0, ExtEnvBuffer);
SetIndexBuffer(1, ExtPriceBuffer);
//--- name for DataWindow and indicator subwindow label
SetIndexLabel(0, NULL);
SetIndexLabel(1, NULL);
}
//+------------------------------------------------------------------+//| EnvelopesOnArray |//+------------------------------------------------------------------+intOnCalculate (constint rates_total,
constint prev_calculated,
constdatetime & time[],
constdouble & open[],
constdouble & high[],
constdouble & low[],
constdouble & close[],
constlong & tick_volume[],
constlong & volume[],
constint & spread[])
{
int i, limit;
double prev = 0.0, Deviation = 1;
//--- check for rates totalif(rates_total <= DATA_LIMIT)
return(0);
//--- last counted bar will be recounted
limit = rates_total - prev_calculated;
if(prev_calculated > 0)
{
limit++;
}
//--- price counted in the 2-nd additional bufferfor(i=0; i<limit-1; i++)
ExtPriceBuffer[i] = close[i];
//--- price counted in the 1-st additional bufferfor(i=0; i<limit-1; i++)
ExtEnvBuffer[i] = iEnvelopesOnArray(ExtPriceBuffer, 0, 5, MODE_SMA, 0, 1, MODE_UPPER, i);
//--- donereturn(rates_total);
}
//+------------------------------------------------------------------+
Hello, could you help me please - I have a problem: Robot enters a position and on the next tick it modifies its stop-loss to the previous low and I need that stop-loss is modified only when the candle closes on which the position was opened
void TrailingStop()
{
for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true);
{
if (OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
{
if (OrderType()==OP_BUY)
{
double LOW_1 = iLow(NULL,0,1);
bool res=OrderModify(OrderTicket(),OrderOpenPrice(),LOW_1,OrderTakeProfit(),0,White);
if(!res) Print("Ошибка модификации ордера. Код ошибки=",GetLastError());
}
if (OrderType()==OP_SELL)
{
double HIGH_1 = iHigh(NULL,0,1);
res=OrderModify(OrderTicket(),OrderOpenPrice(),HIGH_1,OrderTakeProfit(),0,White);
if(!res) Print("Ошибка модификации ордера. Код ошибки=",GetLastError());
}
}
}
}
return;
}
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.
#property icon "\\\\Images\\\\xxx.ico";
and it was not fixed in any way?
As you can see.
However, the most logical and easiest way to proxy is to prohibit the MT window tool change. So I suggest that we consider it a bug :)
My Expert Advisor analyses the chart for a certain number of months, but there are charts that return the entire history in the minute chart, and there are charts that do not want to return more than a month and a half, and even that's if you scroll the chart back manually, even beyond a certain date it does not scroll manually.
Hello Dear forum users. I would like to make a request. Would someone be able to post a piece of code with a working iEnvelopesOnArray() function? My all my attempts to tame it so far have been unsuccessful. I suspect it is the developers' fault. Here is an indicator to check its work.
Hi all. I am getting errors during the test:
2014.12.25 18:04:31.125 2014.11.03 00:00 Test3 EURUSD,H4: invalid ticket for OrderModify function
2014.12.25 18:04:31.125 2014.11.03 00:00 Test3 EURUSD,H4: OrderModify error 4051
I double-checked it many times, there is no error (as far as I think).
Failure occurs in this part of program:
ModifyBuy, ModifySell, SelectBuy, SelectSell - have type bool
SendBuy, SendSell-int , int TP = 30
while(true)
{
SPREAD=MarketInfo(Symb,MODE_SPREAD);
SelectBuy=OrderSelect(OrderTicketBuy,SELECT_BY_TICKET);//buy
RefreshRates();
if(NormalizeDouble(OrderOpenPrice()+TP*Point,Digits)<NormalizeDouble(Ask,Digits))
{
ModifyBuy=OrderModify(OrderTicket(),OrderOpenPrice(),Bid-(10-SPREAD)*Point,Bid+(30- SPREAD)*Point,0,0);
R=1;
break;
}//if2
Timen=OrderCloseTime();
if(Timen>0)
{
//--------------------------
Stop=StopLevel(Symb);
StopLong();//значение Long2
StopLoss_Func();//значение SL
//--------------------------
SendBuy=OrderSend(Symb,OP_BUYSTOP,Lote,Ask+Long2*Point,1,Bid-SL*Point,NULL);
for(i=1;i>OrdersTotal();i++)
{
if(OrderSelect(i-1,SELECT_BY_POS,MODE_TRADES)==true)//Проверяем есть ли ордер
{
if(OrderSymbol()!=Symb) continue;
if(OrderType()==4)
{
OrderTicketBuy=OrderTicket();
break;
}
else
{
continue;
}
}
}
continue;
}//if2
SelectSell=OrderSelect(OrderTicketSell,SELECT_BY_TICKET,MODE_TRADES);//sell
RefreshRates();
if(NormalizeDouble(OrderOpenPrice()-TP*Point,Digits)>NormalizeDouble(Bid,Digits))
{
ModifySell=OrderModify(OrderTicket(),OrderOpenPrice(),Ask+(10-SPREAD)*Point,Ask-(30- SPREAD)*Point,0,0);
R=2;
break; //спред
}//if2
Timen=OrderCloseTime();
if(Timen>0)
{
//--------------------------
Stop=StopLevel(Symb);
StopLong();
StopLoss_Func();
//--------------------------
SendSell=OrderSend(Symb,OP_SELLSTOP,Lote,Bid-Long2*Point,1,Ask+SL*Point,NULL);
for(i=1;i>OrdersTotal();i++)
{
if(OrderSelect(i-1,SELECT_BY_POS,MODE_TRADES)==true)//Проверяем есть ли ордер
{
if(OrderSymbol()!=Symb) continue;
if(OrderType()==6)
{
OrderTicketSell=OrderTicket();
break;
}
else
{
continue;
}
}
}
continue;
}//if2
}//while1
If you need the whole code, here
Thank you!
Hello, could you help me please - I have a problem: Robot enters a position and on the next tick it modifies its stop-loss to the previous low and I need that stop-loss is modified only when the candle closes on which the position was opened