stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Trading the Basket Equity chart
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=1263
Page 1 of 3
Author:  jjaa [ Mon Dec 03, 2012 10:55 pm ]
Post subject:  Trading the Basket Equity chart

Hi, I’ve been following Bunker’s “BigMac” thread, http://www.stevehopwoodforex.com/phpBB3 ... f=16&t=790 , and have looked at Gary’s and George’s “BasketEquity” indicator, with the idea of trading based on the BasketEquity indicator and a Moving Average line of the BasketEquity. The BasketEquity v1.05 indicator was modified to produce two lines, the top line is BasketEquity + BasketEquityOffset, and the bottom line is BasketEquity – BasketEquityOffset, and the moving average is applied to the BasketEquity, as shown below. The actual BasketEquity line is not shown. This indicator is not intended to monitor the equity of an open basket in the account, but rather to provide buy/sell signals. I have made several modifications to Gary and George’s excellent work and therefore I have renamed the indicator Baskequi.

The following chart is about 1 year of H4 data on Basket1.
basket1.jpg
The “BasketEquityOffset” is in dollars and amounts to a buffer, to reduce false signals. In the example above, with lotsize = .01, BasketEquityOffset =$25. The Moving Average is 200 lsma. The MA is integrated into the indicator and is user selectable for Period, Shift, and Method ( sma = 0, ema = 1, smoothed = 2, and lsma = 3).

The left corner displays the pairs in the basket, with the blue pairs the so-called “BuyPairs” and the red pairs the so-called “SellPairs”. I say “so-called” because this would be for a long basket. If the signal is to Buy, then the blue pairs would be bought and the red pairs would be sold. If the signal is to Sell, then the blue pairs would be sold, and the red pairs would be bought. The color of the pairs doesn’t change. Buy the blue pairs and sell the red pairs, or sell the blue pairs and buy the red pairs, based on the signal.

As you can see, a BUY signal occurs when the lower line crosses the MA from below at bar close, and the opposite for a SELL. I think this is an “always in” system. Close the BUY basket when a SELL signal happens, and open a SELL basket. Then close the SELL basket, open the BUY basket and so on.



This indicator is configured to allow us to look at different hypothetical baskets, which are defined in a small .csv file, one file for each basket, named b1.csv, b2.csv and so on. It is very easy to fire up Notepad, or even Metaeditor, and type in the BuyPairs separated by commas, then a semicolon, then the SellPairs, separated by commas like this:

AUDJPY, AUDUSD, GBPJPY; EURAUD, EURGBP, EURUSD

Save this file as …/experts/files/b1.csv



I chose to use .csv files so that a buy or sell script can read the same .csv file, and make opening a basket easier. Also initially I was hard coding the baskets into the indicator, but I found it inconvenient, because recompiling the indicator every time I wanted to add a new basket causes all the existing charts to reset.


To load the indicator, use the template provided, if you like, then, in indicator properties, choose your basket number. You need a corresponding file in the experts/files folder. You may also choose basket = 0, and type in yours pairs in the following fields, separated by commas. Choose your Lotsize, BasketEquityOffset, MA_Period, MA_Shift, and MA_Method.

In my next posts I will look at some charts.

Below is the indicator, template, and a .csv file. Please place in the appropriate folders of your Empty4 platform. The .csv file goes in .../experts/files.

I hope someone finds this useful.

Jack

It may be necessary to switch timeframes to get the indicator to work.
I don't know why this happens. Maybe someone can help, please.



Baskequi.mq4
baskequi.tpl
b1.csv
Author:  Jemook [ Mon Dec 03, 2012 11:13 pm ]
Post subject:  Re: Trading the Basket Equity chart

Brilliant first post Jack!! Welcome to the forum, I for one am looking forward to hearing more from you.
Author:  jjaa [ Mon Dec 03, 2012 11:37 pm ]
Post subject:  Re: Trading the Basket Equity chart

Thanks Jemook.

Let’s look at the chart posted above.. We can get an approximate profit/loss from each signal by placing the crosshair tool halfway between the 2 lines on the first bar where the lines are green, and extending it to the same spot on the first bar where the two lines are red :
crosshairs.jpg

The middle number is the profit/loss in dollars. This number depends on the Lotsize property in Indicator properties. In this case .01 lots. This BUY signal made about $351 – spread (about $3-4 at FXDD) for a basket trade that required about $160 margin at FXDD and lasted almost 4 months.

Here are the results since late November 2011:
Basket1profit.jpg
This Basket, at these settings, would have produced about 351+115+176+122+85(so far) = $849 in the last year +2 weeks. Say we allocated $250 of capital, this basket produced about 340% in the time period we looked at.
Author:  jjaa [ Tue Dec 04, 2012 12:30 am ]
Post subject:  Re: Trading the Basket Equity chart

We need to find baskets like the one above that have nice smooth BUY and SELL signals. The BasketEquityOffset is important.

Of course, some baskets may encounter consolidation, and even some bad signals. Lets look at the same chart, but reduce BasketEquityOffset to $20 per .01 lot. There are 3 losing baskets in April (and a Breakeven):
basket1a.jpg
The losses are small, about $111. The results for this period are approximately 351+0-20-31-60+63+176+122+85 = $686.

Still good.

I think the key to minimize risk is to only enter on a signal. Don’t enter late when the lines are away from the MA. This keeps the losses to $20 – 60. With wins of several hundred dollars sometimes, these losses are OK.
If our basket tanks, we are going to get a reversal signal before things get too ugly.

We can also put a basket stop loss of say $75 using MPBM.
Author:  Jemook [ Tue Dec 04, 2012 1:18 am ]
Post subject:  Re: Trading the Basket Equity chart

Hi Jack,

I loaded up the template, indicator and .csv file into the correct folders and launched the template. I can't seem to see what you are seeing. All I can see is a blank blue chart. Any tips?
Author:  jjaa [ Tue Dec 04, 2012 1:40 am ]
Post subject:  Re: Trading the Basket Equity chart

Darn, I've seen this but only on weekends.....I was puzzled but then it worked when market opened.

Sometimes I have to change timeframes to get it to plot correctly. But that's probably not it.

Try to set BasketNumber = 0 and type in some pairs
Author:  jjaa [ Tue Dec 04, 2012 1:52 am ]
Post subject:  Re: Trading the Basket Equity chart

I just reproduced your problem in a different instance of metatrder and switching timeframes fixed it.

Not sure why that happens. Maybe a more experienced coder can help.
Author:  garyfritz [ Tue Dec 04, 2012 2:36 am ]
Post subject:  Re: Trading the Basket Equity chart

Jack, how did you choose the basket you used? I'm a bit surprised at how long it trended so nicely.
Author:  jjaa [ Tue Dec 04, 2012 2:42 am ]
Post subject:  Re: Trading the Basket Equity chart

I was looking at StormRadar I think. Looking at past signals.
Author:  Jemook [ Tue Dec 04, 2012 2:47 am ]
Post subject:  Re: Trading the Basket Equity chart

Switching TF doesn't work and I've tried on two different accounts. Still getting a blank screen. Will wait to see if it works on other peoples accounts. Does this look correct?
2012-12-04_1346.png
All times are UTC Page 1 of 3