Adjustable MA

Enivid

Administrator
Staff member
Nov 30, 2008
16,999
1,020
144
Odessa
www.earnforex.com
Adjustable MA EA was updated to new version - optional adjustable money management was added. Now you can set how many lots will it trade depending on the available free margin on the account. Pyramiding at its best!

Both MT4 and MT5 versions of the expert advisor got that update.
 

ressss

Trader
May 10, 2011
7
0
12
Problem Getting Adjustable_MA to Actually Trade

I have run EAs before and never had any problem but with this one
(Adjustable_MA) I am not getting any trades. I put it on a 1 minute
eur/usd chart (MT4) and left all setting at default except I made
Period 1 a value of 2, Period 2 a value of 1, and MA Method a value of 0. I made sure the allow live trading was checked and yes the platform is green for
expert advisors (even have the little smily face). So why am I not
getting any trades? Please respond to my e-mail ressss@hotmail.com.
 

Enivid

Administrator
Staff member
Nov 30, 2008
16,999
1,020
144
Odessa
www.earnforex.com
I have run EAs before and never had any problem but with this one
(Adjustable_MA) I am not getting any trades. I put it on a 1 minute
eur/usd chart (MT4) and left all setting at default except I made
Period 1 a value of 2, Period 2 a value of 1, and MA Method a value of 0. I made sure the allow live trading was checked and yes the platform is green for
expert advisors (even have the little smily face). So why am I not
getting any trades? Please respond to my e-mail ressss@hotmail.com.
Was there any output in the Experts or Journal tabs of the terminal?

For how long did you wait? Did you try to add 2 MA indicators of period 1 and 2 and see if they actually cross during the period?

Did you try running the EA with different period settings, e.g. 15 and 7? What were the results?
 

ressss

Trader
May 10, 2011
7
0
12
Still NOT Getting Trades

Along with the 1 minute eur/usd chart with all the settings at default except period 1 = 2 and period 2 = 1 I also add 1 minute usd/chf chart with all the settings at default except period 1 = 15 and period 2 = 7 (as you suggested). I have also added ema indicators to both charts and the have been several crosses on both but still NO TRADES.
The Expert tab has the following:
Adjustable_MA EURUSD, M1: loaded successfully
Adjustable_MA EURUSD, M1 inputs: (all the settings)
Adjustable_MA EURUSD, M1: initialized
Adjustable_MA USDCHF, M1: loaded successfully
Adjustable_MA USDCHF, M1 inputs: (all the settings)
Adjustable_MA USDCHF, M1: initialized
Adjustable_MA USDCHF, M1: uninit reason 5
Adjustable_MA USDCHF, M1: initialized
Adjustable_MA USDCHF, M1 inputs: (all the settings)
Adjustable_MA USDCHF, M1: 130
The Journal tab has the following:
OANDA - MT4 4.00 build 399 started (OANDA Corporation)
'xxxxxx': login
Expert Adjustable_MA EURUSD, M1: loaded successfully
Expert Adjustable_MA USDCHF, M1: loaded successfully
Old tick USDCHF 0.88604/0.88623
Old tick EURUSD 1.42150/1.42162

If there is any additional data I can supply please let me know. I hope this is enough for you to help me get this Adjustable_MA ea to actually do live trading.

Regards, Ron
 

Enivid

Administrator
Staff member
Nov 30, 2008
16,999
1,020
144
Odessa
www.earnforex.com
I let it run for several hours.
And that output from Experts and Journal tabs is after you've waited for several hours, right?

Try running this EA in your MT4 Strategy Tester:
1. View->Strategy Tester
2. Select Adjustable_MA in Expert Advisor.
3. Select the currency pair you want to use (preferably, EUR/USD or USD/CHF - the ones you tried live).
4. Set Model to Every tick.
5. Set Period to M1.
6. Mark Use Date and select a time period of several days.
7. In Expert Properties, set your input parameters.
8. Start.

When it finishes simulation, look in the Report if there are any trades and in Strategy Tester's Journal tab if there is any error output.
 

ressss

Trader
May 10, 2011
7
0
12
Yes the output was after several hours.

I did your suggested strategy test although I don't understand how this helps with not issuing any trades during live trading.

I had discovered earlier that I get no results when the 'min diff' parameter is 3 so I changed it to 0 (I also have it at 0 with the live trading).

My first test had lot size of 0.1 and the report did have trades and the journal did have errors because partially through the test the account ran out of money.

My second test I changed the lot size to 0.01 and I did get trades in the report and the journal did not have any errors (yes I did clear the journal before the run).

In both cases I did look at the 'open chart' and discovered that shorts / sells seemed to be good but that longs / buys had 10 pips added to the entry price; i.e. sells were the open price of the bar immediately after the cross but the buys were the open price of the bar immediately after the cross PLUS 10 PIPS. Of course this made the results all negative.

All this just points out three additional problems:

1) min diff seem to have a negative effect on the operation.

2) Placing longs / buys seems to ha a significant error in the process.

