MA cross/Price cross MA EA - page 9

To add comments, please log in or register
William Snyder
9493
William Snyder  
sachin_syd:
Mrtools, the ex4 is dumping a text file instead of mq4 so its not working

It has been working for me the last 2 days might be an issue with your build of metatrader, think my broker automatically updates mine to the newest version.

sachin_syd
139
sachin_syd  
mrtools:
It has been working for me the last 2 days might be an issue with your build of metatrader, think my broker automatically updates mine to the newest version.

OK Thanks a lot.. Just a question on max distance. Does it consider closed bar price like min distance? Ideally, it should not because then probability of a bar closing between min and max distance will be v low (depending on number of lookup bar though).

The purpose of max distance is to allow a favourable entry once all other entry rules are met. So cud u please mod it not to wait till bar closes.. Cheers!

William Snyder
9493
William Snyder  
sachin_syd:
OK Thanks a lot.. Just a question on max distance. Does it consider closed bar price like min distance? Ideally, it should not because then probability of a bar closing between min and max distance will be v low (depending on number of lookup bar though). The purpose of max distance is to allow a favourable entry once all other entry rules are met. So cud u please mod it not to wait till bar closes.. Cheers!

If you want to enter sooner, then simply change to max/min distance to a lower number.

sachin_syd
139
sachin_syd  
mrtools:
If you want to enter sooner, then simply change to max/min distance to a lower number.

I understand that but cud u please clarify the entry conditions for min and max settings? Thanks :-)

William Snyder
9493
William Snyder  
sachin_syd:
I understand that but cud u please clarify the entry conditions for min and max settings? Thanks :-)

Sachin_syd, after a cross happens the Ea should, if working correctly start counting time in bars(minimum/maximum bars back) from the cross to your minimum and maximum distance if the min/max distances are greater than zero. If the price is greater than the minimum and less than the maximum the EA should trade, I haven't been able to back test or forward test any of this since am too busy with other things and if you saw my message before I edited it, I didn't think it would work, but really not totally sure either way, so need you to help me test this please, if at all possible.

extern string MinDistance_Setting = "Min Cross Distance Setting";

extern int MinCrossDistance = 0; // min distance in pips from cross

extern int MinDistanceBarsBack = 0; //(timer)bars count from the cross if on 5 min. chart every bar = 5 minutes,etc.

extern string MaxDistance_Setting = "Max Cross Distance Setting";

extern int MaxCrossDistance = 0; // max distance in pips from the cross

extern int MaxDistanceBarsBack = 0; //(timer)bars count from the cross if on 5 min. chart every bar = 5 minutes,etc.

So the Max cross distance of course needs to always be greater that the Min Cross distance, but the MinDistanceBarsBack would make it the same as MaxDistanceBarsBack.

sachin_syd
139
sachin_syd  
mrtools:
Sachin_syd, after a cross happens the Ea should, if working correctly start counting time in bars(minimum/maximum bars back) from the cross to your minimum and maximum distance if the min/max distances are greater than zero. If the price is greater than the minimum and less than the maximum the EA should trade, I haven't been able to back test or forward test any of this since am too busy with other things and if you saw my message before I edited it, I didn't think it would work, but really not totally sure either way, so need you to help me test this please, if at all possible.

extern string MinDistance_Setting = "Min Cross Distance Setting";

extern int MinCrossDistance = 0; // min distance in pips from cross

extern int MinDistanceBarsBack = 0; //(timer)bars count from the cross if on 5 min. chart every bar = 5 minutes,etc.

extern string MaxDistance_Setting = "Max Cross Distance Setting";

extern int MaxCrossDistance = 0; // max distance in pips from the cross

extern int MaxDistanceBarsBack = 0; //(timer)bars count from the cross if on 5 min. chart every bar = 5 minutes,etc.

So the Max cross distance of course needs to always be greater that the Min Cross distance, but the MinDistanceBarsBack would make it the same as MaxDistanceBarsBack.

I guess min is working fine but for max i need to see a spike on chart after price cross to test if it avoids opening too far away from MA.

So, as understand ur commentary the ea will not wait for bar to close in both min and max cases ya?

Also in ur code description I saw a 5 min bar setting? Didnt undersatand that? Is the EA checking for entry condition every 5 min or is it checking for condition on 5 min chart irrespective of which time frame i use the EA on? Thanks a lot

William Snyder
9493
William Snyder  
sachin_syd:
I guess min is working fine but for max i need to see a spike on chart after price cross to test if it avoids opening too far away from MA.

So, as understand ur commentary the ea will not wait for bar to close in both min and max cases ya?

Also in ur code description I saw a 5 min bar setting? Didnt undersatand that? Is the EA checking for entry condition every 5 min or is it checking for condition on 5 min chart irrespective of which time frame i use the EA on? Thanks a lot

Five minute was just an example if you are using a 5 minute chart, if you are using an hour chart then each bar back will be the same as an hour back,30 minute chart then each bar back is the same as 30 minutes,etc., and the Ea waits for the cross first which depends on your maBar setting if it is set on 1 then that is 1st closed bar, then it will count bars from that, and should open on a close bar, but needs to be tested also for this, if it opens on an open bar then just add 1, then it will be first open bar after your target bar.

sachin_syd
139
sachin_syd  
mrtools:
Five minute was just an example if you are using a 5 minute chart, if you are using an hour chart then each bar back will be the same as an hour back,30 minute chart then each bar back is the same as 30 minutes,etc., and the Ea waits for the cross first which depends on your maBar setting if it is set on 1 then that is 1st closed bar, then it will count bars from that, and should open on a close bar, but needs to be tested also for this, if it opens on an open bar then just add 1, then it will be first open bar after your target bar.

All right! I guess the max should be set to work on an open bar as its only purpose is to avoid a spike and save pips. Adding 1 doesn't help bcoz if the closing price is outside the max distance then it will wait again for the next bar to finish. This cud delay the trade for too long specially on 30 and 60 min chart. Regards

sachin_syd
139
sachin_syd  

Mrtools, Please see the attached chart usd jpy 15 min where I use the vanilla price cross ea. the min distance was met but max was exceeded ( i had 8 pip max) and it traded on bar close 10 pip away from ma i guess. Please check. Thanks

Files:
William Snyder
9493
William Snyder  
sachin_syd:
Mrtools, Please see the attached chart usd jpy 15 min where I use the vanilla price cross ea. the min distance was met but max was exceeded ( i had 8 pip max) and it traded on bar close 10 pip away from ma i guess. Please check. Thanks

On the chart picture you showed it was within the threshold you mentioned, the price closed above the Ma , on the next bar the Ea opened the trade within the 8 pip max, as far as i can see.

To add comments, please log in or register