Forex Factory
  • Login

  • Username: Password:
  • 7:39pm

  • Search
  • Home

  • Forums

  • Trades

  • Calendar

  • News

  • Market

  • Brokers

Options

Search
Search
Search

Subscribe to Thread

Bookmark Thread

First Page First Unread Last Page Last Post

Printable Version

Similar Threads

Inside Bar Trading 1924 replies

Inside bar or outside bar identifier 4 replies

Aggressive inside bar trading 4 replies

Journal related to: Advanced Inside Bar (IB) Trading 19 replies

  • Trading Systems
  • /
  • Reply to Thread
  • 338

Inside Bar Trading Revisited

  • Last Post
  • First Unread
  •  
  • Page 1 23456 44
  •  
  • Post# 1
  • Quote
  • First Post: Jan 11, 2009 4:59am | Edited Apr 19, 2009 2:58am – EA Updated 2009/04/19 07:58
  • 1ka
    Joined Nov 2008 | 359 Posts | Status: Guest
There's an interesting technique being used in the thread here that describes a system for trading using Inside Bars on the 30M charts.

(Hmm, that thread just got deleted and all that good stuff is now in the bin. Shame on Forex Factory).

The owner of the thread would like to keep it 'pure', so this thread is a companion thread that takes the pure system and suggests improvements or alternative ways of working. Hopefully we can come up with a new system that enhances the current one.

Everyone is welcome to discuss the IB technique. In particular, it would be interesting to hear what works, and doesn't work, for you.

Ultimately, my personal goal is to create an EA that can work based upon the IB technique.

====


Attached is the latest EA. I'll always place it in the first post from now on.

These are the properties in the EA and the defaults.

// The Magic Number used to identify our trades.
extern int magicNumber = 20081224091300;

// Print the programs debug comments.
extern bool Debug_Mode = false;

// The lot size used in each trade. MUST be a multiple of TWO.
extern double LotSize =0.02;

// ATR Period, 40 might be good on EURUSD
extern int ATRPeriod = 20;

// The maximum number of bars that we will look back to find a recent IB. Includes the two bars forming the IB.
extern int MaxBars = 6;

// ** The maximum size of Outer/Containing IB bar. Keep it high, works better.
extern int MaxIBSize = 6000;

// ** The minimum size of Outer/Containing IB bar.
extern int MinIBSize = 100;

// ** The maximum deviation allowed when we open an order. This avoids opening a trade when price jumps between ticks.
extern int MaxStart = 40;

// The TP profit factor. If this is 2, then the TP will be doubled, etc. Higher this is the more losers you'll get.
extern int TPFactor = 1;

// The minimum volume required for us to trade. Doesn't seem to affect trade win ratio
extern int MinVolume = 6;

// ** The number of PIPs that our InsideBars are offset from trigger IB.
extern int BarOffset = 30;

// True if we want to only trade long when above daily pivot and short below it.
extern bool UsePivotIndicator = false;

// Do we want to follow trends or just fixed TP.
extern bool TrailTrends = true;

// What factor of ATR we want to trail trends with
extern double TrailATRFactor = 0.5;

// ** The minimum value that the ATR should return; Determines min TP.
extern int MinATR = 10;

// Do we want to use the external indicator
extern bool UseExternalInd = false;

// Stick anything in here and it will be passed to the external indicator.
extern string ExtIndParams = "Params for external indicator";

// True if we want to use the Inner Bar for breakout, rather than the traditional Outer Bar
extern bool UseIBForBreakout = false;

// True if we want to ignore the first IB breakout and only take the subsequent ones.
extern bool IgnoreFirstIBBreak = false;


// Trail the SL with price changes before the first TP has happened.
extern bool UseTrailingSL = true;

// True if we want to use Stochiastic measure
extern bool UseStoch = false;

// The value of the Stochastic offset (used to determine the upper SELL and lower BUY bands)
extern int StochOffset = 20;

