if using ATR threshold, EA wont enter buy/sell position

 

Hi folks!

As a newbie I ran through the code from this awesome article https://www.mql5.com/en/articles/100

After adding some mods I came to a problem on which I can't find a solution.

My modification to the code was: Instead of using ADX volatility line with a threshold Adx_Min, I used ATR as a volatility indicator and set a threshold as certain position for ATR's line (a condition when ATR crosses certain level).

When debugging I normally received true/false out of my conditions, but when testing the EA in Strategy Tester, it does not ever enter buy/sell position!


Any ideas what to do? I would appreciate some help!

Thanx

Step-By-Step Guide to writing an Expert Advisor in MQL5 for Beginners
Step-By-Step Guide to writing an Expert Advisor in MQL5 for Beginners
  • 2010.06.09
  • Samuel
  • www.mql5.com
The Expert Advisors programming in MQL5 is simple, and you can learn it easy. In this step by step guide, you will see the basic steps required in writing a simple Expert Advisor based on a developed trading strategy. The structure of an Expert Advisor, the use of built-in technical indicators and trading functions, the details of the Debug mode and use of the Strategy Tester are presented.
 
skritney:
...


Any ideas what to do? I would appreciate some help!

Thanx

Show your code.
 
skritney:

Hi folks!

As a newbie I ran through the code from this awesome article https://www.mql5.com/en/articles/100

After adding some mods I came to a problem on which I can't find a solution.

My modification to the code was: Instead of using ADX volatility line with a threshold Adx_Min, I used ATR as a volatility indicator and set a threshold as certain position for ATR's line (a condition when ATR crosses certain level).

When debugging I normally received true/false out of my conditions, but when testing the EA in Strategy Tester, it does not ever enter buy/sell position!


Any ideas what to do? I would appreciate some help!

Thanx

Actually, if I got your explanation right, I think I tested something like that a while ago and it worked (and by that I mean that it did open orders), so as angevoyageur said, it must be probably some coding issue and it would be nice to see the code to help you out
 

Okay these things are strange:

after changing file name of EA, the Strategy Tester finally started entering buy/sell positions! Dunno why??

Still some errors occur during the trade

2013.10.15 19:22:59    Trades    '1522606': failed instant sell 0.10 EURUSD at 1.34935 sl: 1.34635 tp: 1.35935 (deviation: 100) [Invalid stops]

and

The SELL order request could not be completed - error:4756!

Any ideas why? Thank you!

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Trade Orders in DOM
Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Trade Orders in DOM
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Trade Orders in DOM - Documentation on MQL5
Files:
ATRandMAea.ex5  17 kb
 
skritney:

Okay these things are strange:

after changing file name of EA, the Strategy Tester finally started entering buy/sell positions! Dunno why??

Still some errors occur during the trade

2013.10.15 19:22:59    Trades    '1522606': failed instant sell 0.10 EURUSD at 1.34935 sl: 1.34635 tp: 1.35935 (deviation: 100) [Invalid stops]

and

The SELL order request could not be completed - error:4756!

Any ideas why? Thank you!

https://www.mql5.com/en/search#!keyword=4756
Reason: