JLPi Grid EA - page 10

 

Jlpi

I've been looking at the JLPI grid with some interest and came up with the following idea:

We choose a single pair, say GBP, then go long and short simultaneously on same broker account using the Grid which is unidirectional. Surely this would form a near perfect hedge..? Protecting the account in a huge move in either direction.

Any comments please!

 
wibitiens:
Hi jlpi,

From the code of your ea, it seems that you use global variables on init and refbalance. Inside init code, new calculation for nextup, nextdown, etc are done. So, if this ea is opened in multiple pairs, will it affect one another variables?

Thanks

Cheers,

For the nextup, nextdown there is in my opinion no problem.

For the RefBalance and Init it was a fact a try to go out from all pairs when a certain profit level is reached. Going out isnot a problem but I still have a problem that all grids from all EA instances shall be reinitialised.

And it is true that as such the function is not activated but different pairs affect the RefBalance value.

Then I commented out this part and it is like it was before with each pair being independent.

 
daet:
I've been looking at the JLPI grid with some interest and came up with the following idea:

We choose a single pair, say GBP, then go long and short simultaneously on same broker account using the Grid which is unidirectional. Surely this would form a near perfect hedge..? Protecting the account in a huge move in either direction.

Any comments please!

In my opinion 2 unidirectional grids or a bidirectional works the same way.

Anyway it is not a perfect edge for the following reason.

Let's say as an example:

- you start the grid at 1.90 and the price moves straight to 1.95

- you have an interval of 100 pips between orders

- the winning grid will win 500 pips.

- the loosing grid will loose 500 pips (first order) + 400 (second order) + 300 (3rd) + 200 (4th) +100 (5th) = 1500 pips

In this example you will have almos a perfect hedge if you keep the same lot size on the loosing side but you increase it (like anti martingale) on the winning side.

That will work well on this example, but it becomes much more complicated when it oscillates because the lot size will have a tendency to increase and we could come up with very large lot sizes that are not realistic.

 

Thanks JPLi for the explanation.

By the way, I just modify your ea a little bit, just to put some text comment so that we can see the current position of all variables. I hope you don't mind Thanks.

Cheers,

Files:
jlpigrid.mq4  9 kb
 
wibitiens:
Thanks JPLi for the explanation.

By the way, I just modify your ea a little bit, just to put some text comment so that we can see the current position of all variables. I hope you don't mind Thanks.

Cheers,

Of course not, I like when people help me

I put your modifications in the EA that is the reference in the first post. from your version the only difference is that I commented out the global variables.

 
jlpi:
Of course not, I like when people help me I put your modifications in the EA that is the reference in the first post. from your version the only difference is that I commented out the global variables.

Cool!

Actually, last nite I have been thinking to remove the globalvariables and just change it to internal variables so that each ea in defferent currency pair won't bother each other. Nice work JPLi.

Cheers,

 

Is "MAGICMABO" the magic number variable? I can use it do define different Magic Numbers for different currencies?

 
matrixebiz:
Is "MAGICMABO" the magic number variable? I can use it do define different Magic Numbers for different currencies?

yes exactly

 

How can I change it to make it a user changeable option?

#define MAGICMABO 19665

Can I just add extern int MAGICMABO=12345

or is there other code I have to change?

Thanks

 
matrixebiz:
How can I change it to make it a user changeable option?

#define MAGICMABO 19665

Can I just add extern int MAGICMABO=12345

or is there other code I have to change?

Thanks

yes you can just replace the #define by an external parameter as you mentioned

Reason: