Gann Grid object

 

Hi,

I have programmatically drawn a Gann Grid object using fractals. Now I want to detect if the price has crossed any of the grid lines. Can I do this in mql? If not, does anyone have a formula for Gann Grid I can use to derive this?

 
Any ideas?
 

i think that no one can help u without seeing your code

 

Alright then, the code is attached.

Basically what I want to know is when the price crossed a line of the Gann grid.

Files:
autogann.mq4  4 kb
 
mfurlend:

Alright then, the code is attached.

Basically what I want to know is when the price crossed a line of the Gann grid.


i was not looking to your code, but with

double ObjectGetValueByShift( string name, int shift)

https://docs.mql4.com/objects/ObjectGetValueByShift

you can access the value of an object/line at an specific bar.

if (Close[0]>ObjectGetValueByShift("GannLine",0) do something

 

can u explain a little bit more what u want, as i saw the indicator every 5 pips the price is crossing one of the lines

 

on second thought if u need tha values h.h l.h l_l h_l use OBjectGet()

//example
double a = ObjectGet("Gann1",OBJPROP_PRICE1);
 
EADeveloper:


i was not looking to your code, but with

double ObjectGetValueByShift( string name, int shift)

https://docs.mql4.com/objects/ObjectGetValueByShift

you can access the value of an object/line at an specific bar.

if (Close[0]>ObjectGetValueByShift("GannLine",0) do something

I think thats exactly what I was looking for! Thanks a lot :)
Reason: