Alpha9 EA *** Released to TSD Elite Members *** - page 85

 

https://www.mql5.com/en/forum/175657

The threads:

- https://www.mql5.com/en/forum/178404

- https://www.mql5.com/en/forum/172986

- https://www.mql5.com/en/forum/173184

The posts with the links to the topics/pages:

- https://www.mql5.com/en/forum/176023

- https://www.mql5.com/en/forum/176023/page2

More valuable you will find something with AbsoluteStrength indicator and AbsoluteStrengthMarket indicators and this thread https://www.mql5.com/en/forum/178404

Besides, Alpha EA with market condition checking using Ichimoku indicator will be created very soon.

 

Function ProximityOrder

I'm doing some development out of Alpha9, ver 1.19, changing the trading algorithms.

Noticed that the Function ProximityOrder is in practice shut off.

It is called when buying and selling, but will never give any influence on those. Reason is that it contains two variables, Price and Range, that are undefined =0.

 

...

As far as I see, even in version 1.19 proximity order works OK. It is called in two "occasions" with following arguments

ProximityOrder(Ask,Point*PipRegion,"BUY")(line 945 of 1.19 version)ProximityOrder(Bid,Point*PipRegion,"SELL")(line 959 of 1.19 version)

(*line numbers may differ in your version)

So the first argument that is passed to the function is becoming the Price argument and the second argument is becoming the Rangeargument of the function (included the body of the function itself)

bool ProximityOrder(double Price,double Range,string Ordertype)

{

int totalorders = OrdersTotal();

for(int i=0;i<totalorders;i++)

{

OrderSelect(i, SELECT_BY_POS);

if ( OrderSymbol()==Symbol() && (OrderMagicNumber()>=MagicNumber && OrderMagicNumber()<=MagicNumber+5))

{

int type = OrderType();

if (MathAbs( OrderOpenPrice() - Price ) < (Range*0.9))

{

if ( (Ordertype=="BUY" && type==OP_BUY) || (Ordertype=="SELL" && type==OP_SELL) )

{

return(true);

}

}

}

}

return(false);

}

regards

mladen

kiasom:
I'm doing some development out of Alpha9, ver 1.19, changing the trading algorithms.

Noticed that the Function ProximityOrder is in practice shut off.

It is called when buying and selling, but will never give any influence on those. Reason is that it contains two variables, Price and Range, that are undefined =0.
 

Thanks mladen - I should have had my morning coffee before asking questions about coding...

Anyway, having had that coffee, I'd like to pick up on your previous comments on backtesting of the Alpha9. You say it's more or less useless, for three reasons:

first - and main reason, is that alpha is working on opened bars. Tests would give useless results

My idea here is to change the trading algorithm so that trading only takes place when a new bar has been opened. E.g. like this:

bool isNewBar()

{

bool res = false;

if (EABars != Bars)

EABars = Bars;

res = true;

return(res);

}

second - Alpha 1.19 uses global variables completely different when tested from what it is going to use when in normal trading (so the tests are again going to be useless)

I don't understand this, would be glad if you could please clarify!

In int init() there is the check: if (!IsTesting()), but it is connected with Equity Protection, and supposedly would not be an obstacle to backtesting of how the Alpha is trading.

(I b.t.w. noticed that Alpha uses some variables on several levels. E.g. OpenBuyOrders is defined both globally and then redefined locally, in Trading.)

third - the technical reason which, more or less, has nothing to do with Alpha EA: when you try the ArrayCopyRates function for other time frames and you try to do it with starting dates far enough (I, for example, can back test on EURUSD usually from 01.01.2009, if I try to go "further to the past" it can not be done) metatrader starts to raise ArrayCopyRates function internal error or any of this errors derivates (ArrayCopyRates is called prior to any multi time frame indicator execution). It is one of the very nasty bugs from metatrader which can cause your metatrader crash. Since Alpha is using 8 time frames and ArrayCopyRates must be called before all of them, you are almost sure going to run into a trap.

Scary to learn about this... Will you get error messages when this happens?

I have had no problems so far with back testing Alpha9, but I test on open bars only, and never for more than a couple of months.

I'm changing the trading algorithms to more active trading, so i don't need so much back data to evaluate performance.

I'm building smth out of Alpha9, because i have found it to be a well designed multi-TF EA, with complete MM.

 

...

Don't worry, I had to take a large cup of coffee this morning too (man the errors we make when not 100% awake )

_____________________________________

Of opened bar testing : here is a slightly changed version of alpha that allows you to choose if you would like to check indicators on opened bar or any other bar (TradeOnBarparameter : 0 -> opened bar, 1 -> first closed bar, ... and so on)

Of global variables : Alpha 1.21 adds prefix "testing-" to global variables names when testing (simple solutions are almost always the best ) and that way Alpha can work with global variables even when tested. I recommend you apply that kind of global variable treatment, since it is as close to "real thing" as it gets (you can not get actual spreads for variable spread brokers that were in the moment of testing, but then, nothing is perfect)

Of those errors : sometimes you get an error (when you use arrayCopyRates it writes out something like "arrayCopyRates error - internal error") but in hidden ways (when arrayCopyRates is not used directly) it does not (newdigital, for example, had a hell of work when it was crashing test servers and no error were shown)

_____________________________________

PS: I did not change the 1.19 version since it would require more coding than in 1.21 (only a couple of lines were changed in 1.21 to make it possible to test it and work on closed bars - lazy ones work )

regards

mladen

kiasom:
Thanks mladen - I should have had my morning coffee before asking questions about coding...

Anyway, having had that coffee, I'd like to pick up on your previous comments on backtesting of the Alpha9. You say it's more or less useless, for three reasons:

first - and main reason, is that alpha is working on opened bars. Tests would give useless results

My idea here is to change the trading algorithm so that trading only takes place when a new bar has been opened. E.g. like this:

bool isNewBar()

{

bool res = false;

if (EABars != Bars)

EABars = Bars;

res = true;

return(res);

}

second - Alpha 1.19 uses global variables completely different when tested from what it is going to use when in normal trading (so the tests are again going to be useless)

I don't understand this, would be glad if you could please clarify!

In int init() there is the check: if (!IsTesting()), but it is connected with Equity Protection, and supposedly would not be an obstacle to backtesting of how the Alpha is trading.

(I b.t.w. noticed that Alpha uses some variables on several levels. E.g. OpenBuyOrders is defined both globally and then redefined locally, in Trading.)

third - the technical reason which, more or less, has nothing to do with Alpha EA: when you try the ArrayCopyRates function for other time frames and you try to do it with starting dates far enough (I, for example, can back test on EURUSD usually from 01.01.2009, if I try to go "further to the past" it can not be done) metatrader starts to raise ArrayCopyRates function internal error or any of this errors derivates (ArrayCopyRates is called prior to any multi time frame indicator execution). It is one of the very nasty bugs from metatrader which can cause your metatrader crash. Since Alpha is using 8 time frames and ArrayCopyRates must be called before all of them, you are almost sure going to run into a trap.

Scary to learn about this... Will you get error messages when this happens?

I have had no problems so far with back testing Alpha9, but I test on open bars only, and never for more than a couple of months.

I'm changing the trading algorithms to more active trading, so i don't need so much back data to evaluate performance.

I'm building smth out of Alpha9, because i have found it to be a well designed multi-TF EA, with complete MM.
Files:
alpha9v1.21.mq4  43 kb
 

DLL version

I read in the Electra thread about a new version of Alpha, where parts of code is put in DLL. Newdigital wrote a couple of weeks ago:

"Alpha EA will be changed to new version. Some preliminary version with dll files were created by Mladen and it will be attached to RAS from next week. This preliminary version will be improved finally and after that will be posted in this section. Why dll files? Those EAs are "eating" a lot of memory in PC. So, using indicators in the way of dll instead of simpole mql4 codes - will give low memory using."

Is it the Heiken-Ashi-Smoothed that's being put in DLL?

