[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 597
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
Good afternoon, continuing to get to grips with coding, took the example EA from the tutorial section article, replaced the code from the example:
To an arbitrary one for training purposes:
The trades don't show up, could you please tell me what's the reason, how to fix the code.Urain, thank you, I never cease to be amazed at the logic of mql, and if you try to use for(int i=1; to try, the script will not simplify - could you tell me how to format it, I cannot yet feel the logic of the language, how to define the operator that moves the array?
P. S. I declared the array, by mistake in the example script has removed:
Differences in prices. As a consequence, different, to the contrary, indicator results...
#property indicator_buffers 2
#property indicator_color1 blue
#property indicator_color2 Red
extern int n = 20;
extern int t3_period = 5;
extern double b = 0.618;
extern int mBars = 300;
extern int Bars.Count = 0;
int i,t,c;
double Buf1[],Buf2[],CF_p[5001],CF_n[5001],Ch_p[5001],Ch_n[5001],k_n,k_p,ch_p,ch_n,cff_p,cff_n,
AcBars,t3,t32,A1,A2,b2,b3,c1,c2,c3,c4,e1,e2,e3,e4,e5,e6,n1,w1,w2,e12,e22,e32,e42,e52,e62;
//+------------------------------------------------------------------+
int init() {
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(0, Buf1);
SetIndexStyle(1, DRAW_LINE);
SetIndexBuffer(1, Buf2);
return(0); }
//+------------------------------------------------------------------+
int start() {
int limit;
if (IndicatorCounted()<0) return(-1);
limit=Bars-IndicatorCounted();
if (Bars.Count>0 && limit>Bars.Count) limit=Bars.Count;
for(int i=0; i<limit; i++)
{
b2=b*b; b3=b2*b; c1=-b3; c2=(3*(b2+b3)); c3=-3*(2*b2+b3); c4=(1+3*b+b3+3*b2); n1=t3_period;
if(n1<1) n1=1; n1=1+0.5*(n1-1); w1=2/(n1+1); w2=1-w1;
if(AcBars==0) AcBars=Bars-mBars;
for(c=AcBars; c<=Bars-1; c +++) { i=Bars-1-c; {
if(Close[i]>Close[i+1]) { Ch_p[i]=Close[i]-Close[i+1]; CF_p[i]=Ch_p[i]+CF_p[i+1]; Ch_n[i]=0; CF_n[i]=0; }
else { Ch_p[i]=0; CF_p[i]=0; Ch_n[i]=Close[i+1]-Close[i]; CF_n[i]=Ch_n[i]+CF_n[i+1]; }}
for(t=i+n; t>=i; t--) { ch_p=Ch_p[t]+ch_p; ch_n=Ch_n[t]+ch_n ; cff_p=CF_p[t]+cff_p; cff_n=CF_n[t]+cff_n; }
k_p=ch_p-cff_n; k_n=ch_n-cff_p;
A1=k_p; e1=w1*A1+w2*e1; e2=w1*e1+w2*e2; e3=w1*e2+w2*e3; e4=w1*e3+w2*e4;
e5=w1*e4+w2*e5; e6=w1*e5+w2*e6; t3=c1*e6+c2*e5+c3*e4+c4*e3; Buf1[i]=t3;
A2=k_n; e12=w1*A2+w2*e12; e22=w1*e12+w2*e22; e32=w1*e22+w2*e32; e42=w1*e32+w2*e42;
e52=w1*e42+w2*e52; e62=w1*e52+w2*e62; t32=c1*e62+c2*e52+c3*e42+c4*e32; Buf2[i]=t32;
AcBars=AcBars+1; ch_p=0; ch_n=0; cff_p=0; cff_n=0; }
}
return(0); }
Can you tell me where the error is not updating, the history is normal and the online one is not
Good afternoon. An array has been declared, the operator that moves the array index has been set, but the orders are not being placed. Please tell me what is wrong.
TryOrderSend, then it works...
Have you read the standard MetaEditore helper? If not, read the whole...
Good afternoon. I have declared an array and defined the operator that moves the array index, but the orders are not placed. Please, advise what is wrong.
I need to find one open position that has the largest loss.
The point is that I need to find the position with more profit than the losing one and close them in counter-close.
Maybe someone has some experience with this, or has faced such a problem?
Try OrderSend, then it works...
Have you read the standard MetaEditore helper? If not, read it all...
Of childish age to ask a question without having addressed to help and yandex have grown. There are a lot of Sends, but the positions do not open: