Download MetaTrader 5

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

To add comments, please log in or register
Are you accustomed to using the standard library? MQL5 has one!
Skritney
34
Skritney 2013.10.15 02:02 

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.
Alain Verleyen
Moderator
30752
Alain Verleyen 2013.10.15 08:44  
skritney:
...


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

Thanx

Show your code.
Jose
282
Jose 2013.10.15 10:28  
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
Skritney
34
Skritney 2013.10.15 19:41  

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:
Alain Verleyen
Moderator
30752
Alain Verleyen 2013.10.15 19:49  
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
To add comments, please log in or register