3) The EA seems to have a fatal problem in that it accepts trades even if the market price really does not hit the order price.

Were do we go from here?
 

Enivid

Administrator
Staff member
Nov 30, 2008
16,999
1,020
144
Odessa
www.earnforex.com
I did your suggested strategy test although I don't understand how this helps with not issuing any trades during live trading

There's no specific difference in executing trades live or in strategy tester (other than requotes and they aren't the case, since there were no errors in your logs when you tried live trading), so if we get it to work in Strategy Tester, then it should work in live account too.


I had discovered earlier that I get no results when the 'min diff' parameter is 3 so I changed it to 0 (I also have it at 0 with the live trading).

Now I don't understand. With MinDiff=0 you had trades in Strategy Tester, but with the same settings - no trades in live trading? What period did you use in ST and how many trades did you get for that period?

In both cases I did look at the 'open chart' and discovered that shorts / sells seemed to be good but that longs / buys had 10 pips added to the entry price; i.e. sells were the open price of the bar immediately after the cross but the buys were the open price of the bar immediately after the cross PLUS 10 PIPS. Of course this made the results all negative.

Are those 10 pips fractional or standard? Because if they are fractional, then it's probably just a Bid/Ask spread. Otherwise it's very strange and is probably a strategy tester's issue (some lousy slippage emulation perhaps) because the EA uses Ask and Bid prices at the beginning of a bar and doesn't differentiate short and long trades - the only difference is whether it will use Bid or Ask price.

1) min diff seem to have a negative effect on the operation.

MinDiff is the minimum difference between the two MAs after the cross for the EA to consider it a real cross. Its purpose is to avoid "false" crosses during the flat market. Of course, if you trade on M1, reducing it to 0 or 1 is probably a good idea.

2) Placing longs / buys seems to ha a significant error in the process.

See above.

3) The EA seems to have a fatal problem in that it accepts trades even if the market price really does not hit the order price.

Do you mean slippage? By default it allows 3 pips slippage on orders. You can change this via Slippage input parameter.
 

ressss

Trader
May 10, 2011
7
0
12
I agree with the theory that there should be no difference between executing trades live or in ST but we already know that they are executed in the ST but not live - but I'll do whatever you suggest to help resolve this issue.

The ST run was using a M1 period, use dates of 2011.05.09 to 2011.05.13, total trades was 2,820. And yes the min diff was 0 in the ST and when live.

The 10 pips added on to the buys were standard not fractional. If this is a ST issue shouldn't you see the same thing?

I understand what you say about min diff and yes on this small time frame 0 works for me.

You ask if I mean slippage - no I don't mean slippage I mean that the longs / buys were way above the actual market price so in the real world they would never be filled at the stated price but the ST / ea just assumed the order was filled.

Were do we go from here?
 

Enivid

Administrator
Staff member
Nov 30, 2008
16,999
1,020
144
Odessa
www.earnforex.com
The ST run was using a M1 period, use dates of 2011.05.09 to 2011.05.13, total trades was 2,820. And yes the min diff was 0 in the ST and when live.

The 10 pips added on to the buys were standard not fractional. If this is a ST issue shouldn't you see the same thing?

I can't replicate this problem in my MT4. When I backtest this EA I get only 8 fractional pips added to the Long orders entry point - that's exactly the spread size. Meanwhile, trades are executed normally on live. Got more than 10 trades in half an hour period.

Are you sure there were no errors in the output tabs after you waited for several hours for trading to happen in live account?

The possible errors could be:
1. Position size to low. Try setting Lots to 0.1 or higher if you tried something lower than that.
2. Stop-loss or Take-profit are too close to the current price. Try increasing them if you set them much lower than the default values.
 

ressss

Trader
May 10, 2011
7
0
12
I left everything at default levels except I upped the lot size to 1 full lot and I did change the MA periods to 2 and 1 and changed min diff to 0. I did get a 130 following all send operations. How can this be?
 

Enivid

Administrator
Staff member
Nov 30, 2008
16,999
1,020
144
Odessa
www.earnforex.com
I left everything at default levels except I upped the lot size to 1 full lot and I did change the MA periods to 2 and 1 and changed min diff to 0. I did get a 130 following all send operations. How can this be?
Try turning off SL and TP completely (set them to 0) and see if that helps.
 

ressss

Trader
May 10, 2011
7
0
12
Thanks for the suggestion to 0 the sl and 0 the tp - THAT WORKED even with a lot size of .01. But it has to be a min diff of 0. Strange, I am almost positive I tried the 0 of sl and tp before but I think what I have discovered is that any time you want to make those changes to the ea that you have to remove it and then reload it with the desired settings as if it were a new ea being added to the chart.

Now if only it was coded to add the sl and tp using a modify order I could get those in as well.

What I really wish the ea had was the ability to have it issue pending orders so that if it was to go long it would buy at the high of the previous bar and if it was to go short it would sell at the low of the previous bar.
 

Enivid

