Forex Factory
  • Home
  • Forums
  • News
  • Market
  • Login
  • User/Email: Password:
  • 5:53am
  • Search
Menu
  • Forums
  • News
  • Market
  • Login
  • 5:53am
Search

Options

Search

Bookmark Thread

First Page First Unread Last Page Last Post

Printable Version

You are viewing
the Crypto Craft
beta version.

Your participation
is appreciated!

Similar Threads

Time Frame Vs Personality, Which to choose as Main Time Frame? Who Are You? 10 replies

Multi Time Frame Bollinger Bands 0 replies

Time frame and Enter/Exit, Time frame and S/L, T/P relationships. 91 replies

Question on Lower Time Frame Indicators Vs. Longer Time Frame 7 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe

Coding help in multi-time frame bollinger band

  • Post #1
  • Quote
  • First Post: Edited at 10:26pm Jul 29, 2018 10:06pm | Edited at 10:26pm
  •  bm0899
  • | Joined Mar 2016 | Status: Member | 14 Posts
Hi,

I am trying to code a multi time frame bollinger band. The code below compiles successfully (part of an EA). However during EA running the M30's code section does not get looked at (higher time frame's code does no work as intended). Can you please have a look at the code below if code is written correctly for the intended job.

Intended Job:
Buy - once the lower Bollinger Band has pierced in both CURRENT and M30 time frames.
Sell - once the upper Bollinger Band has pierced in both CURRENT and M30 time frames.

// Input variables for Bollinger Band Indicator
extern ENUM_TIMEFRAMES bb_lower_TF = PERIOD_CURRENT;
extern int BBPeriod = 20;
extern double BBDeviation = 2.0;
extern ENUM_APPLIED_PRICE BBApplied = PRICE_CLOSE;
extern ENUM_TIMEFRAMES higher_TF = PERIOD_M30;

// Bollinger Band Indicator for both current time frame and 30 minute time frame
double bbup1 = iBands(NULL, bb_lower_TF, BBPeriod, BBDeviation, 0, BBApplied, MODE_UPPER, 0);
double bbdn1 = iBands(NULL, bb_lower_TF, BBPeriod, BBDeviation, 0, BBApplied, MODE_LOWER, 0);
double bbup2 = iBands(NULL, higher_TF, BBPeriod, BBDeviation, 0, BBApplied, MODE_UPPER, 0);
double bbdn2 = iBands(NULL, higher_TF, BBPeriod, BBDeviation, 0, BBApplied, MODE_LOWER, 0);

// Sell - once the upper BB is pierced in both CURRENT and H4 time frames.
if (type==OP_BUY && ((NormalizeDouble(Bid, _Digits)>NormalizeDouble(bbdn1, _Digits)) && (NormalizeDouble(Bid, _Digits)>NormalizeDouble(bbdn2, _Digits)))) return (false);

//Buy - once the lower BB is pierced in both CURRENT and H4 time frames.
if (type==OP_SELL && ((NormalizeDouble(Bid, _Digits)<NormalizeDouble(bbup1, _Digits)) && (NormalizeDouble(Bid, _Digits)<NormalizeDouble(bbup2, _Digits)))) return (false);

Any help would be appreciated. Thank you.
Thread Tools Search this Thread
Show Printable Version Show Printable Version
Email This Thread Email This Thread
Search this Thread:

Advanced Search

  • Platform Tech
  • /
  • Coding help in multi-time frame bollinger band
  • Reply to Thread
0 traders viewing now
Top of Page

You are viewing
the Crypto Craft
beta version.

Your participation
is appreciated!

You are viewing
the Crypto Craft
beta version.

Your participation
is appreciated!

  • Facebook
  • Twitter
CC Website
  • Homepage
  • Search
  • Members
  • User Guide
  • Report a Bug
CC Products
  • Forums
  • News
  • Market
About CC
  • Mission
  • Products
  • Blog
  • Contact
Follow CC
  • Facebook
  • Twitter

Other Markets:

  • Forex Factory
  • Energy EXCH
  • Metals Mine

Crypto Craft™ is a brand of Fair Economy, Inc.

Terms of Service / ©2019