MQL4 Learning - page 88

 
luxinterior:
You've actually already answered your own question.

The iHighest function returns the index of the highest bar during the specified period so just store that in an integer and use it in your iLowest function.

Good luck

Lux

Thank you Lux, yes that worked great!! Next time, Ill look more closely to the MQL docs. thanks again J

 
Roger09:
Look at ObjectMove() function.

how do i retrieve the stpoloss price??? i do not know anything about mlq4 language????

 
Roger09:
Look at ObjectMove() function.

how do i retrieve the stpoloss price??? i do not know anything about mlq4 language????

 
raul_jr00:
how do i retrieve the stpoloss price??? i do not know anything about mlq4 language????

So, how can we explain you something if you don't know anything about MQL4?

 

Could somebody pls help me to change the code into MT4?

CBLhi: FormulaHighDays := Input("Enter # days to cover last HIGH for CBL calc'n:", 3, 55, 13); If(HIGH < HHV(HIGH, HighDays), {then ...} PREV, {previous CBLhi, else...} If(Ref(L,-2) < Ref(L,-1) AND Ref(L,-2) < L AND Ref(L,-1) < L, {then ...} Ref(L,-2), {2nd day back low, else...} If((Ref(L,-3)< Ref(L,-2) AND Ref(L,-3) < Ref(L,-1) AND Ref(L,-3) < L) AND (Ref(L,-2)< L OR Ref(L,-1) < L), {then ... } Ref(L,-3), {3rd day back low, else...} If((Ref(L,-4)< Ref(L,-3) AND Ref(L,-4) < Ref(L,-2) AND Ref(L,-4) < Ref(L,-1) AND Ref(L,-4) < L) AND (Ref(L,-3)< L OR Ref(L,-2) < L OR Ref(L,-1) < L), {then... } Ref(L,-4), {4th day back low, else...} If((Ref(L,-5)< Ref(L,-4) AND Ref(L,-5) < Ref(L,-3) AND Ref(L,-5) < Ref(L,-2) AND Ref(L,-5) < Ref(L,-1) AND Ref(L,-5) < L) AND (Ref(L,-4)< L OR Ref(L,-3) < L OR Ref(L,-2) < L OR Ref(L,-1) < L), {then ...} Ref(L,-5), {5th day back low, else...} PREV )))))

and for the CBL from a LOW:

CBLlo: FormulaLowDays := Input("Enter # days to cover last LOW for CBL calc'n:", 3, 55, 13); If(LOW > LLV(LOW, LowDays), {then ...} PREV, {previous CBLlo, else...} If(Ref(H,-2) > Ref(H,-1) AND Ref(H,-2) > H AND Ref(H,-1) > H, {then ...} Ref(H,-2), {2nd day back high,else...} If((Ref(H,-3)> Ref(H,-2) AND Ref(H,-3) > Ref(H,-1) AND Ref(H,-3) > H) AND (Ref(H,-2)> H OR Ref(H,-1) > H), {then ... } Ref(H,-3), {3rd day back high,else...} If((Ref(H,-4)> Ref(H,-3) AND Ref(H,-4) > Ref(H,-2) AND Ref(H,-4) > Ref(H,-1) AND Ref(H,-4) > H) AND (Ref(H,-3)> H OR Ref(H,-2) > H OR Ref(H,-1) > H), {then... } Ref(H,-4), {4th day back high,else...} If((Ref(H,-5)> Ref(H,-4) AND Ref(H,-5) > Ref(H,-3) AND Ref(H,-5) > Ref(H,-2) AND Ref(H,-5) > Ref(H,-1) AND Ref(H,-5) > H) AND (Ref(H,-4)> H OR Ref(H,-3) > H OR Ref(H,-2) > H OR Ref(H,-1) > H), {then ...} Ref(H,-5), {5th day back high,else...} PREV )))))

 

Or change this one ? up to you, thanks!

INPUT: nH(5,3,100), nL(5,3,100);

fH:=H;

fL:=L;

CBH:=HHV(H,3);

tH:=HHV(H,nH);

for i=nH+1 to datacount do begin

if fH < tH then CBH:=tH

else if fL < fL and fL < fL

and fL < fL then CBH:=fL

else if nH > 3 and fL < fL and fL < fL

and fL < fL and (fL < fL or fL < fL) then CBH:=fL

else if nH > 4 and fL < fL and fL < fL

and fL < fL and fL < fL

and (fL < fL or fL < fL or fL < fL) then CBH:=fL

else if nH > 5 and fL < fL and fL < fL

and fL < fL and fL < fL

and fL < fL

and (fL < fL or fL < fL or fL < fL or fL < fL) then CBH:=fL;

end;

hGuppy:CBH, colorgray; //高价倒数线

CBL:=LLV(L,3);

tL:=LLV(L,nL);

for i=nL+1 to datacount do begin

if fL > tL then CBL:=tL

else if fH > fH and fH > fH

and fH > fH then CBL:=fH

else if nL > 3 and fH > fH and fH > fH

and fH > fH and (fH > fH or fH > fH) then CBL:=fH

else if nL > 4 and fH > fH and fH > fH

and fH > fH and fH > fH

and (fH > fH or fH > fH or fH > fH) then CBL:=fH

else if nL > 5 and fH > fH and fH > fH

and fH > fH and fH > fH

and fH > fH

and (fH > fH or fH > fH or fH > fH or fH > fH) then CBL:=fH;

end;

lGuppy:CBL, colorgray;

GUPPY: Ma((hGuppy+lGuppy)/2,2), coloryellow;

 

Please help!

Hello,

i want code an EA and how can i check if the last Trade is lost.

Thanks for helping!

Bye

modal04

 
 

indicator visibility in different TFs

Hi,

I am trying to limit the visibility of an indicator only to the daily time frame through code. is there any function or code that can do this for me?

 

Put this at the beginning of your start function.

if(Period() != PERIOD_D1)return(0);

Lux

Reason: