In mql4 I used iCustom to make indicators that use someone else's ready-made indicators, even though I know nothing about programming... I have had enough of intuition. I am using mql5 but nothing works, no matter how hard I try to understand it. Please help me, please.
I have this indicator in ex5. I put it in my Downloads folder. I want to take both of its lines and draw it on the chart in other periods, i.e. make it multitime frame with iCustom.
Since I cannot write an indicator from scratch, I have taken the code of a simple Bears Power indicator. I haven't changed anything there, except for changing indicator_chart_window and DRAW_LINE and the line, which, to my mind, should take out the data of the first buffer with default parameters of the current TF:
Everything compiles, nothing gets drawn. What else does it need? :(
#property copyright"2009, MetaQuotes Software Corp."#property link"http://www.mql5.com"#property description"Bears Power"//--- indicator settings#property indicator_chart_window//---------------------------------#property indicator_buffers2#property indicator_plots1#property indicator_type1DRAW_LINE//---------------------------------------#property indicator_color1 Silver
#property indicator_width12//--- input parametersinputint InpBearsPeriod=13; // Period//--- indicator buffersdouble ExtBearsBuffer[];
double ExtTempBuffer[];
//--- handle of EMA int ExtEmaHandle;
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+voidOnInit()
{
//--- indicator buffers mappingSetIndexBuffer(0,ExtBearsBuffer,INDICATOR_DATA);
SetIndexBuffer(1,ExtTempBuffer,INDICATOR_CALCULATIONS);
//---IndicatorSetInteger(INDICATOR_DIGITS,_Digits+1);
//--- sets first bar from what index will be drawnPlotIndexSetInteger(0,PLOT_DRAW_BEGIN,InpBearsPeriod-1);
//--- name for DataWindow and indicator subwindow labelIndicatorSetString(INDICATOR_SHORTNAME,"Bears("+(string)InpBearsPeriod+")");
//--- get MA handle
ExtEmaHandle=iMA(NULL,0,InpBearsPeriod,0,MODE_EMA,PRICE_CLOSE);
//--- initialization done
}
//+------------------------------------------------------------------+//| Average True Range |//+------------------------------------------------------------------+intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime &Time[],
constdouble &Open[],
constdouble &High[],
constdouble &Low[],
constdouble &Close[],
constlong &TickVolume[],
constlong &Volume[],
constint &Spread[])
{
int i,limit;
//--- check for bars countif(rates_total<InpBearsPeriod)
return(0);// not enough bars for calculation //--- not all data may be calculatedint calculated=BarsCalculated(ExtEmaHandle);
if(calculated<rates_total)
{
Print("Not all data of ExtEmaHandle is calculated (",calculated,"bars ). Error",GetLastError());
return(0);
}
//--- we can copy not all dataint to_copy;
if(prev_calculated>rates_total || prev_calculated<0) to_copy=rates_total;
else
{
to_copy=rates_total-prev_calculated;
if(prev_calculated>0) to_copy++;
}
//---- get ma buffersif(IsStopped()) return(0); //Checking for stop flagif(CopyBuffer(ExtEmaHandle,0,0,to_copy,ExtTempBuffer)<=0)
{
Print("getting ExtEmaHandle is failed! Error",GetLastError());
return(0);
}
//--- first calculation or number of bars was changedif(prev_calculated<InpBearsPeriod)
limit=InpBearsPeriod;
else limit=prev_calculated-1;
//--- the main loop of calculationsfor(i=limit;i<rates_total && !IsStopped();i++)
{
ExtBearsBuffer[i]=iCustom(NULL,0,"Downloads\\RSI Analytics"); \\--------------------------------------------
}
//--- return value of prev_calculated for next callreturn(rates_total);
}
//+------------------------------------------------------------------+
Зачем нам RSI в отдельном окне, если его можно построить в основном окне графика, что гораздо более понятно? RSI ANALYTICS - это индикатор, следящий за рынком, созданный на основе той же идеи, что и традиционный RSI (индекс относительной силы). При этом он строится не в отдельном подокне, а в том же окне, что и график цены финансового...
In mql4 I used iCustom to make indicators that use someone else's ready-made indicators, even though I know nothing about programming... I have had enough of intuition. I am using mql5 but nothing works, no matter how hard I try to understand it. I want to ask you for help.
I have this indicator in ex5. I put it in my Downloads folder. I want to take both its lines and draw it on the chart in other periods, i.e. make it multitime frame with iCustom.
Since I cannot write an indicator from scratch, I have taken the code of a simple Bears Power indicator. I haven't changed anything there, except for changing indicator_chart_window and DRAW_LINE and the line, which, to my mind, should take out the data of the first buffer with default parameters of the current TF:
Everything compiles, nothing gets drawn. What else does it need? :(
In mql5 the work with custom and standard indicators is organized differently than in mql4. If in mql4 you can get only one indicator value through iCustom, in mql5 you can get indicator values for the whole depth of history in the array. The second major difference is the direction of indexing in the indicator buffers.
It's tedious to look through all the code and check it against the original, so I'll only point out the main ones:
The file must be located in the Indicators folder or in a subfolder located in the same Indicators.
And then you can process the indicator values from this additional buffer in some way, or you can put them into the indicator buffer without forgetting about the direction of indexing.
Thank you! I wrote something as I understood it, and now only one error pops up when compiling. On the line
errorto_copy - undeclared identifier.
In which section and how do I declare it?
You need to compare my hints with your code and with the source code you already fixed. This variable is declared in those codes. And in addition to my remarks, you should try to understand the logic of building indicators in general, and not just change a piece of shit for a piece of shit.
lil_lil: In MetaTrader 5, can the performance of one EA on a currency pair be radically different from the performance, for example, on the RTS Index?
The councillor will work the way it is written. And not otherwise.
As for the nuances that must be considered: RTS is an exchange, hence the NETTING type of accounting positions. If the EA is not originally designed to work on the netting, the result is unpredictable.
The councillor will work the way it is written. And not otherwise.
As for the nuances that must be considered: RTS is an exchange, hence the NETTING type of accounting positions. If the EA is not originally designed to work on netting, the result is unpredictable.
If your EA is not intendedto work on netting, the result is unpredictable.
There are no multi-directional positions in the strategy.
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.
In mql4 I used iCustom to make indicators that use someone else's ready-made indicators, even though I know nothing about programming... I have had enough of intuition. I am using mql5 but nothing works, no matter how hard I try to understand it. Please help me, please.
I have this indicator in ex5. I put it in my Downloads folder. I want to take both of its lines and draw it on the chart in other periods, i.e. make it multitime frame with iCustom.
Since I cannot write an indicator from scratch, I have taken the code of a simple Bears Power indicator. I haven't changed anything there, except for changing indicator_chart_window and DRAW_LINE and the line, which, to my mind, should take out the data of the first buffer with default parameters of the current TF:
Everything compiles, nothing gets drawn. What else does it need? :(
In mql4 I used iCustom to make indicators that use someone else's ready-made indicators, even though I know nothing about programming... I have had enough of intuition. I am using mql5 but nothing works, no matter how hard I try to understand it. I want to ask you for help.
I have this indicator in ex5. I put it in my Downloads folder. I want to take both its lines and draw it on the chart in other periods, i.e. make it multitime frame with iCustom.
Since I cannot write an indicator from scratch, I have taken the code of a simple Bears Power indicator. I haven't changed anything there, except for changing indicator_chart_window and DRAW_LINE and the line, which, to my mind, should take out the data of the first buffer with default parameters of the current TF:
Everything compiles, nothing gets drawn. What else does it need? :(
In mql5 the work with custom and standard indicators is organized differently than in mql4. If in mql4 you can get only one indicator value through iCustom, in mql5 you can get indicator values for the whole depth of history in the array. The second major difference is the direction of indexing in the indicator buffers.
It's tedious to look through all the code and check it against the original, so I'll only point out the main ones:
The file must be located in the Indicators folder or in a subfolder located in the same Indicators.
Here is the line to get the MA indicator handle
and this is the string to get the value of MA indicator
in this case to an additional buffer or array.
It turns out that to get data of the custom indicator
And then you can process the indicator values from this additional buffer in some way, or you can put them into the indicator buffer without forgetting about the direction of indexing.
Thank you! I wrote something as I understood it, and now only one error pops up when compiling. On the line
errorto_copy - undeclared identifier.
In which section and how do I declare it?
Thank you! I wrote something as I understood it, and now only one error pops up when compiling. On the line
errorto_copy - undeclared identifier.
In which section and how do I declare it?
You need to compare my hints with your code and with the source code you already fixed. This variable is declared in those codes. And in addition to my remarks, you should try to understand the logic of building indicators in general, and not just change a piece of shit for a piece of shit.
In MetaTrader 5, can the performance of one EA on a currency pair be radically different from the performance, for example, on the RTS Index?
The councillor will work the way it is written. And not otherwise.
As for the nuances that must be considered: RTS is an exchange, hence the NETTING type of accounting positions. If the EA is not originally designed to work on the netting, the result is unpredictable.
The councillor will work the way it is written. And not otherwise.
As for the nuances that must be considered: RTS is an exchange, hence the NETTING type of accounting positions. If the EA is not originally designed to work on netting, the result is unpredictable.
If your EA is not intendedto work on netting, the result is unpredictable.
There are no multi-directional positions in the strategy.
Thank you, how do you know for sure from the code if it is designedto work on netting or not.
There are no oppositely directed positions in the strategy.
And, if so (always ONE position in work), then there is no difference - whether netting or hedging.
If this is the case (there is always ONE position in operation), it makes no difference whether it is netting or hedging.
On a reverse signal in currencies (Forex) positions are closed, but not on the exchange. Where to look, what to look for?
On a reverse signal on currencies, positions are closed, but not on the exchange. Where to look, what to look for?
To look for the place where the command to close the position comes from.