Trading Silver with PSAR SUPERTREND EA plus ZigandZag & PSAR Oscillator Confirming - page 3

 

New EA: ZAZ PSAR v1.00

Hello JJ,

I do my development using M5 time period to get more signals to evaluate. I agree with you that a longer time period produces better profitability.

I'm releasing a very preliminary version so if you read this post early enough you can use it for some DEMO ONLY testing today. The buy/sell logic is a ZAZ arrow occurred up to ZAZ.ActivePeriods ago and then PSAR oscillator crossed the zero line in the direction of the ZAZ arrow. Do we have a valid signal if the PSAR crossed just before the ZAZ signal? There is no check to insure that the ZAZ trend changed before the ZAZ Arrow was displayed. The Supertrend indicator is not used in the order determination. Can you please elaborate on how the Supertrend is used:

"Supertrend tells the EA when to BUY and SELL and when to do nothing at all. Seemed to handle choppy markets fairly well and never I had a problem with the CPU getting overloaded, so I stand encouraged."

I can understand Buy and Sell based on colors but how do you handle choppy markets with it to cancel a signal?

We have not discussed Stop Losses, but I consider them to be mandatory to prevent catastrophic loss in the event of computer malfunctions or internet failure. For initial testing use TurtleStops, you can vary the lookback bars to increase the StopLoss.

You will see a lot of variables for additional capabilities, some are implemented but most are untested for this version. Do not change them yet. Do not use money management, it is untested. Also, I have done all of my development using a 5 digit ECN, so there may be issues with 4 digit quotes, possibly off by a factor of 10. Let me know your broker and I will download and install their demo system for our testing.

I have put diagnostics in the "Experts" tab of the Terminal display and also create a .CSV file in the Files subdirectory of Experts. Open it with Excel as Read Only.

I'll try to post a more complete system on Sunday so we can test it next week.

Cheers,

Files:
 

A Winner!

Hello JJ!!

After uploading Zazzy, I ran it and found a couple of bugs in the signal generation that were fixed and then started it. It picked a short and gained about 25 pips before falling back to around 10. The stop losses are not working as it should have moved to a zero SL but that's my next challenge.

I also modified ZAZ to make the screen display more visual. Changed the buy arrows to green, increased their size and the zig zag's size and then changed the Limit indicator to a white sideways arrow. The three black indicators, 1,2,3 are for internal storage only. I should rearrange the buffer sequence so they don't show.

We may also want to run SuperTrend on a 4x timeframe and use it to determine the size of SL, TP or even if we want to enter the trade.

Cheers,

Files:
june17.gif  24 kb
zigandzag.ex4  10 kb
 

Great progress, Tzuman!

I will test the latest version this evening and let you know the results.

My live account broker is Trading Point. They trade silver and are one of the few international brokers that hasn't knuckled under to the new US regulations regarding margin, etc. They are a 5 digit broker.

I've been using Tadawul FX on a previous demo account. Liked everything about them except that they are not accepting US account holders. Have less problems downloading data for the Strategy Tester with TDFX than with TP, so am still using their demo account. They are a 4 digit broker.

Regarding the question of whether to allow the PSAR Oscillator to precede the ZAZ signal: Reviewing some of the past signals, I think we should allow for now that the trend change signal is triggered even if the PSAR-O precedes.

Reason being that markets are not an exact science but an approximate one. If the PSAR-O signal arrives early, that does not make a material difference, to my mind. Testing both ways will allow us to answer that definitively, but my reading the patterns suggests we're better off not defining matters too narrowly. Do you concur?

Finally, let me see if I can get a more detailed explanation of how the Average True Range (ATR) works as a buy/sell indicator. May have to ask Jason Rogers if I can't find a clear explanation elsewhere. :-)

As to testing, I agree that we should follow the KISS principle (Keep It Simple Smartaleck) and test the basics first, then add and test the other features which can further refine the EA. I will probably test various periods from the first of 2011 till now.

Have fun!!

JJ

 

Hi Tzuman!

I downloaded the corrected EA and loaded it into the TDFX and Trading Point demo accounts. Oddly, while I copied it into the EXPERTS file, it shows up on the demo account Navigator under CUSTOM INDICATORS.

However, it won't attach to the chart as either an EA or as an Indicator. This is true for both broker accounts.

It doesn't show up at all in Language Editor. I'm probably missing something obvious, but for the life of me can't figure out what.

