MA cross/Price cross MA EA - page 7

To add comments, please log in or register
sachin_syd
139
sachin_syd  
mrtools:
The EA is coded to open buy/sell trades when price crosses the upper/lower ma if price goes back for example after closing a sell one way or the other, then if the price crosses the upper ma, then the EA should open a buy.

As u will see in this chart too it opened a short which closed after hitting sl. It again opened a short around 1800 hours for no good reason whereas it should not have done so.. This case is similar to the EURUSD chart i posted earlier. I am pretty sure about my settings as they are identical to the visible ma lines.

Files:
audusdm30.png 48 kb
William Snyder
9492
William Snyder  
sachin_syd:
As u will see in this chart too it opened a short which closed after hitting sl. It again opened a short around 1800 hours for no good reason whereas it should not have done so.. This case is similar to the EURUSD chart i posted earlier. I am pretty sure about my settings as they are identical to the visible ma lines.

Sachin_syd, both of those sells were closes below your lower ma, that is how the EA was coded.If you will notice on the second sell price closed above the lower ma, then broke below it, that is why the EA opened the sell again.

sachin_syd
139
sachin_syd  
mrtools:
Sachin_syd, both of those sells were closes below your lower ma, that is how the EA was coded.If you will notice on the second sell price closed above the lower ma, then broke below it, that is why the EA opened the sell again.

Ok agreed! Can u somehow put a maximum and minimum distance along with number of bar lookup into this ea.. Will highly appreciate if u can do this on the original price cross version as well( that one u already put min distance) Many many thanks....!!!!!!!!!!!

sachin_syd
139
sachin_syd  
mrtools:
Sachin_syd, both of those sells were closes below your lower ma, that is how the EA was coded.If you will notice on the second sell price closed above the lower ma, then broke below it, that is why the EA opened the sell again.

Bro can u please look into my request in prv post. Thanks v much.

William Snyder
9492
William Snyder  
sachin_syd:
Bro can u please look into my request in prv post. Thanks v much.

Sachin_syd, could you post the versions you want modified along with maybe a chart description showing exactly what you want, because for some reason am having trouble grasping it.

sachin_syd
139
sachin_syd  
mrtools:
Sachin_syd, could you post the versions you want modified along with maybe a chart description showing exactly what you want, because for some reason am having trouble grasping it.

As u will see on the attached chart the blue box is where the long trade occurred . But the price is far away from MA therefore it was an expensive long entry. If u cud add a function of maximum distance similar to minimum distance along with number of bar lookup it will b great. I have added both EAs that u have edited before. Note that on Price cross EA the min distance function is already done so it needs only max function. On Hi lo ea both functions are required. Thanks Heaps!

sachin_syd
139
sachin_syd  
mladen:
gtudor From reading the code , those are time frame and a bar at which close price should be tested

Mladen, I didnt understand what u mean by"a bar at which close price should be tested"

William Snyder
9492
William Snyder  
sachin_syd:
Mladen, I didnt understand what u mean by"a bar at which close price should be tested"

Sachin_syd, on the close on trend change function those settings are used, this is the indicator call for that-

double cl.clnow = iClose(s_symbol,clTimeframe,clBar);

double cl.clpre = iClose(s_symbol,clTimeframe,clBar+1);

double cl.manow = iMA(s_symbol,maTimeframe,maPeriod,maShift,maMode,maPrice,maBar);

double cl.mapre = iMA(s_symbol,maTimeframe,maPeriod,maShift,maMode,maPrice,maBar+1);

The way I have it doesn't make sense, what I had intended to do was something like this-

double cl.clnow = iClose(s_symbol,clTimeframe,clBar);

double cl.clpre = iClose(s_symbol,clTimeframe,clBar+1);

double cl.manow = iMA(s_symbol,clTimeframe,clmaPeriod,clmaShiftcl,maMode,clmaPrice,clBar);

double cl.mapre = iMA(s_symbol,clTimeframe,clmaPeriod,clmaShift,clmaMode,clmaPrice,clBar+1);

that way the close on trend change would be completely separate from the regular order opening routine, this I will change when I finish with the other mods.

Now to answer your question the clTimeframe you can set an higher time frame for your close on trend change. The clBar you can test different bars back for the close on trend change, with 0 = open bar, 1 = 1st closed bar, 2 = 2nd closed bar etc.Will add some explanation to the settings to make this easier to understand.

sachin_syd
139
sachin_syd  

Ok Thanks for explaining in detail. I hope u wud look into my earlier request at ur earliest convenience. Further, I noted another issue of the hi lo ea, that is despite setting up trading times correctly the ea still displays the trading time as non-trading time.. I had to go into ea properties and then just hit ok then the message disappears.. It seems EA freezes every now and then.. Please look into it too.. Cheers!

sachin_syd
139
sachin_syd  

See attached chart where it still says non-trading hours .. Although the time selected is within trading hours .. (broker time) .. Further, also note there are 2 short positions open donno why?? Ideally, only 1 open position should exist isnt it?

Files:
screenshot.png 139 kb
To add comments, please log in or register