Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 592
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
Please advise why adding the string #property strict prevents arrows from being drawn, here is all the code
//+------------------------------------------------------------------+
//| oscillating review.mq4 |
//| Copyright 2018, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_plots 4
//--- plot Signaler
#property indicator_label1 "Signaler"
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrRed
#property indicator_style1 STYLE_SOLID
#property indicator_width1 1
//--- plot Z
#property indicator_label2 "Z"
#property indicator_type2 DRAW_LINE
#property indicator_color2 clrBeige
#property indicator_style2 STYLE_DOT
#property indicator_width2 1
//--- plot Bay
#property indicator_label3 "Bay"
#property indicator_type3 DRAW_ARROW
#property indicator_color3 clrLightSkyBlue
#property indicator_style3 STYLE_SOLID
#property indicator_width3 1
//--- plot Sell
#property indicator_label4 "Sell"
#property indicator_type4 DRAW_ARROW
#property indicator_color4 clrDeepPink
#property indicator_style4 STYLE_SOLID
#property indicator_width4 1
//--- input parameters
input int PCCI=14; // indicator period PCCI
input double KCCI=1.1; //adjustment factor
input int PMOM=14; //period of Momentum indicator
input int KMOM=1111; // smoothing factor
input int PATR=14; // indicator period ATR
input int KATR=111111; // smoothing factor
input int PFOR=14; // period of the Forse indicator
input int KFOR=1111; // smoothing factor
input int PTVR=12; // period p of TVI indicator
input int PTVS=12; // period c of TVI indicator
input int PTVU=5; //period at TPI indicator
input int KTVl=111; // leveling coefficient
input int POSF=12; // period of AOS fast indicator
input int POSS=26; // period of AOS indicator slot
input int POSZ=9; //small period of AOS indicator
input int KAOS=111111; // smoothing factor
input int KAD=111; //displacement factor of AOS indicator
input double KK=2.0; // filter for arrows
input int Amendment=20; //draw arrows in the indicator window in a digestible format
//--- indicator buffers
double SignalerBuffer[];
double Z_Buffer[];
double BayBuffer[]; double BayBuffer[];
double SellBuffer[]; double SellBuffer[];
double PatchBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialisation function |
//+------------------------------------------------------------------+
int OnInit()
{
IndicatorSetInteger(INDICATOR_DIGITS,0);
SetIndexBuffer(0,SignalerBuffer);
SetIndexBuffer(1,Z_Buffer);
SetIndexBuffer(2,BayBuffer);
SetIndexBuffer(3,SellBuffer);
SetIndexBuffer(4,PatchBuffer);
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexStyle(2,DRAW_ARROW);
SetIndexStyle(3,DRAW_ARROW);
SetIndexArrow(2,241);
SetIndexArrow(3,242);
SetIndexEmptyValue(2,0.0);
SetIndexEmptyValue(3,0.0);
IndicatorShortName("Basement signaler(" +(string) PATR + ")");
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
int i , limit=rates_total-prev_calculated ;
double cci,atr,mom,forc,ao,ac,ad,tvi,osma ;
//---- set the counting parameters
if(prev_calculated==0)limit--;
else limit++;
//---- count
for(i=limit-1; i>=0; i--)
{
cci=iCCI(NULL,0,PCCI,PRICE_TYPICAL,i)/KCCI;
mom=(iMomentum(NULL,0,PMOM,PRICE_TYPICAL,i)-100)*KMOM ;
forc=iForce(NULL,0,PFOR,MODE_SMA,PRICE_TYPICAL,i)*KFOR;
tvi=iCustom(NULL,0, "TVI_v2",PTVR,PTVS,PTVU,4,i)*KTVl ;
osma=iOsMA(NULL,0,POSF,POSS,POSZ,PRICE_TYPICAL,i)*KAOS;
atr=iATR(NULL,0,PATR,i)*KATR;
ao=iAO(NULL,0,i)*KAOS ;
ac=iAC(NULL,0,i)*KAOS ;
ad=iAD(NULL,0,i)/KAD ;
SignalerBuffer[i]=(cci+mom+forc+tvi+osma+atr+ao+ac+ad)/9 ;
}
for(i=limit-1; i>=0; i--)
{
Z_Buffer[i] = (SignalerBuffer[i]+SignalerBuffer[i-1])/2 ;
PatchBuffer[i] = MathAbs(SignalerBuffer[i]-Z_Buffer[i]) ;
}
for(i=0; i<limit && !IsStopped(); i++)
{
if(Z_Buffer[i]>SignalerBuffer[i]&&Z_Buffer[i+1]<SignalerBuffer[i+1]&&PatchBuffer[i]>KK)
BayBuffer[i]=SignalerBuffer[i]-Amendment;
if(Z_Buffer[i]<SignalerBuffer[i]&&Z_Buffer[i+1]>SignalerBuffer[i+1]&&PatchBuffer[i]>KK)
SellBuffer[i]=SignalerBuffer[i]+Amendment;
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
To the seller of this indicator.
Can anyone tell me what to do if during an EA test it refuses to copy buffers?
Identify the cause.
Identify the cause.
And what might it be? Is it the size of the code? I purposely disabled all logic, left only buffer copying and nothing
And what might it be? Is it the size of the code? I purposely disabled all logic, left only buffer copying and nothing
An out of memory error pops up when running a test (won't start). How to fix it?
After restarting the terminal, the test starts and then after a few tests it is out of memory again.
An out of memory error pops up when running a test (won't start). How to fix it?
After restarting the terminal, the test starts, and then after several tests out of memory again.
The program you are testing eats up all your memory. Look for errors in it. Check the "Journal" and "Expert Advisors" logs on the demo (not in the tester) - what does it say there? Perhaps, it says something about memory leakage during the timeframe change.
I will not guess further without the code.
The programme you are testing eats up all your memory. Look for errors in it. Look at the logs "Log" and "Expert Advisors" on the demo (not in the tester) - what does it say there? Perhaps, it says something about memory leakage during the timeframe change.
I would not guess further without the code.
There are a lot of undeleted objects in logs after testing is over. Several thousand... Is that a problem?
There's a pile of unsuccessful objects in the logs after testing ends. Several thousand... Is that the problem?
This is where they'll be able to answer for sure.