How to make an EA only trade once per bar, ie, once per hour max??

To add comments, please log in or register
not here
43
not here  
Hello:

Could you please take a look at the following EA, and let me know what modifications I need to make to have it only enter a trade once per bar? (I run this on the 1H or 4H Time frame)

When back tested, the code enters more than one trade per bar, but I know that is not a good test, as the tester is only "guesstimating" what happened within the bar.

Also, I need to make sure it enters a trade when the signals trigger, even if there is slippage or slow trading context or slow response from broker (as per usual).

Any help will be greatly appreciated.

Regards

Not Here.
. ... Rick D. ... .
1162
. ... Rick D. ... .  
nothere:
Hello:

Could you please take a look at the following EA, and let me know what modifications I need to make to have it only enter a trade once per bar? (I run this on the 1H or 4H Time frame)

Regards
Not Here.


datetime Time0 = 0;
 
void start()
{
  if (Time0 != Time[0])
  {
    OrderSend(...
    Time[0] = Time[0];
  }
}
MQL How-To Guide
Job M van Zuijlen
93
Job M van Zuijlen  
RickD:
datetime Time0 = 0;
 
void start()
{
  if (Time0 != Time[0])
  {
    OrderSend(...
    Time[0] = Time[0];
  }
}
MQL How-To Guide
Shouldn't this be:
Time0 = Time[0]
As written, Time0 gets never updated and the test will always be true.
not here
43
not here  
Hello:

Thanks for you replies RICKD and ZUIJLEN, I appreciate them!!

I am going to try both methods to see the result.

it is important to make sure the trade happens only once per hour, because the backtester is UNRELIABLE otherwise.

Best regards to both!!!

NOT HERE.......
Rashid Umarov
Admin
14302
Rashid Umarov  
nothere:


it is important to make sure the trade happens only once per hour, because the backtester is UNRELIABLE otherwise.

You need to read Strategy Tester: Modes of Modeling during Testing and My First "Grail"
not here
43
not here  
Hello Rosh:

Thanks for the pointers, but I have already read these docs.

Having read the documets you point out, and many others related to this and many other backtesters, has led me to have the opinion I expressed above, which remains unchanged.

I use backtesters only to have a general idea about the way the algorithm behaves under test conditions, not to equate backtesting performance to forward or out of sample performance.

Thanks!!!
up10
78
up10  
Resolved, thanks!
Jenna Lyn
9
Jenna Lyn  
Can anybody tell me will the above program advised will function with MT4, or is that only for MT5?
Keith Watford
Moderator
14566
Keith Watford  
Jenna Lyn:
Can anybody tell me will the above program advised will function with MT4, or is that only for MT5?

What above program?

This is in the MT4 section.

To add comments, please log in or register