Channel Trading: Viking1961 500 step system

haha, no, an jump of about 300 pips in the cable in a very short timeframe, that was both fun and scary at the same time :slight_smile:

Hi everyone!

I have come to the conclusion that a completely automatic system is beyond us, partly because of the system itself, but also because we don’t understand it well enough yet. At least I don’t. I have therefore coded a new EA that allows me to change variables manually as the rate changes, basically to run simulations and see what happens if I change x versus y. I was rather hoping that someone else would put aside some time to run simulations as well and share their experiences so we can all learn faster.

I’m not a programmer so please ignore the many weird choices I had to make to make things work with limited skills. This code is also not meant for running a channel, so please don’t try this live!

I basically create two arrays for long and short orders with their appropriate open prices and status, and then check if they’re open and inside the channel, if not I add them. I put the expected open price in the orders comments so that I always know where that order is supposed to be (regardless of slip etc), and use MagicNumber to separate regs, main, secondary and sub-primers. The arrays are set for GBP/USB range, but are easy to change.

If a reg is undersized and pending, it gets deleted as currentLotSize grows. If it’s undersized, but open, I set TP to open price and then ignore it so that a new reg with the correct size can be added when appropriate (CloseLong vs MarkLong).
Primers are all opened as market orders. Main primers are 3x regs size, Secondary primers are 1.5x, and Sub-primers 0.75x, all rounded up. Main primers taken out by SL are replaced by a new main at secondary size.

I use separate functions to change ChannelTop/Bottom to include horizontal lines on the chart in addition to a bunch of other useful info like equity, amount of open orders etc. Main and secondary primers has trailing stoploss.
You can auto-extend the channel (regs) up to the lowest main long or highest main short primer by turning on AutoExtendChannel.

If you take a look at the screenshot here: http://charts.mql5.com/1/753/gbpusd-m1-trading-point-of.png
the data at the top left corner is as follows:
Row 1: MT default auto info about symbol and rates
Row 2: Name of the EA, then any message I write into the msg variable (more on that later)
Row 3: Amount of open long (amount of insecured longs, no SL yet), same for shorts, the difference in units, and then the current drawdown.
Row 4: Account balance, Equity (equity in % of balance), free margin
Row 5: Border
Row 6: Current ChannelTop (ShortTop and LongTop, more on that later)
Row 7: Current ChannelBottom (etc)
Row 8: Border
Row 9: Current lot size for regulars

The magenta lines shows ChannelTop/Bottom.

According to M, there are only a few things that should ever be changed manually, but these also has to be changed depending on patterns:

  1. MainPrimerTakeProfit
  2. MainPrimerDistance
  3. SecondaryPrimerTakeProfit
  4. SubPrimerSize
  5. ChannelTop
  6. ChannelBottom

When and how you change these will be the difference between success and failure, but I’m having a very hard time understanding when to do what. I have the tools (kind of), but don’t know how to use them yet.

I’ve made ChannelTop/Bottom an external variable so that you can change it as you see fit (if AutoExtendChannel is false), but the code will also change it with the drawdown calc so you won’t be busted because you forgot to change it.

I’ve added ShortTop/LongTop and ShortBottom/LongBottom (and regs check against them, not ChannelTop/Bottom) so that you can turn on regs in only one direction above/belove normal channel borders. The idea is that at an extreme point like 2.1 for cable you may want to start adding regular shorts earlier than longs. Any change to ChannelTop/Bottom will reset these variables to the same rate.

Now, the point of all this is the function [B]ManualChangesToVariables()[/B] which triggers on every tick. What I do is start up a visual backtest, run the EA at top speed until I get to a point where I want to change a variable due to patterns, retracements, equity getting too low or whatever. I note the time and add a line in ManualChangesToVariables() that changes whatever variable I would have changed if this was a live run (where external variables are available directly), then I need to recompile and start the visual test all over again.

It’s time consuming, but at top speed it’s still much better than running live and waiting for weeks or months to test a theory. Once I get back to the same place and the message changes on the chart, I slow the speed down and start looking for results of my changes and any new changes that might be needed. Then rinse and repeat.

With testing and hopefully more info from M we will eventually learn that you should increase/decrease MainPrimerTakeProfit when x happens, while you change SubPrimerSize when y happens, and if z then q and p, but only slightly more q.

I don’t know if this system can ever be completely automated, but I’m pretty sure we can cut the workload drastically down and perhaps the most important goal would be to make it stable enough that the channel will survive on it’s own while you actually get a full nights sleep and spend some time at that pesky job that keeps getting in the way for hours every day too.

The EA is available here: http://sdrv.ms/13uW1wF
Tick data 1M for GBP/USD here: http://sdrv.ms/13uW6AE

Re
D

PS! For those who don’t know, you can right-click a chart in MT 4 and choose Save as Picture… Then you’ll get the choice to publish the image online so others can see your scenario with a public link.

Bug check of new line in IE10, just ignore

Worked again for around 5 months, and then I kept getting this error
2013.06.10 15:05:59 2010.05.20 19:56 Greenland strategy with Mainsecondary and subprimers Rev0 EURUSD,M1: OrderSend error 148

Your broker has set a limit on how many orders can be registered (excluding closed ones), probably 100 or 200. You’ve passed that limit. Does the EA delete pending orders far away? That usually keeps the order count at a reasonable level.

Re
D

Hmm … I am not sure … I feel the system has a high risk of emotional involvement when you take positions both way. As well … I never found back-testing a prudent way to measure a trading system’s effectiveness. I can take any system and make it fit with past prices. And how come you are just going in with 50USD?

As a professional trader, this is what I would do to test the strategy:

  • allocate 2,000 - 5,000 demo cash to test the strategy
  • have specific rules written down in point form as a reference (no long winded stories)
  • “forward”-test the strategy for 1-month. If its brutal, drop it. If it shows some promise, run with it for another month or two.
  • Finally move in with real cash. Don’t go big, just small cash. Then real-time test it for at least 6 months. No less. You want to get super comfortable with the strategy and are not emotional with it.

Check out my blog … there is some additional advice on professional trading.

In my opinion, any strategy that shows some promise should be tested for 6 - 12 months to really get comfortable with it and get the excitement out of it.

Good luck!

  • Matt

Hmm. even when I am just backtesting?

Same rules apply. In your experts folder for MT4, there a sub-folder called include. Open the stderror.mqh file and you’ll see what errors mean. Like this one #define ERR_TRADE_TOO_MANY_ORDERS 148

Re
D

Hi Matt

Thanks for the input.

I have been demotesting this for 3-4 months now; and it seems to work like a charm. My overall equity is up some 300-400 USD, and I have closed trades for about 500-600 USD in profits.

My only (but really deep) concern is how this will work in an extreme market. So far I haven’t needed to add primers, which is why I am unsure if it will work then. In a ranging market it is perfect and easy to handle.

When the market starts to jump out of bounds we might have some problems.

And the rate WILL jump out of the zone you can cover with regular trades, which means we have to nail down the logic for primers. A static placement of 30 pips doesn’t work in the long run, all our tests show that. We need to change TP and placement distance to fit the patterns, but the docs doesn’t include any info on when to change what. I’m hoping to get more data from M so that I can test out a much more flexible system. At the moment I’m struggling to see what to do and when as we’re missing the fundamental knowledge of how primers work.

Re
D

Do any of you know the answers to these questions?

  1. You change main primer distance when:
  2. You change main primer TP when:
  3. You change secondary primer TP when:
  4. You change sub-primer size when:
  5. You add regulars trades to a new area below long-/above short- primers when:

Re
D

Found a bug in trailing stoploss for long primers. Fixed in this version.

I do wonder though if TSL is such a good idea, maybe we should use stepwise SL instead, I mean keep SL of main #1 at +10 until main #3 opens, then move it to main #2 +10 as we used to do, instead of always moving it up at each tick. You’ll get more profits with TSL, but maybe more primers will survive without it and possibly reach TP instead.

Re
D

PS! I forgot to remove my lines from ManualChangesToVariables() on this upload, just comment them out or insert your own for wherever you want to run.

Blank9.zip (7.25 KB)

I’m seriously confused now. I ran a test where I got to 2.124,83 account balance, 1.000 longs and 14.000 shorts. According the EA and Excel sheet that means a drawdown of 0,061181 and a long primer should be opened, fair enough.

However, AccountEquity() is 1.664,78. Wouldn’t equity in percent of account balance then be (1.664,78/2.124,83)*100 = 78,35%, and aren’t we supposed to trigger primers at “40% equity left”???

Re
D

So, another eToro user asked this question to M today:

Snip/
Averager: @viking1961 Morning Captian! I need your help here, if you don’t mind. This is the link for my channel. etoro.tw/19ZDBrz
I am close to 0.06% per pip on sells. But I still have plenty of capital (80%). Should I start my primer ? As all newbies, I am nervous :slight_smile:

viking1961: @Averager Mornings my friend, if you still have plenty of cash, you should wait . With 80% capital it wouldn´t be necessary with primers for sure. You need to use primers then when you have 40% of your equity left …

/Snip

This means that our drawdown calculation (and the Excel sheet) is wrong. It is limited to balance and ignores equity. I did try to set up a function using only equity, but if you trigger primers from equity you’ll first get another hit due to spread, so new primers are added on the very next tick. I guess we could find some way around that, but I’d like to hear your guys reaction to this first.

Re
D

So, it is simple just crosscheck your calculations. It may be ignoring equity as he said or you might have chosen a wrong option or there might be some possible error.

It’s not exactly a question of cross checking the calculations. Both EAs use the calculations from the “Do you need primers yet” Excel sheet on Facebook, and that has to be wrong as it’s based on balance, not equity. So we need to rethink the drawdown function as it’s currently not doing what Mike is prescribing. I’ve never seen him write anything about balance on his wall. He always says “40% equity” and he invented the system so he should know what he’s talking about. A pretty fundamental flaw in our efforts so far…

Re
D

CC, please weigh in on this. I think the drawdown calculation should be

extern double DrawdownLimit = 40.0;

if((AccountEquity()/AccountBalance())*100 <= DrawdownLimit)
{
…
}

Re
D

After tormenting M for two weeks with questions, my conclusion for primers is this:

  1. When equity falls to 40% of account balance, Main primer is triggered with the trend.
    a. extern double DrawdownLimit = 40.0;
    if((AccountEquity()/AccountBalance())*100 <= DrawdownLimit) {…}
  2. Main primers are 3x currentLotSize.
  3. MainPrimerTakeProfit and MainPrimerDistance are calculated from retracements patterns.
  4. After 30 pips (FirstSecondaryPlacement) a Secondary primer is placed every 80 pips. TP is changeable from 100 upwards. Size is 2x currentLotSize.
  5. After 50 pips (FirstSubPlacement) Sub-primer is placed. TP and distance is 20. Size (SubPrimerSize) is 0.75x currentLotSize (rounded up).
  6. Main and Secondary primer SL is updated on opening of next same type primer (step-wise SL).
  7. Main primers that hit SL is immediately replaced by a new Main primer, but sized as a Secondary primer.
  8. On large retracements followed by trend continuation, closed Secondary and Sub-primers are replaced. Sub-primer size can be increased to turn equity.
  9. Closed Main primers (beyond the one of secondary size) is not replaced, only continued with further movement.

Does anyone have opinions?

Re
D

LOL did non of you guys realize VIKING1961 account is now total bust. If you trade this your in for a inevitable margin call. It may not be today or tomorrow but as Viking1961 found it is INEVITABLE!

you got no clue what your talking about, his account is not busted at all, fact is that he has recovered great after the losses from the AAA downgrade… so if you just want to troll, please go somewhere else