How to limit number of orders per time period...

 

Hi everyone,


I've been using an EA generator to test different strategies. One problem I have come up against a few times is when the EA gets in a trading loop. It enters and exits hundreds of losing positions in the space of a few minutes. This happens because there's an overlap between the entry and exit conditions.


A few times I have been able to make adjustments that have prevented this from happening, but with my latest one (which, apart from this, seems to be the most effective) I haven't been able to get around it.


One solution I have come up with is to include an instruction not to send more than one entry order per nominated period (1 hour, 4 hours, etc). I suspect this probably won't be too hard to implement for most coders, but sadly I am still a n00b. If anyone could help me out with how to do this I would really appreciate it... 

 
rogue1: I've been using an EA generator to test different strategies. One problem I have come up against a few times is when the EA gets in a trading loop.
  1. EA builder, EATree, Etasoft forex generator, Forex Strategy Builder, FOREXEADVISOR STRATEGY BUILDER, FX EA Builder, fxDreema, FxPro, Molanis, Online Forex Expert Advisor Generator, Strategy Builder FX, Strategy Quant, Visual Trader Studio, MQL5 Wizard, etc., are all the same. You will get something quick, but then you will spend a much longer time trying to get it right, than if you learned the language up front, and then just wrote it.
    • Since you haven't learned MQL4/5, therefor there is no common language for us to communicate.
      If we tell you what you need, you can't code it.
      If we give you the code, you don't know how to integrate it into yours.
      We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem, but we are not going to debug your hundreds of lines of code. You are essentially going to be on your own.

    • EA builder makes bad code counting up while closing multiple orders.
      EA builder makes bad code Bars is unreliable (Max bars in chart), volume is unreliable (miss ticks.) Always use time.
      EA builder makes bad code, not adjusting for 4/5 digit brokers, TP/SL and slippage.
      EA builder makes bad code, not adjusting for ECN brokers. pre-Build 500)
      EA builder makes bad code, not
      checking return codes.
      EATree uses objects on chart to save values — not persistent storage (files or GV+Flush.) No recovery (crash/power failure.)

    • FX EA Builder makes bad code, not checking return codes.
      FX EA Builder makes bad code, loosing open tickets on terminal restart. No recovery (crash/power failure.)
      FX EA Builder makes bad code, not adjusting stops for the spread.
      FX EA Builder makes bad code, using OrdersTotal directly.

    • FOREXEADVISOR STRATEGY BUILDER makes bad code, non-updateing global variables.
      FOREXEADVISOR STRATEGY BUILDER makes bad code, compilation errors.
      FOREXEADVISOR STRATEGY BUILDER makes bad code, not checking return codes.

    Learn to code it, or pay someone (Freelance) someone to code it.
              Hiring to write script - General - MQL5 programming forum

  2. You are looking at a signal. Act on a change of signal.
              MQL4 (in Strategy Tester) - double testing of entry conditions - Strategy Tester - Expert Advisors and Automated Trading - MQL5 programming forum #1

    Or don't open new orders when there are existing ones.

 
I'm actually in the process of learning the language. I'm just not fluent yet... ;) 
 
Thank you for your detailed response. I will act on it tomorrow.

Just to clarify on the last point, it is not opening new orders when others already exist. It is rapidly opening and closing the orders...