Should I script or should I EA?

Back to topics list To post a new topic, please log in or register
avatar
9
Smeagol 2015.10.13 16:45
 

Hi,

 

I've developed my own strategy that I am now trying to implement in MQL4, I would like to start to backtest it and continue to develop the logic, but I don't know if I should create a script that I auto-exectue at some time of day, or have some EA that triggers at some point.

I currently have it created as a script that I manually run. i'd like it eventually to run at say 13:00 every day, on a D1 chart for each of about 10-15 symbols. 

With an EA would I have to have MT4 running al the time?, then trigger based on some time event (makret opens, new bar appears)?

 

The strategy is based on a custom indicator that gives a trade/no trade signal and some additional logic that decides whether to place the trade based on current exposure (and whether to close any open trades etc) and some journalling code that logs everything.

 

Should this be an EA? If so, does it need to run all the time (infinite loop) and trigger based on event (time has expired, or new bar appeared)

I want to backtest, and all the backtest tutorials I've seen  seem to work with EAs only.

 

thanks

 

avatar
13000
WHRoeder 2015.10.13 17:27 #
 
  1. Scripts run once and are gone. You want an EA.
  2. OnTick is called when a new tick is received, you process it and return. 
  3. learn to code
avatar
9
Smeagol 2015.10.13 21:47 #
 
If OnTick is called when a new tick is received - is this when a change in price is detected?  Would this only happen once a day on a D1 chart? If so, when does this actually happen, at close of market?
avatar
9
Smeagol 2015.10.13 21:48 #
 
PS- thanks for the links, I'm actually a software engineer by trade (C++), but still getting used to MQL4
avatar
126
Demos 2015.10.14 15:54 #
 

Smeagol:

 

I currently have it created as a script that I manually run. i'd like it eventually to run at say 13:00 every day, on a D1 chart for each of about 10-15 symbols. 

a) With an EA would I have to have MT4 running al the time?, then trigger b) based on some time event (makret opens, new bar appears)?


Should this be an EA? If so, does it need to run all the time (infinite loop) and trigger based on event (time has expired, or new bar appeared)

I want to backtest, and all the backtest tutorials I've seen  seem to work with EAs only.

 a) EAs need MT4 running all time indeed. Some people put it on a VPS, so they do not have to have their computers on all the time, and also VPS can be more secure concerning electricity and connection stability.

 b) An MQL program relies on OnTick or OnTimer events. You have to code it yourself to detect new bars or to do something on a given time; possibly, you can use the MQL library (you have to read reference docs )

Smeagol:
If OnTick is called when a new tick is received - is this when a change in price is detected?  Would this only happen once a day on a D1 chart? If so, when does this actually happen, at close of market?

 A tick is a price change, so no, it can happen once, or more, or less in a day. A e.g. D1 chart is only a chart, made up by ticks (or lack thereof), and it is a chart based on time. There are charts in which time is not included in their coordinates, like Point and Figure and more.

 

best regards 

avatar
9
Smeagol 2015.10.14 22:04 #
 

Thanks for the replies guys.

 

I've now converted my manual script into an EA, it uses the OnTimer event to decide if it is time to run (I want it to run once everyday).

 

I'm now about to start backtesting....  :)

 

thanks 

Back to topics list  

To add comments, please log in or register