Forex Zone - Forex Forum

Help add extra parameters to the EA

Discussion started on MT4 / MT5 EAs

  • Newbie
  • Posts: 49
  • Points: 795
  • Likes Received: 20
  • Reputation: +3/-0
Hi add.

  I am wishing to add the following parameters on the EA and if anyone can help. I will be very grateful.

1.Trading start and stop time.
 i. FridayTrade; true/false
2.Take profit by fractal true/false, timeframe, setting
3.trend filter True/false, timeframe
 i. EMA1 ,setting  and  ii. EMA2,setting
4. Trades: Longs & shorts, shorts only, longs only



Linkback: https://www.forex.zone/mt4-mt5-eas/7/help-add-extra-parameters-to-the-ea/605/
#1 - December 15, 2018, 10:22:04 AM
Attachments:
« Last Edit: December 15, 2018, 10:25:57 AM by Turbo »

  • Newbie
  • Posts: 49
  • Points: 795
  • Likes Received: 20
  • Reputation: +3/-0
You will need to download history in MT4 for any pair you want to trade or backtest, TF is 30min .
EA is meant to read history on its own but its auto history dosent work well.But once you attach the EA on a chart and EA read a history data, new uploaded history data is never loaded in the EA.
Due to this in other to use the newest history data everytime, you close the chart and re-attach the EA on the chart. This is a problem.
This was an advice a friend gave me but I don't know how to fix it.  This is why EA will produce different results in every backtest using the same settings. 

He said:
Loading of history should come if not in test mode.That is, if(! Istesting){load history},If you code it in the init(), then let the datapath come first as it will according to mt4 rule load all import functions first. If you put history loading first, result from datapath will be zero. or  is better to load the H4 file every 4hours, right? It is not necessary to read file every tick?
Or the best way is to request time for H4. That is: datetime T=iTime(Symbol (),H4,0);
With this the hst for H4 is continually updated every tick without problem.


#2 - December 15, 2018, 11:09:55 AM

  • Newbie
  • Posts: 49
  • Points: 795
  • Likes Received: 20
  • Reputation: +3/-0
You will need to download history in MT4 for any pair you want to trade or backtest, TF is 30min .
EA is meant to read history on its own but its auto history dosent work well.But once you attach the EA on a chart and EA read a history data, new uploaded history data is never loaded in the EA.
Due to this in other to use the newest history data everytime, you close the chart and re-attach the EA on the chart. This is a problem.
This was an advice a friend gave me but I don't know how to fix it.  This is why EA will produce different results in every backtest using the same settings.

He said:
Loading of history should come if not in test mode.That is, if(! Istesting){load history},If you code it in the init(), then let the datapath come first as it will according to mt4 rule load all import functions first. If you put history loading first, result from datapath will be zero. or  is better to load the H4 file every 4hours, right? It is not necessary to read file every tick?
Or the best way is to request time for H4. That is: datetime T=iTime(Symbol (),H4,0);
With this the hst for H4 is continually updated every tick without problem.


Admin i will be glad if you can assist to help me get it resolved.Thanks
#3 - December 16, 2018, 05:42:49 AM

Administrator
  • Hero Member
  • Posts: 4886
  • Points: 33341
  • Likes Received: 4973
  • Reputation: +220/-14
For #3, how will this work? Must EMA1 be greater than EMA2 for a buy trade? Or should price be above EMA1 and EMA2? Or something else?

For #4, this can already be done from the EA's common settings. Are you sure you need this?
#4 - December 16, 2018, 11:34:15 PM
Help add extra parameters to the EA in MT4 / MT5 EAs_FEN-Indicator-728x90

  • Newbie
  • Posts: 49
  • Points: 795
  • Likes Received: 20
  • Reputation: +3/-0
For #3, how will this work? Must EMA1 be greater than EMA2 for a buy trade? Or should price be above EMA1 and EMA2? Or something else?

For #4, this can already be done from the EA's common settings. Are you sure you need this?
Thanks for the response precision question
#3
was referring to when EMA1 is greater to EMA2 for a buy trade, however i never taught of the other option when  the price is above EMA1 and EMA2. Since i will optimize to get the best option, you can add a knob and define the parameters something like this

EMA Filter= True/False
EMAfilterType =  when ema1>ema2 / when price above ema1 & ema2
EMA1 = settings
EMA2 = settings
Timeframe = 1M.5M,15M,30M,1Hr,4H ,1Day

#4
Doing it from the common will make EA REPORT series of ERROR messages in the EA journal, and due to the consistent pattern of reporting that specific error type, it slows the MT4 that is why i suggested it to be done from inside the EA settings.