// Trading Hours by day - See attached spreadsheet for calculation of this.
// Uses the BAR time.
extern int TradingHoursSunday = 16777215;
extern int TradingHoursMonday = 16777215;
extern int TradingHoursTuesday = 16777215;
extern int TradingHoursWednesday = 16777215;
extern int TradingHoursThursday = 16777215;
extern int TradingHoursFriday = 16777215;
extern int TradingHoursSaturday = 16777215;


Anything with ** in the comments needs to be adjusted for brokers that use 4 digits and not 5. (Divide by 10 for 4 digit brokers)

====

There is a generic interface that allows you to write your own code that will help the EA decide whether a trade is valid or not.

To get started:
  1. Put the attached IBTrader EA in the experts directory of your MetaTrader installation.
  2. Put both IBTrader-Ind files in the experts\libraries directory of your MetaTrader installation.
  3. Restart MetaTrader and you're off.
To create your own indicators you will need to edit the IBTrader-Ind.mq4 file and add your own logic. An example RSI indicator is included. If your indicator needs parameters then you can pass them into the indicator through the EA string property ExtIndParams. You will, of course, need to parse the string if you have multiple parameters.

Make sure that the EA property UseExternalInd is set to true otherwise your new routine will not be called.
Attached Files
File Type: ex4 IBTrader-Ind.ex4   2 KB | 1,610 download | Uploaded Jan 20, 2009 2:43pm
File Type: mq4 IBTrader-Ind.mq4   3 KB | 1,955 download | Uploaded Jan 20, 2009 2:43pm
File Type: xls CalcIBTraderHours.xls   8 KB | 1,235 download | Uploaded Mar 8, 2009 3:43pm
File Type: txt IBTrader-Changes.txt   2 KB | 933 downloads | Uploaded Apr 19, 2009 2:58am
File Type: ex4 IBTrader.ex4   19 KB | 1,138 download | Uploaded Apr 19, 2009 2:58am
  • Post# 2
  • Quote
  • Jan 11, 2009 5:22am | Edited at 6:01am
  • 1ka
    Joined Nov 2008 | 359 Posts | Status: Guest
So what are Inside Bars? Simply put it's where a bar on the chart closes with a lower high and a higher low than the previous bar.

But what is it really? It's a point of consolidation. The current trend has stopped and there's a moment of indecision as the currency fluctuates between a previous high and low.

So what causes it? Anything and everything. All we know for sure is that the current trend has paused. It could have hit a point of support or resistance where there is enough buying or selling pressure to stop it going further. It could be that there is an overbought or oversold condition. It could be there's a news release imminent and the market is waiting, etc., etc.

What happens next? Ideally, a new trend starts that breaks the bounds of the Inside Bar and goes on for a few hundred pips.

What does the system do? Using an indicator, the system will show where Inside Bars form. If you follow the pure Inside Bar trading technique you will identify which trend you want to follow (Bullish or Bearish) and set up a trade when it goes 'your' way. The pure Inside Bar technique has a number of questions to ask to help you choose which trend you should follow.

Anything similar to the Inside Bar trading technique? Yes there is. The trend follower system also attempts to pick up on points of consolidation. See http://www.forexfactory.com/showpost...54&postcount=1 I suspect that most trending systems all rely on their indicators to determine when a new trend is forming after consolidation.

Is it new? No, it's an old technique for following price action.

Does it work? Yes it does, but it can fail. Following the pure IB technique is supposed to improve your chances of picking winning trends.
  • Post# 3
  • Quote
  • Jan 11, 2009 5:49am | Edited at 9:29am
  • 1ka
    Joined Nov 2008 | 359 Posts | Status: Guest
The pure IB trading technique uses what is called the Trend of the Moment (TOM) to help determine which way you should trade. The idea is that you trade with the TOM.

But what is the TOM? Good question, personally I'm not sure and this is very subjective. Within the pure IB system I understand the TOM to be the most recent major trend on the 30M chart.

If you look at other chart timescales, then the TOM may well be different, in fact the pure IB technique suggests that you also look at a larger timeframe to determine the major trend and, if you're unsure, only trade if the TOM and major trend point the same way. (So for the pure IB technique you can probably ignore TOM and safely trade the major trend?)