Any ideas?

JJ

 

JJ:

ZigAndZag should go into your INDICATORS sub directory and ZAZ PSAR V1.01 into the EXPERTS directory. They are both only executable files (EX4) so you will not see them in your language editor as it uses MT4 or MQL extensions. Moreover, if you are running Metatrader when you copy them to the directories you have to stop and restart Metatrader to see them in your Navigator Pane as it does not refresh as some other programs do when files are added.

I believe Metatrader has checks to insure only EAs run in the Experts directory and Indicators in the Indicators directory.

 

To Tzuman:

Yeah, the steps you described are pretty much SOP. Went through them again and even rebooted my PC and finally they showed up as they should have.

Seemed like the MT4 (or my PC) was having a hard time 'digesting' the EA, but that is anthropomorphizing, isn't it?

Anyway, got it working. Nothing I did would get it to take any trades. Here is what the Strategy Tester journal in TDFX (4 digit broker) recorded:

2011.06.18 08:00:59 2011.01.25 00:00 ZAZ PSAR V1.01 EURUSD,M5: cannot load external expert 'drawing'

2011.06.18 08:00:59 2011.01.25 00:00 Cannot open file 'C:\Program Files\Tadawulfx Trader 4\experts\drawing.ex4' on the EURUSD,M5

2011.06.18 08:00:59 2011.01.25 00:00 Cannot open file 'C:\Program Files\Tadawulfx Trader 4\experts\libraries\drawing.ex4' on the EURUSD,M5

2011.06.18 08:00:59 2011.01.25 00:00 ZAZ PSAR V1.01: invalid handle 0 in FileFlush

2011.06.18 08:00:59 2011.01.25 00:00 ZAZ PSAR V1.01: invalid handle 0 in FileWrite

2011.06.18 08:00:59 2011.01.25 00:00 ZAZ PSAR V1.01 EURUSD,M5: Signal 0 0 0 ZAZ 1 0 0 Occ -0.0006 -0.0007

2011.06.18 08:00:59 2011.01.25 00:00 SAR oscillator EURUSD,M5: loaded successfully

2011.06.18 08:00:59 2011.01.25 00:00 ZigAndZag EURUSD,M5: loaded successfully

2011.06.18 08:00:59 2011.01.25 00:00 SuperTrend EURUSD,M5: loaded successfully

Trading Point (5 digit broker) had the same experience; no trades over the same 3 month period. The journal recorded:

2011.06.18 08:12:53 2011.01.03 01:00 ZAZ PSAR V1.01 EURUSD,M5: expert stopped

2011.06.18 08:12:53 2011.01.03 01:00 ZAZ PSAR V1.01 EURUSD,M5: cannot load external expert 'drawing'

2011.06.18 08:12:53 2011.01.03 01:00 Cannot open file 'C:\Program Files\Trading Point MT4\experts\drawing.ex4' on the EURUSD,M5

2011.06.18 08:12:53 2011.01.03 01:00 Cannot open file 'C:\Program Files\Trading Point MT4\experts\libraries\drawing.ex4' on the EURUSD,M5

2011.06.18 08:12:53 2011.01.03 01:00 ZAZ PSAR V1.01: invalid handle 0 in FileFlush

2011.06.18 08:12:53 2011.01.03 01:00 ZAZ PSAR V1.01: invalid handle 0 in FileWrite

2011.06.18 08:12:53 2011.01.03 01:00 ZAZ PSAR V1.01 EURUSD,M5: Signal 0 0 0 ZAZ 1 0 0 Occ -0.0031 -0.0037

2011.06.18 08:12:53 2011.01.03 01:00 SAR oscillator EURUSD,M5: loaded successfully

2011.06.18 08:12:52 2011.01.03 01:00 ZigAndZag EURUSD,M5: loaded successfully

2011.06.18 08:12:52 2011.01.03 01:00 SuperTrend EURUSD,M5: loaded successfully

Hopefully this gives you what you need, Tzuman. Looking forward to hearing your input.

Have a great day!!

JJ

 

Yeah it does. Great intuition on your part. I added graphic text and forgot the primitives. Place Drawing. EX4 in your Libraries subdirectory of Experts.

Cheers from Cape Cod

Files:
drawing.ex4  8 kb
 

To Tzuman:

That made a GREAT difference. I've started testing on theTDFX demo acct, though the results indicate that the EA is not following the ZAZ OSC-O trend reversal signals.

Note that using the 4H TF, a LONG ONLY trigger occured Jan 11th, 2011 and a SHORT ONLY trigger occured Feb 3rd. The next trigger (LONG) occured Feb 15th, but I didn't pick that up when I set the 30 day test period.

Using the 1H TF the LONG ONLY trigger is Jan 10, SHORT ONLY trigger Jan 28, LONG ONLY trigger is Jan 31, SHORT ONLY trigger is Feb 2, LONG ONLY trigger Feb 7 and finally SHORT ONLY trigger Feb 10.

The 5M TF reverses multiple times intra-day, which defeats the purpose of the ZAZ-O in my opinion.

Anyway, the answer may lay in the journal again, it is in the attachment named TEST.

*******

Tried doing a forced LONG ONLY using EA inputs in Strategy Tester, but still got negative results.

Once we get the order issues above resolved, how about we start from a known point, shutting down all of the features we'd like to have and only use the ZAZ-O features for direction and the Supertrend features to trade.

I will replicate that using the v202 and forcing the trade direction to give us a benchmark;then we can add/change features to see if they improve things or not.

Meanwhile, I will play with the ZAZZY-O EA (we've got to come up with a catchy name for this) (PZAZY-O; P-ZAR-O ?) and let you know what happens.

Have fun!!

JJ in Arizona (It's a dry heat!)

 

Hello JJ,

I've had similar problems with the order code with the other EA that I plagiarized. First of all. are both your demo account ECN's? if you know and they are not, set the input ECNBroker to false (lower case only). This will probably eliminate most of your errors. If your brokers are ECN, then you must leave the input as true. An ECN broker uses an Electronic Clearing Network and passes your orders directly to the Majors for fulfillment. A non ECN broker uses a Dealing Desk where your orders are received and "filled" internally I believe. The difference between the two is with an ECN, the order must be separated into two parts. The base order must be sent without any Stop Loss or Take Profit. Once entered, the SL & TP are updated by order number using an order modification. I am aware of the problem and have been searching to find its cause and solution. The other problem exists with modifying existing orders for updating the trailing Stop Loss value. A Stop Loss, Stop Buy or Stop Sell require a certain "pad" between the amount and the market called the "stoplevel" Unfortunately FXCM does not provide the number so I have to swag it. As you can visualize as the market is going down and the trailing stop is increasing, it is easy to make an attempt to place the SL inside of the stoplevel and an 130 error results. I first try to change it to 1/2 the distance between the two and if the error occurs, then leave the SL alone but it does result in multiple 130 errors.

Right now, Zazzy is using a completely different algorithm for order purchase than PSAR Supertrend 202. It is identifying a potential order when the ZAZ arrow appears in Bar 1. This sets a Bar timer and if the PSAR Oscillator crosses in the correct direction the order is placed. If the cross does not occur, then when the timer exceeds the ZAZ.ActivePeriods, the timer is turned off. The way I wrote the Signal Generator, the old 202 logic can be easily reimplemented.

Let me reimplement the old 202 order placement logic using an input switch so we can test both old and new ways and study the trend reversal logic. I understand the problem with the M5 data causing too many intra day reversals, but I need a time frame that enables multiple orders per day for testing and debugging. Tomorrow, I will download the demo systems from your brokers and use them as well. Please let me know their URL's. I will also try to determine if I can use the strategy tester for development on a longer time frame. Let's try a 4h TIME frame and let me know the best 30 day interval to test in.

Cheers,

Tzuman

 

To Tzuman;

I'll try to make this my last post for today. :-)

I just ran the v202 for the Jan 10, 2011 to Feb 10, 2011 period with default settings.

Using the 1H TF I noted the five ZAZ trigger dates and ran Strategy Tester using the forced LONG ONLY/SHORT ONLY input option to simulate the ZAZ-O effect.

Starting with a $1000 balance, we ended with $1,188.00. Not a great period, but one chosen largely at random when I first tested the ZAZZY-O EA, so this lets us do some comparing.

Later I'll track test results on an Excel spreadsheet and keep a separate folder for the test reports. Another reason it would be nice to get the new EA down to 'racing' weight; there will be LOTS of test runs!!

Attached are the five parts of the v202 test; hopefully looking at them will provide you with useful info to assist with your programming.

JJ