Were you able to determine the cause related to the issue i mentioned in my 2nd post ?
#5 - December 17, 2018, 04:02:52 AM
« Last Edit: December 17, 2018, 04:09:49 AM by Turbo »

Administrator
  • Hero Member
  • Posts: 4886
  • Points: 33341
  • Likes Received: 4973
  • Reputation: +220/-14
Were you able to determine the cause related to the issue i mentioned in my 2nd post ?

No, I only briefly reviewed the EA. I am not sure why an EA would be coded like this to work with files and not simply call the H4 information directly from the chart. Whatever is in the history file will be on the chart anyways. Or even just storing the data internally in arrays. Have you tried contacting the author of this EA?

Regarding the other modifications, I could do these for you.
#6 - December 17, 2018, 02:08:00 PM

  • Newbie
  • Posts: 49
  • Points: 795
  • Likes Received: 20
  • Reputation: +3/-0
Were you able to determine the cause related to the issue i mentioned in my 2nd post ?

No, I only briefly reviewed the EA. I am not sure why an EA would be coded like this to work with files and not simply call the H4 information directly from the chart. Whatever is in the history file will be on the chart anyways. Or even just storing the data internally in arrays. Have you tried contacting the author of this EA?

Regarding the other modifications, I could do these for you.
true, Whatever is in the history file will be on the chart anyways and storing the data internally in arrays could be much better. And honestly i don't know why he did it like that, I lost contact with him for weeks. I have a very little knowledge in coding and i haven't been able to know the cause.





#7 - December 17, 2018, 02:35:31 PM

Administrator
  • Hero Member
  • Posts: 4886
  • Points: 33341
  • Likes Received: 4973
  • Reputation: +220/-14
true, Whatever is in the history file will be on the chart anyways and storing the data internally in arrays could be much better. And honestly i don't know why he did it like that
I think working with files would just increase the chance of something going wrong, which has. I'll have this looked into and see what can be done.
#8 - December 17, 2018, 11:03:45 PM

  • Newbie
  • Posts: 49
  • Points: 795
  • Likes Received: 20
  • Reputation: +3/-0
true, Whatever is in the history file will be on the chart anyways and storing the data internally in arrays could be much better. And honestly i don't know why he did it like that
I think working with files would just increase the chance of something going wrong, which has. I'll have this looked into and see what can be done.
i guess so,sure its ok
#9 - December 17, 2018, 11:16:15 PM

Administrator
  • Hero Member
  • Posts: 4886
  • Points: 33341
  • Likes Received: 4973
  • Reputation: +220/-14
Try this version. Only the problem has been addressed. The additional modifications have not been done. Let me know what you think.
#10 - December 18, 2018, 12:10:44 PM
Attachments:

  • Newbie
  • Posts: 49
  • Points: 795
  • Likes Received: 20
  • Reputation: +3/-0
Try this version. Only the problem has been addressed. The additional modifications have not been done. Let me know what you think.
thanks i will check it out
#11 - December 18, 2018, 12:25:23 PM

  • Newbie
  • Posts: 49
  • Points: 795
  • Likes Received: 20
  • Reputation: +3/-0
Try this version. Only the problem has been addressed. The additional modifications have not been done. Let me know what you think.
it cant backtest : : Error 4051 [invalid function parameter value.],
#12 - December 18, 2018, 12:35:53 PM

Administrator
  • Hero Member
  • Posts: 4886
  • Points: 33341
  • Likes Received: 4973
  • Reputation: +220/-14
it cant backtest : : Error 4051 [invalid function parameter value.],
It back tests fine for me in 2 brokers. Are you using the standard MT4 back tester or another software? Are you using default settings?
#13 - December 18, 2018, 12:55:44 PM

  • Newbie
  • Posts: 49
  • Points: 795
  • Likes Received: 20
  • Reputation: +3/-0
no i am using a 3rd party software connected to meta-trader
#14 - December 18, 2018, 01:07:56 PM

Administrator
  • Hero Member
  • Posts: 4886
  • Points: 33341
  • Likes Received: 4973
  • Reputation: +220/-14
no i am using a 3rd party software connected to meta-trader
If you aren't back testing with standard MT4 then the errors cannot be duplicated here. Was your EA specifically made to run with this 3rd party software you are using? This might explain why history files were used instead of a simpler method. The EA has been changed in that regard though.
#15 - December 18, 2018, 01:10:12 PM

Members:

0 Members and 1 Guest are viewing this topic.