This sounds great in theory. We have some rules to help us trade. However, in practice it's not quite as simple. If we are trading with the TOM, then it's likely that the TOM has already moved a few hundred pips. So how much room is left in this movement? We don't know. What we can do is look at other indicators or techniques to help. One possible one is Elliot Wave theory. If we find the IB has formed as Stage 2 of an EW, then we can assume that following the TOM will be EW Stage 3, which is a good stage to follow. If we're in an IB at EW Stage 4, then prepare for a trend reversal if you go with TOM.

When writing an EA, TOM is not that easy to do, so a different indicator is needed.
  • Post# 4
  • Quote
  • Jan 11, 2009 6:11am | Edited at 7:20am
  • 1ka
    Joined Nov 2008 | 359 Posts | Status: Guest
The pure IB technique warns you against trading before news or a session opening. In fact, these are good warnings for any system.

Why? Well, during these times, the market can behave 'irrationally'. By that I mean it seems to go against current trends and defy all your indicators!

How does the pure IB system help us identify news or session opens? It doesn't, and anyone who suggests an improvement to use an indicator is flamed for it (hence this thread).

If you have any good news and session time indicators in use, then please mention them here.

I've used the indicator from here http://www.forex-tsd.com/news-signal...tml#post215104 This works well enough and has session open and dynamic news on the chart - exactly what you want. However, for me, it seems to cause MetaTrader to hang every now and again, so I'm looking for something simpler.

As far as the plan to use an EA, then I can code in session open times easily enough, but news is more awkward and would need to use use the same technique as this indicator. The indicator reads this sites forex news page and displays the results.
  • Post# 5
  • Quote
  • Jan 11, 2009 6:20am
  • 1ka
    Joined Nov 2008 | 359 Posts | Status: Guest
The pure IB technique trades on a 30 minute chart (with some unspecified plan to move onto hourly charts).

Why 30M? The idea is that a 30M chart shows Inside Bars that have a manageable price distance between their bounds. For the financially challenged (and I'm one of them) running IB on a daily chart is potentially too risky as the distance between the IB's forms your SL. Obviously, the greater the chart timescale, the greater the potential price distance between the upper and lower IB bounds.

Another factor to think about is that as you trade on shorter timescales, the trends are less clear, they become more susceptible to individual market movements. However, shorter timescales increase the number of IB's forming, so you have more choice and can pick and choose which ones to trade with.

If you use IB's on different timescales, then let us know how you are getting on.
  • Post# 6
  • Quote
  • Jan 11, 2009 6:36am | Edited at 11:16am
  • 1ka
    Joined Nov 2008 | 359 Posts | Status: Guest
The pure Inside Bar technique suggests that you avoid trading near the Daily Pivot Point. The DPP is a value that indicates the days average price. I'm not sure how it's calculated, but I'm guessing it's based around yesterday's average price (since today has not yet happened :-)

Humorously, the pure IB technique does not, at the time of writing, include this indicator as part of it's list of downloadable indicators on the first page of the thread. You can pick it up from later on in the thread, though, and it may be that it is included as a default indicator in MetaTrader (not in my version).

So why avoid the DPP? The DPP, as with the Support and Resistance levels that are also shown in the indicator, form a transitional barrier. Trends can stop at these barriers and reverse, they can also blast straight through them. By avoiding following a trend that starts close to a level you avoid the risk that it will immediately reverse.

However, levels are broken all the time, you need to look not just at the level, but what the price range is between them. If the previous days action was low with little price movement, then the levels will be closer together the next day. It may well be that these levels will be broken on a new day.

Levels are also a good place to take profit in anticipation of a bounce back. The pure IB method does suggest this.

So, this is another indicator that, in itself, cannot be used in an EA. The EA needs a little more to go on. Any suggestions?

As an aside, why do the support and resistance levels actually stop a trend? My theory is that since these are common indicators and everyone uses them as TP or SL they affect the price action in and of themselves. Self-fulfilling, in other words.
  • Post# 7
  • Quote
  • Jan 11, 2009 7:26am | Edited at 9:33am
  • 1ka
    Joined Nov 2008 | 359 Posts | Status: Guest
The pure IB system opens a trade when the price breaks the upper or lower bounds.

Within the forum, a number of people, including the thread owner, will open two trades at this point. They will close the first based upon the ATR or at a Support level.

I'm not sure what the benefit of running two trades is, but perhaps it is a limitation of their trading platform?

If you use MetaTrader, then you can close a trade and specify how much of the trade you want to close by altering the lot size before you hit the close button.

So, rather than running two trades, and risk missing a few pips between opening the first and second trades, open one trade with the total lot size of both trades.
  • Post# 8
  • Quote
  • Jan 11, 2009 7:37am
  • 1ka
    Joined Nov 2008 | 359 Posts | Status: Guest
When an IB forms, you can follow the pure IB technique and determine which trend you want to follow (Bearish or Bullish). If you have confidence in the pure trading technique, then at this point you could set up a Buy Stop or a Sell Stop (or both, if you are willing to follow a trend either way).

Buy and Sell stops are pending trades. They are triggered on the brokers server when the prices hits the stops price. This means that you can leave your PC and don't need to watch the chart to see when the price breaks.

One potential downside of pending trades is that you are not watching the current price action, so may miss something that would cause you not to place a trade.

You can also place a time limit on the pending trade, so that if it's not triggered within, say, four bars (2 hours on a 30M chart) then the pending trade is cancelled.

So if your trade is triggered and you're not watching the chart, how do you know when it's reached your TP point? What you can do is set a Trailing Stop to be the same as the TP-entry point. When the TS is hit, MetaTrader can be configured to 'bleep' so you get an indication that you've hit your TP and can take half the profit.

If you are running two trades then you probably don't need this, though the second trade should still have the trailing stop defined.
  • Post# 9
  • Quote
  • Jan 11, 2009 11:01am
  • 1ka
    Joined Nov 2008 | 359 Posts | Status: Guest
OK, so what is the raw trading potential of this system?

By raw, I mean ignoring the pure IB questions, what happens if we take every trade as it breaks the IB.

Well, here are some results that I have backtested for the month of December, probably one of the toughest months for any system.

EURUSD 122 trades, 86 winners (70%)
USDJPY 122 trades, 76 winners (62%)
EURGBP 104 trades, 62 winners (60%)

Brilliant, how can we lose! Well, lose we did. Following the pure IB rules, our TP is the current ATR value. As a quick setup the second TP was 2*ATR. In many cases, the ATR is far lower than our SL, so the Risk Reward ratio is, say 2:1, i.e. we risk 2 lots for every 1 lot gained.

Still, an EA does show some potential.

So what's next for this EA?
  1. Look at the best values for TP. I think the ATR may be too conservative, I'll look at setting it to the same as the SL.
  2. Enable it to trail the trend. Our second TP is fixed at 2*ATR, it would be nice if we could trail an ongoing trend. Whilst this is relatively easy to code, what should the trail value be? We want to avoid any minor price action that takes out out trailing stop before the trend is complete. Again I'm thinking it should be the same as the SL.
  3. Look at implementing some of the pure IB rules (questions). This may help reduce our losing trades.
If you have any ideas on these points, then let me know.

===
Attached is the compiled EA, it's a work in progress but you can run some tests with it. DON'T run it in a live environment! Use at your own risk, etc.
Attached File
File Type: ex4 IBTrader.ex4   9 KB | 946 downloads
  • Post# 10
  • Quote
  • Jan 11, 2009 11:11am
  • thinkpip
    Joined Dec 2007 | 9 Posts | Status: Member
Thanks for taking the time to put this together - hope to see you in the room on Monday. I'll be there from an hour before London open.
  • Post# 11
  • Quote
  • Jan 11, 2009 11:17am
  • 1ka
    Joined Nov 2008 | 359 Posts | Status: Guest
Quoting thinkpip
Thanks for taking the time to put this together - hope to see you in the room on Monday. I'll be there from an hour before London open.
All are welcome in this room, it can be found here -> http://embed.mibbit.com/?channel=%23insidebars
  • Post# 12
  • Quote
  • Jan 12, 2009 2:04am
  • 1ka
    Joined Nov 2008 | 359 Posts | Status: Guest
Trading when there is low volume can be tricky.

Why? When there is low volume, individual market moves can have a greater effect.

What do we class as low volume? Hmm, another subjective question. Let's take a step back.

Volume should be the measure of the total amount of currency in any price movement. This should give an indication of the weight or pressure behind any movement. If there is large volume, then a movement looks strong.

However, in the currency markets volume is not tracked like the stock markets. Volume is actually a measure of how many times the price changes within a certain period, i.e. the count of ticks. So large volume means that the price is changing continually, but doesn't actually indicate the currency amounts behind the change.

So, can we still use it? Yes, but it's not as good an indicator as it could be. For me, I'm wary of trading in low volumes, but don't discount it.

What do we class as low volume? Ahh, back here again. For me, low volume is anything below 600 ticks/30 minutes. That's 20 price changes a minute. Note that this is different for each currency pair. Look back over the price history and set a figure that suits that currency. Obviously, during holiday periods the volumes will be lower.

Why this figure? Two reasons, firstly, when the market is open and moving they generally are well above this figure and secondly, anything below this figure seems very slow when watching trades to scalp a few pips.

It's easy to add a volume indicator to your chart. The pure IB method does not use a volume indicator, but the forum generally suggests not to trade in low volumes. So stick it on your chart and set a line at the 20 ticks a minute mark (or a value that suits you).
  • Post# 13
  • Quote
  • Jan 12, 2009 9:44am
  • 1ka
    Joined Nov 2008 | 359 Posts | Status: Guest
The pure IB technique uses the ATR indicator as a Take Profit guide.

Specifically, the pure IB technique suggests pulling half your profit at the ATR point and the remainder at 2xATR. It also suggests using Support and Resistance levels, but lets concentrate on ATR.

So what is ATR? ATR is the Average True Range. The True Range is an attempt to determine actual bar heights (High-Low) by taking into account Gaps. A Gap is where the closing price of the previous bar is above (below) the High (Low) of the next bar. The ATR is calculated by averaging the True Range over a number of bars.

Why is it used? A good question that has not been answered in the pure IB forum.

What averaging period is used? The pure IB method uses a 20 bar averaging period (10 hours on the 30M chart).

Why 20? Good question, I don't know. Presumably someone ran a few tests and found 20 a good figure. I'm not sure if it should be the same value across all currencies...
  • Post# 14
  • Quote
  • Jan 12, 2009 9:57am
  • ranger
    Joined Sep 2008 | 114 Posts | Status: Member
Hey 1KA,

Yeah the crew at inside bar previous thread tattled on me as well Where are you at, I am in the US.
  • Post# 15
  • Quote
  • Jan 12, 2009 10:08am
  • billbss
    Joined Apr 2006 | 3,442 Posts | Status: Member
Quoting 1ka
OK, so what is the raw trading potential of this system?

By raw, I mean ignoring the pure IB questions, what happens if we take every trade as it breaks the IB.

Well, here are some results that I have backtested for the month of December, probably one of the toughest months for any system.

EURUSD 122 trades, 86 winners (70%)
USDJPY 122 trades, 76 winners (62%)
EURGBP 104 trades, 62 winners (60%)

Brilliant, how can we lose!...

I don't know if you're looking for input, but if you are, here's my 2 cents.

I think you're wasting your time on IBs.
I've seen a couple of computer runs on candle formations, and they both indicated that the IB had no predictive properties.
These were done on futures and not forex. There may be a difference, but I doubt it.

The results you show tend to back this up.

On a random coin toss entry, with a SL twice the size of a TP, you will get about 67% wins. That appears to be what you got.

You'll lose money because of the overhead of the spread.
  • Post# 16
  • Quote
  • Jan 12, 2009 10:16am
  • ranger
    Joined Sep 2008 | 114 Posts | Status: Member
Here think pip, the IB on the euro from about 2 hours ago or so
Attached File
File Type: zip euro.zip   32 KB | 405 downloads
  • Post# 17
  • Quote
  • Jan 12, 2009 10:17am | Edited at 11:57am
  • 1ka
    Joined Nov 2008 | 359 Posts | Status: Guest
One of the hardest things to do when trading, with or without an EA, is to determine where TP should be. As discussed previously, the pure IB method uses ATR and Support/Resistance levels.

But how good is ATR when used with an EA? To find out I ran a few tests with different multiples of ATR and, as a comparison, using the SL value (i.e. the size of the IB).

ATRx1/2 EURUSD 145 Trades, 126 Wins (87%), £119
ATR EURUSD 102 Trades, 71 Wins (70%), -£ 21
SL EURUSD 109 Trades, 84 Wins (77%), £ 49

So, ATR looks good on EURUSD, but isn't as good as a SL value. ATRx1/2 is better over this range when nothing else is considered.

Note that the results using 'ATR' follow the the pure IB method (i.e. take 1/2 profit at ATR and 1/2 at ATRx2). The ATRx1/2 halves these values (i.e. take 1/2 profit at 1/2 ATR and 1/2 at ATR).
  • Post# 18
  • Quote
  • Jan 12, 2009 11:30am
  • WedWed
    Joined Aug 2008 | 1,078 Posts | Status: Member
Quoting 1ka
Trading when there is low volume can be tricky.

Why? When there is low volume, individual market moves can have a greater effect.

What do we class as low volume? Hmm, another subjective question. Let's take a step back.

Volume should be the measure of the total amount of currency in any price movement. This should give an indication of the weight or pressure behind any movement. If there is large volume, then a movement looks strong.

However, in the currency markets volume is not tracked like the stock markets. Volume is actually a measure...
Thanx Sir for sharing your affort and give clear explanation for hole thing
i like your way of explenation.. u mast be Teacher or so

one thing i want to know and if u dont mind to explain it to me with Picture WHAT U MEAN BY low volume is anything below 600 ticks/30 minutes. That's 20 price changes a minute.

thanx too much
Never sell @ lower upward channel unless breacked and vise versa .
  • Post# 19
  • Quote
  • Jan 12, 2009 11:54am
  • 1ka
    Joined Nov 2008 | 359 Posts | Status: Guest
Quoting WedWed
Thanx Sir for sharing your affort and give clear explanation for hole thing
i like your way of explenation.. u mast be Teacher or so

one thing i want to know and if u dont mind to explain it to me with Picture WHAT U MEAN BY low volume is anything below 600 ticks/30 minutes. That's 20 price changes a minute.

thanx too much

Attached is a picture of the volume indicator. You can see a line at the 600 mark. Anything below this could be considered low volume, anything above is high. In this chart, from todays EURUSD 30M, there is a clear distinction between low volume and high volume. Perhaps the low range should be adjusted higher for this currency to, say, 800.
Attached Image (click to enlarge)
Click to Enlarge

Name: Picture 1.png
Size: 10 KB
  • Post# 20
  • Quote
  • Jan 12, 2009 11:58am
  • WedWed
    Joined Aug 2008 | 1,078 Posts | Status: Member
Thanx 1Ka for quick answer.
Never sell @ lower upward channel unless breacked and vise versa .
Thread Tools Search this Thread
Show Printable Version Show Printable Version
Email This Thread Email This Thread
Search this Thread:

Advanced Search

  • Trading Systems
  • /
  • Inside Bar Trading Revisited
  • Reply to Thread
    • Page 1 23456 44
0 traders viewing now
  • More

©2013 Forex Factory, Inc. / Terms of Use / Privacy Policy

Forex Factory® is a registered trademark.

Connect

  • Facebook
  • Twitter
  • RSS

Company

  • About FF
  • FF Blog
  • Careers at FF
  • Advertising
  • Contact FF

Products

  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer

Website

  • Homepage
  • Search
  • User Guide
  • Member List
  • Online Now
  • Report a Bug