Jump to content

How to write this fonction in a shorter way, if you know it. thanx to reply


Recommended Posts

hi, not sure if am at the wright place to post my question, but i go, is there any other ways to write this expression in working mql4 code, i try to explain my strategy without taking 100 page to explain only one parameter in my ea. So the expression is: (serve to analyse the 104 last order closed) want to do the same for the last 103,102,101, ... and 4 last orders closed) expression =

(A*B*C*D*E*F*G*H*I*J*K*L*M*N*O*P*Q*R*S*T*U*V*W*X*Y*Z*A1*B1*C1*D1*E1*F1*G1*H1*I1*J1*K1*L1*M1*N1*O1*P1*Q1*R1*S1*T1*U1*V1*W1*X1*Y1*Z1*A2*B2*C2*D2*E2*F2*G2*H2*I2*J2*K2*L2*M2*N2*O2*P2*Q2*R2*S2*T2*U2*V2*W2*X2*Y2*Z2*A3*B3*C3*D3*E3*F3*G3*H3*I3*J3*K3*L3*M3*N3*O3*P3*Q3*R3*S3*T3*U3*V3*W3*X3*Y3*Z3) >0 && (A+B+C+D+E+F+G+H+I+J+K+L+M+N+O+P+Q+R+S+T+U+V+W+X+Y+Z+A1+B1+C1+D1*E1+F1+G1+H1+I1+J1+K1+L1+M1+N1+O1+P1+Q1+R1+S1+T1+U1+V1+W1+X1+Y1+Z1+A2+B2+C2+D2+E2+F2+G2+H2+I2+J2+K2+L2+M2+N2+O2+P2+Q2+R2+S2+T2+U2+V2+W2+X2+Y2+Z2+A3+B3+C3+D3+E3+F3+G3+H3+I3+J3+K3+L3+M3+N3+O3+P3+Q3+R3+S3+T3+U3+V3+W3+X3+Y3+Z3)>0

 

if 2 expression = false (mean do x thing)

if 2 expression = true (mean do y thing)

 

so i want to add 100 time this kind of expression in my ea just to check the current level reach.

Thanx in advance.

Link to comment
Share on other sites

you can use two nested for loops

 

for(int k=104; k>=4; k--)

{

exp1=0; exp2=0;

 

for(int i= 0 i<k; i++)

{

//calculate expression 1 and 2 by running through the OrderHistory

exp1*=x; //maybe OrderProfit or somthing like this

exp2+=y

}

//evaluate exp1+2

if(exp1>0 && exp2>0)

.......

}

Edited by iwjw
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...