The LowPassSeven--a Zorro tested EA

Dewey McG
Trader
Posts: 435
Joined: Sat Nov 26, 2011 4:20 pm
Location: Tampa FL

Re: The LowPassSeven--a Zorro tested EA

Post by Dewey McG »

I have the corrected reports here and thought I would explain them a little more.

The optimization graph shows a number of green boxes. The darker colored boxes indicate the setting is more profitable. Ideally you want a cluster of green boxes so as market conditions change your settings won't suddenly be way off. Don't just assume the darkest setting is the best.

If you look at the optimization report you see the most profitable setting is with the lowPassPeriod set at 14 and the Stopfactor at 1. However, the draw down is much higher too: 17.74%! That is much too high for my liking. I would use a lower risk to get this lower, but that would reduce the profitability.

Now if we look down the list and use a lowPassPeriod of 16 and a Stopfactor of 2, we don't have as much overall profit but the draw down is only 5.65%, a much easier figure to live with. In fact, we could raise the risk a little more and generate more profit and still have a reasonable draw down. I shouldn't run backtests after the market closes because the spread is too high—4 pips—but since it is a daily chart I didn't want to wait. Over the same period we now get 5106 in profit with a profit factor of 2.91 and a draw down of just 8.55%. Not too shabby—and with low risk, no martingale, recovery or any other potential account busting gimmicks.

I ran another back test going back a few years further with equally good results. Later on I will run a 10 year test, but these all take time.

Unfortunately, it doesn't trade very often, averaging about once a month. I will do more testing for other pairs but I do not suggest a basket trader, unless you can run different settings for each pair. Otherwise I think it will fail.

I will be here this weekend, but will be gone out of town on business all next week so won't be able to do any testing after Sunday night, so I can come up with the settings for one more pair until I get back.
You do not have the required permissions to view the files attached to this post.
TraderTim
Trader
Posts: 21
Joined: Fri Dec 30, 2011 7:49 pm

Re: The LowPassSeven--a Zorro tested EA

Post by TraderTim »

TallCoolOne wrote:Hi.

Thanks for sharing your EA. I noticed in the backtesting that I performed. It was only taking sells, no buys. I think you are sending sell orders for both conditions. Thanks! TCO
Both the EA on post #1 and the modified one posted by Sgt Forex are still only doing sells in my backtesting. Anyone else? Thanks guys.
Dewey McG
Trader
Posts: 435
Joined: Sat Nov 26, 2011 4:20 pm
Location: Tampa FL

Re: The LowPassSeven--a Zorro tested EA

Post by Dewey McG »

TraderTim wrote:
TallCoolOne wrote:Hi.

Thanks for sharing your EA. I noticed in the backtesting that I performed. It was only taking sells, no buys. I think you are sending sell orders for both conditions. Thanks! TCO
Both the EA on post #1 and the modified one posted by Sgt Forex are still only doing sells in my backtesting. Anyone else? Thanks guys.

I will spend some time trying to figure where the problem is. Gah--this is driving me crazy. The code seems straight forward:

manageOrders();

//--------------------------------------
// Go Short
if (((Open[1] > iCustom(NULL, 0 , "lowpass", lowPassPeriod , 2 , 0, 1)) && ((Close[1] < iCustom(NULL, 0 , "lowpass", lowPassPeriod , 2 , 0, 1)) && (Low[1] > iCustom(NULL, 0 , "lowpass", lowPassPeriod , 3 , 0, 1))))) {
// Action #1
sqCloseOrder(100);

// Action #2
sqOpenOrder("NULL", OP_SELL, getOrderSize(200, OP_SELL ), getOrderPrice(200), "", 200);
}
//--------------------------------------
// Go Long
if (((Open[1] < iCustom(NULL, 0 , "lowpass", lowPassPeriod , 3 , 0, 1)) && ((Close[1] > iCustom(NULL, 0 , "lowpass", lowPassPeriod , 3 , 0, 1)) && (High[1] < iCustom(NULL, 0 , "lowpass", lowPassPeriod , 2 , 0, 1))))) {
// Action #1
sqCloseOrder(200);

// Action #2
sqOpenOrder("NULL", OP_BUY, getOrderSize(100, OP_BUY ), getOrderPrice(100), "", 100);
}

return(0);



As I mentioned I am very new at coding so it might be a little while before I see why it isn't taking the buy orders.
garyfritz

Re: The LowPassSeven--a Zorro tested EA

Post by garyfritz »

Why are you comparing yesterday's High, Low, etc against yesterday's lowpass value? That's what the [1] in Open[1] &etc does, and the last parameter to iCustom() is also a shift parameter.

Other than that, I don't see anything obvious wrong. You've got a bunch of Log() calls in the EA -- time to go check the Experts tab and see if it's printing what it should be printing. You might want to change Log() so it writes to a file instead of Print()ing -- the Experts tab is a pain to use.
Dewey McG
Trader
Posts: 435
Joined: Sat Nov 26, 2011 4:20 pm
Location: Tampa FL

Re: The LowPassSeven--a Zorro tested EA

Post by Dewey McG »

I found the problem (with some help) and checked to make sure it opens both buy and sell orders. New Version in Post 1. I will have to do the backtesting again when markets are open to get more accurate results, but after doing a first run everything looks good so far (Profit factor 2.7 Drawdown 10.63, 65.57% of trades won. Average profit 422.07, average loss 297.94)

It was in function getOrderPrice(int orderMagicNumber)

where there was:
if(orderMagicNumber == 100) {

price = Bid;
}

while it should be
if(orderMagicNumber == 100) {

price = Ask;
}


When you start learning to code you develop an even greater respect for people like Steve and Baluda!
You do not have the required permissions to view the files attached to this post.
Dewey McG
Trader
Posts: 435
Joined: Sat Nov 26, 2011 4:20 pm
Location: Tampa FL

Re: The LowPassSeven--a Zorro tested EA

Post by Dewey McG »

garyfritz wrote:Why are you comparing yesterday's High, Low, etc against yesterday's lowpass value? That's what the [1] in Open[1] &etc does, and the last parameter to iCustom() is also a shift parameter.

Other than that, I don't see anything obvious wrong. You've got a bunch of Log() calls in the EA -- time to go check the Experts tab and see if it's printing what it should be printing. You might want to change Log() so it writes to a file instead of Print()ing -- the Experts tab is a pain to use.

The person who designed the tool I use for making EA's found the problem for me.

As far as the rest, I used the strategy tester to run the EA in visual mode for a few minutes and it was taking the trades at the right spot
User avatar
Carioca
Trader
Posts: 49
Joined: Sat Jun 09, 2012 12:12 am

Re: The LowPassSeven--a Zorro tested EA

Post by Carioca »

Dewey McG wrote:
Hopefully a better and more experienced programmer can use Steve's template and provide a better code.
Sorry for the english

No need to be a programmer to make things super simple, you manages to make.

1 - Go on ReadIndicatorValues() and inside call the indicator.

Code: Select all

PassHigh = iCustom(NULL, 0 , "lowpass", LowPassPeriod , PRICE_HIGH, 0, 1);
PassLow = iCustom(NULL, 0 , "lowpass", LowPassPeriod , PRICE_LOW, 0, 1);
Read the documentation here: http://docs.mql4.com/indicators

2 - Go on LookForTradingOpportunities() and say to EA when to buy and when to sell.

Code: Select all

if (Open[1] < PassLow && Close[1] > PassLow && High[1] < PassHigh) SendLong = false;
if (Open[1] > PassHigh && Close[1] < PassHigh && Low[1] > PassLow) SendShort = false;
Read the documentation here: http://docs.mql4.com/basis/operations and http://docs.mql4.com/predefined/variables

3 - Go above DisplayUserFeedback () and set "PassHigh" and "PassLow" using double and call an "extern int" to "LowPassPeriod"

Code: Select all

extern string    pas="----LowPass inputs----";
extern int      LowPassPeriod=15;
////////////////////////////////////////////////////////////////////////////////////////
double      PassHigh, PassLow;  
////////////////////////////////////////////////////////////////////////////////////////
4 - If you want a close opposite signal in va LookForTradeClosure(int ticket) and tell EA when it should exit the trade.

Code: Select all

   if (OrderType() == OP_BUY)
   {
...
       if (CloseOnPass && Open[1] > PassHigh && Close[1] < PassHigh && Low[1]) CloseThisTrade = true;
...
   } 

  if (OrderType() == OP_SELL)
   {
...
       if (CloseOnPass && Open[1] < PassLow && Close[1] > PassLow && High[1]) CloseThisTrade = true;
...
   }
Call an "extern bool" for CloseOnPass

Code: Select all

extern string    pas="----LowPass inputs----";
extern int      LowPassPeriod = 15;
extern bool CloseOnPass = true;
////////////////////////////////////////////////////////////////////////////////////////
double      PassHigh, PassLow;  
////////////////////////////////////////////////////////////////////////////////////////
EA coded :)

I hope I helped
Last edited by Carioca on Sun Nov 25, 2012 9:26 pm, edited 1 time in total.
bshoe24
Trader
Posts: 84
Joined: Sat Feb 11, 2012 5:53 pm

Re: The LowPassSeven--a Zorro tested EA

Post by bshoe24 »

Is there an indicator yet for this "Low Pass" so that we can follow along visually on charts with the setups? Thanks for sharing the EA for testing.
Dewey McG
Trader
Posts: 435
Joined: Sat Nov 26, 2011 4:20 pm
Location: Tampa FL

Re: The LowPassSeven--a Zorro tested EA

Post by Dewey McG »

bshoe24 wrote:Is there an indicator yet for this "Low Pass" so that we can follow along visually on charts with the setups? Thanks for sharing the EA for testing.
The indicator is in the first post, but will upload it here again with a template and a picture
You do not have the required permissions to view the files attached to this post.
bshoe24
Trader
Posts: 84
Joined: Sat Feb 11, 2012 5:53 pm

Re: The LowPassSeven--a Zorro tested EA

Post by bshoe24 »

Oh crap i didn't see it attached at the bottom of that post below the graph. I feel stupid. Thanks!!
Post Reply

Return to “Automated trading systems”