Administrator
Staff member
Nov 30, 2008
16,999
1,020
144
Odessa
www.earnforex.com
Thanks for the suggestion to 0 the sl and 0 the tp - THAT WORKED even with a lot size of .01. But it has to be a min diff of 0. Strange, I am almost positive I tried the 0 of sl and tp before but I think what I have discovered is that any time you want to make those changes to the ea that you have to remove it and then reload it with the desired settings as if it were a new ea being added to the chart.

Now if only it was coded to add the sl and tp using a modify order I could get those in as well.

If 0 SL and TP worked, then you can just try different (higher than default) SL and TP input parameters and it will be opening orders with them. The problem was because SL and TP were too close to the open price.
 

fcbrants

Trader
Jul 19, 2011
6
0
12
Optimization Results

Enivid,

I've spent the past couple of days optimizing your Adjustable MA on: USDJPY USDCAD, EURCHF, USDCHF, AUDUSD, EURJPY, EURUSD & GBPUSD.

I've seen promising results on EURCHF, EURJPY & EURUSD.

I'm focusing on EURUSD & I'll resume optimizations on EURCHF & EURJPY when I'm happy with my EURUSD setup.

I'm using Dukascopy data per Birt's "Tick Data" how-to:

http://eareview.net/tick-data

I ran my first optimization over 2010 data, then tested over 2011 data - the profit dropped quite a bit from 2010 to 2011, which doesn't suprise me, considering how turbulent 2011 has been.

I re-ran my optimization over 2011 alone, so I might just be curve fitting (at its best :), but we'll see how the forward test turns out.

Here are my best settings so far for 2011, using a Spread of 1.0 (for OANDA).

The data is on the following format: You'll have to copy & parse it a little...

Date Pass Profit Total Trades Profit Factor Expected Payoff Drawdown $ Drawdown %

7/20/11 5:22 PM 777 $40,060.00 119 2.52 $336.64 $3,247.00 17.47% Period_1=46 Period_2=57 MA_Method=0 Lots=1 StopLoss=0 TakeProfit=0 TrailingStop=0 Slippage=3 MinDiff=6 LotsPer10000=1

Thanks for all of your hard work - I only have one question so far - would you like to have my first born, or my first Porsche? I'm good with either one :)

Cheers!

Franko

Adjustable MA EA was updated to new version - optional adjustable money management was added. Now you can set how many lots will it trade depending on the available free margin on the account. Pyramiding at its best!

Both MT4 and MT5 versions of the expert advisor got that update.
 

fcbrants

Trader
Jul 19, 2011
6
0
12
Log trade data? + Trade Type?

Enivid,

Would it be possible to write all trade information to the log file?

I'm running it on an OANDA MT4 account w/ 50:1 Leverage & $470.00 balance.

My settings are:

2011.07.21 03:53:10 Adjustable_MA EURUSD,M5 inputs: Lots=1; StopLoss=52; TakeProfit=0; TrailingStop=0; Slippage=3; Period_1=46; Period_2=57; MA_Method=0; MinDiff=6; UseMM=true; LotsPer10000=1;


Adjustable_MA tried to place a trade this morning (while the EURUSD was slowly but steadily climbing) with a 52 PIP stop loss.

The only error in the Experts log is:

2011.07.21 08:35:01 Adjustable_MA EURUSD,M5: 130

Error 130 is "Invalid Stops", but I don't have any of the other trade parameters, so I don't have much to troubleshoot with.

Also, do you send a market order (ie, fill at the current market price), or do you specify a price when you send an order (ie, fill at this price...).

Thanks!!

Franko
 

fcbrants

Trader
Jul 19, 2011
6
0
12
EURCHF Settings:

Here are my optimization results over the period 1/1/2011 to 7/19/2011:

These are the top 4 results, sorted by profit.

The data is in the following format (ie, copied directly from the MT4 strategy tester)

Pass Profit Total Trades Profit Factor Expected Payoff Drawdown $ Drawdown %


184487 37559.14 184 1.90 204.13 5785.14 20.24% Period_1=48 Period_2=85 MA_Method=0 MinDiff=7 Lots=1 StopLoss=0 TakeProfit=0 TrailingStop=0 Slippage=3 LotsPer10000=1


184451 37545.75 184 1.91 204.05 5829.04 20.39% Period_1=48 Period_2=84 MA_Method=0 MinDiff=7 Lots=1 StopLoss=0 TakeProfit=0 TrailingStop=0 Slippage=3 LotsPer10000=1


184560 36879.87 180 1.91 204.89 5677.82 21.54% Period_1=49 Period_2=87 MA_Method=0 MinDiff=7 Lots=1 StopLoss=0 TakeProfit=0 TrailingStop=0 Slippage=3 LotsPer10000=1


184485 36362.63 194 1.82 187.44 6090.52 19.66% Period_1=46 Period_2=85 MA_Method=0 MinDiff=7 Lots=1 StopLoss=0 TakeProfit=0 TrailingStop=0 Slippage=3 LotsPer10000=1

More to come :)