forex software

Create and Test Forex Strategies

forex software

Skip to forum content

Forex Software

Create and Test Forex Strategies

You are not logged in. Please login or register.


Forex Software → Expert Advisor Studio → Daily Strategy does not open trades because of "closed market"

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 9

Topic: Daily Strategy does not open trades because of "closed market"

Hi,
I downloaded daily data from EURTRY and got some wonderful strategies with EA Studio. However my broker never opens trades because at the beginning of any new daily bar "the market is closed". A bit later it opens again but the EA is ready for that day then!
Is there  any possibility to open trades some minutes earlier or later? Or should I try other timeframes?
Thank you for helping me outsmarting the brokers who always outsmarting me!

Re: Daily Strategy does not open trades because of "closed market"

There is  indicator  - Entry time  that should fix the difficulty

My 'secret' goal is to push EA Studio until I can net 3000 pips per day....

3 (edited by ats118765 2019-06-13 03:41:17)

Re: Daily Strategy does not open trades because of "closed market"

mkowa wrote:

Hi,
I downloaded daily data from EURTRY and got some wonderful strategies with EA Studio. However my broker never opens trades because at the beginning of any new daily bar "the market is closed". A bit later it opens again but the EA is ready for that day then!
Is there  any possibility to open trades some minutes earlier or later? Or should I try other timeframes?
Thank you for helping me outsmarting the brokers who always outsmarting me!

Try this.

Modify the existing code in Metaeditor for the void OnTick() in the Portfolio compilation or single strategy with the following code. Recompile and then run.

I use this for Pepperstone for D1 as some trades were not initiated on open using the native code from the portfolio compiler.


void OnTick()
  {
   if(Time[0]>barTime && MarketInfo(_Symbol, MODE_TRADEALLOWED) )
     {
      barTime=Time[0];
      OnBar();
     }
  }

Diversification and risk-weighted returns is what this game is about

Re: Daily Strategy does not open trades because of "closed market"

ats118765 wrote:

Try this.

Thank you very much. I will try!

Re: Daily Strategy does not open trades because of "closed market"

mkowa wrote:
ats118765 wrote:

Try this.

Thank you very much. I will try!

It is working for me. Thank you very much.

Re: Daily Strategy does not open trades because of "closed market"

It is a nice idea. If it works well, I may add it in the standard code.

7 (edited by ats118765 2019-06-16 04:57:26)

Re: Daily Strategy does not open trades because of "closed market"

Popov wrote:

It is a nice idea. If it works well, I may add it in the standard code.

I use this for real and demo accounts in MT4 but not for backtest strategies. Once the code is adjusted it won't work in Strategy Tester. You therefore need to include 2 types of 'On tick' code elements if you want it to work in both MT4 environments (one for strategy tester - eg. the current standard code generated by EA Studio) and this separate code for (live/demo accounts).

Cheers

RichB

Diversification and risk-weighted returns is what this game is about

Re: Daily Strategy does not open trades because of "closed market"

Detecting Tester mode is easy.

Do that modification work well on all timeframes?


Fixed `OnTick` function:

void OnTick()
  {
   // Modification: Check if trading is allowed
   if(!IsTesting() && !MarketInfo(_Symbol, MODE_TRADEALLOWED)) return;

   if(Time[0]>barTime)
     {
      barTime=Time[0];
      OnBar();
     }
  }

Re: Daily Strategy does not open trades because of "closed market"

Popov wrote:

Detecting Tester mode is easy.

Do that modification work well on all timeframes?


Fixed `OnTick` function:

void OnTick()
  {
   // Modification: Check if trading is allowed
   if(!IsTesting() && !MarketInfo(_Symbol, MODE_TRADEALLOWED)) return;

   if(Time[0]>barTime)
     {
      barTime=Time[0];
      OnBar();
     }
  }

Hi Popov :-).

I haven't tested the 'On Tick' modification on shorter timeframes as I only trade live on D1....so not sure.

Thanks for the enhanced code.

Cheers

Rich B

Diversification and risk-weighted returns is what this game is about

Posts: 9

Pages 1

You must login or register to post a reply

Forex Software → Expert Advisor Studio → Daily Strategy does not open trades because of "closed market"

Similar topics in this forum