I had some initial trouble with the Tester's Journal, with repeated calls to the HAS, but then i recoded the init() of HAS, to make it work quicker, adapting it for EA use, and now it works great.

 

...

Yes, that is HA smoothed

Some of the things it does :
It returns/sets 8 values instead of 1 (so you save 7 calls)

It is much faster than mql code

It uses much less memory

Unfortunately the start() section of an indicator is what is called all the time and prior to calling a start section of any MTF indicator metatrader has to "prepare" the data for it, so it does not have too much to do with the init() section - init() section is called just on initial, first call. And once it starts to "prepare" data then you are in the gray zone of metatrader - sooner or later, with 8 time frames checked by Alpha, you are going to get stuck and you are not going to know what happens (not just back tests but normal live trading as well : that is the part where newdigital had those problems - on a normal forward testing)

regards

mladen

kiasom:
I read in the Electra thread about a new version of Alpha, where parts of code is put in DLL. Newdigital wrote a couple of weeks ago:

"Alpha EA will be changed to new version. Some preliminary version with dll files were created by Mladen and it will be attached to RAS from next week. This preliminary version will be improved finally and after that will be posted in this section. Why dll files? Those EAs are "eating" a lot of memory in PC. So, using indicators in the way of dll instead of simpole mql4 codes - will give low memory using."

Is it the Heiken-Ashi-Smoothed that's being put in DLL?

I had some initial trouble with the Tester's Journal, with repeated calls to the HAS, but then i recoded the init() of HAS, to make it work quicker, adapting it for EA use, and now it works great.
 
newdigital:
Old Alpha versions - RSI settings is the better.

New Alpha versions - see my settings on few posts above.

By the way - Alpha Ichimoku version will be created soon (not RSI settings as well).

I'm new here so - hello all.

It was my understanding the settings were these here: https://www.mql5.com/en/forum/178132/page28

So if I am to use Alpha9v1.20 with a small account, shouldn't I use the settings "3" on that post?

Thanks.

 

Alpha with RSI settings for small deposit size performed very good. But as you see - I am making the statements weekly. But Alpha EA with this settings - it is not trading often: it can be 1 or 2 weeks without any single trade.

That is why I stopped this Alpha for small deposit size.

I will start it with new version of Alpha and it is really good idea to keep/create the settings/version of this EA for small deposit size.

 
mladen:

Of opened bar testing : here is a slightly changed version of alpha that allows you to choose if you would like to check indicators on opened bar or any other bar (TradeOnBarparameter : 0 -> opened bar, 1 -> first closed bar, ... and so on)

Of global variables : Alpha 1.21 adds prefix "testing-" to global variables names when testing (simple solutions are almost always the best ) and that way Alpha can work with global variables even when tested. I recommend you apply that kind of global variable treatment, since it is as close to "real thing" as it gets (you can not get actual spreads for variable spread brokers that were in the moment of testing, but then, nothing is perfect)

Of those errors : sometimes you get an error (when you use arrayCopyRates it writes out something like "arrayCopyRates error - internal error") but in hidden ways (when arrayCopyRates is not used directly) it does not (newdigital, for example, had a hell of work when it was crashing test servers and no error were shown)

_____________________________________

PS: I did not change the 1.19 version since it would require more coding than in 1.21 (only a couple of lines were changed in 1.21 to make it possible to test it and work on closed bars - lazy ones work )

Oops, I missed that the 1.21 was released. Compared the code with previous versions (1.19 and 1.20), and i see no signs of "lazy ones work"- you really have put in quite a bit of effort to clean up and rewrite.

Thanks a lot.

Makes me feel that you have serious hopes on this one as a platform for multi-TF trading.

However, when i run 1.21 in tester mode on a laptop with little memory i get the "arrayCopyRates error - internal error" for EACH call. Even if i backtest only one day's data, and shut off trading on any other timeframe than M5 and use only one currency pair. So there is indeed a substantial bug somewhere. Is there any hope that it will be fixed, or shall we just wait for another rewrite under MT5?