Forex



Go Back   Forex Trading > Training > Metatrader > Metatrader 4 mql 4 - Development course > Questions
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 07-01-2007, 09:45 AM
Member
 
Join Date: Feb 2007
Location: Seremban, Negeri Sembilan, Malaysia
Posts: 30
ahmad.ariffin is on a distinguished road
Couldn't find the answer myself. Fixing the Woodies CCI. Need Help!

Hi all,

I'm new to this MQL4 programming. I'm trying to build an indicator for Woodies CCI. I know there are many on them out there but they have something need to be fix. It's about the trend. For some people it maybe small but not for me. In Woodies CCI, trend play important role.

In Woodies, the trend is established when 6 bars (minimum) or more, printed on the same side. It's either above the zero line, or below the zero line.

Here is an example from Linuxser indicator, CCI_Woodies_Lnx_v4. This is an uptrend chart.



Bar 1 to 4 : No trend
Bar 5 : Warning that trend might change
Bar 6 and so on : Trend bar.

Okay, take a look at this chart. It is from USDCAD, 15M timeframe, 27 & 28 June 07'.



This chart is a downtrend chart. It should start at B (1,2,3,4,5,6. forget the 7) and not before it. Why? Because before B (1,2,3,4,5,6), the requirement for an established trend was not fulfilled. There are 4 gray bars, 1 yellow bar and that's it. There is no 6th bar. Now look at A. A shows an established trend where it meet the requirement. 4 gray bars, a yellow bar and continue by red bars. Take a look at C, we know that there is no trend as there is no 6th bar. So, A is wrong. A should not be a new establishment of a trend because C does not change the trend. It should be a trend continuation which mean, the bar will still be red after CCI line goes below zero line. This is the problem of the Woodies CCI indicator in MT4.

Now, this is the chart when I change the trend period to 6 as told by Linuxser



Look at C & A. It is now correct but look at B. Before B is now continuation of the previous trend - Uptrend. Then B is a new trend in establish. How ever, the trend is now established when the 7th bar is printed. B in this chart should be like A in the previous chart where trend is established on the 6th bar.

I'm trying to fix this but due to lack of experience and knowledge of MQL4, I'm unable to fix it.

Below is the CCI code.

Code:
int start() {

   int limit, i, trendCCI, entryCCI;
   int counted_bars = IndicatorCounted();
   static datetime prevtime = 0;
//---- check for possible errors
   if(counted_bars < 0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars > 0) counted_bars--;

   limit=Bars;//-counted_bars;
   
     SetIndexDrawBegin(0,Bars-CountBars);
     SetIndexDrawBegin(1,Bars-CountBars);
     SetIndexDrawBegin(2,Bars-CountBars);
     SetIndexDrawBegin(3,Bars-CountBars);
     SetIndexDrawBegin(4,Bars-CountBars);
     SetIndexDrawBegin(5,Bars-CountBars);
     SetIndexDrawBegin(6,Bars-CountBars);
     SetIndexDrawBegin(7,Bars-CountBars);
   

      trendCCI = TrendCCI_Period;
      entryCCI = EntryCCI_Period;
   
      IndicatorShortName("[CCI: " + trendCCI + "] [TCCI: " + entryCCI + "] [per LSMA: " + LSMAPeriod + "] [Trend: " + Trend_period + "] Values CCI|TCCI:");   
   
   for(i = limit; i >= 0; i--)
      {
         CCINoTrend[i] = 0;
         CCITrendDown[i] = 0;
         CCITimeBar[i] = 0;
         CCITrendUp[i] = 0;
         ZeroLine[i] = 0;
         TrendCCI[i] = iCCI(NULL, 0, trendCCI, PRICE_TYPICAL, i);
         EntryCCI[i] = iCCI(NULL, 0, entryCCI, PRICE_TYPICAL, i);
      
         if(TrendCCI[i] > 0 && TrendCCI[i+1] < 0)
            {
               if (trendDown >  Trend_period)
                  {
                     trendUp = 0;
                  }
            }
            
         if (TrendCCI[i] > 0)
            {
               if (trendUp <  Trend_period) //Print the grey bar
                  {
                     CCINoTrend[i] = TrendCCI[i];
                     trendUp++;
                  }
               if (trendUp ==  Trend_period) //Print the yellow bar
                  {
                     CCITimeBar[i] = TrendCCI[i];
                     trendUp++;
                  }
               if (trendUp >  Trend_period) //Print the blue bar
                  {
                     CCITrendUp[i] = TrendCCI[i];
                  }
            }
            
         if(TrendCCI[i] < 0 && TrendCCI[i+1] > 0)
            {
               if (trendUp >  Trend_period)
                  {
                  trendDown = 0;
                  }
            }
            
         if (TrendCCI[i] < 0)
            {
               if (trendDown <  Trend_period) //Print the gray bar
                  {
                     CCINoTrend[i] = TrendCCI[i];
                     trendDown++;
                  }
               if (trendDown ==  Trend_period) //Print the yellow bar
                  {
                     CCITimeBar[i] = TrendCCI[i];
                     trendDown++;
                  }
               if (trendDown >  Trend_period) //Print the red bar
                  {
                     CCITrendDown[i] = TrendCCI[i];
                  }
            }
         }
I think this code section is where I should change but my try have no luck

Code:
   for(i = limit; i >= 0; i--)
      {
         CCINoTrend[i] = 0;
         CCITrendDown[i] = 0;
         CCITimeBar[i] = 0;
         CCITrendUp[i] = 0;
         ZeroLine[i] = 0;
         TrendCCI[i] = iCCI(NULL, 0, trendCCI, PRICE_TYPICAL, i);
         EntryCCI[i] = iCCI(NULL, 0, entryCCI, PRICE_TYPICAL, i);
      
         if(TrendCCI[i] > 0 && TrendCCI[i+1] < 0)
            {
               if (trendDown >  Trend_period)
                  {
                     trendUp = 0;
                  }
            }
            
         if (TrendCCI[i] > 0)
            {
               if (trendUp <  Trend_period) //Print the grey bar
                  {
                     CCINoTrend[i] = TrendCCI[i];
                     trendUp++;
                  }
               if (trendUp ==  Trend_period) //Print the yellow bar
                  {
                     CCITimeBar[i] = TrendCCI[i];
                     trendUp++;
                  }
               if (trendUp >  Trend_period) //Print the blue bar
                  {
                     CCITrendUp[i] = TrendCCI[i];
                  }
            }
            
         if(TrendCCI[i] < 0 && TrendCCI[i+1] > 0)
            {
               if (trendUp >  Trend_period)
                  {
                  trendDown = 0;
                  }
            }
            
         if (TrendCCI[i] < 0)
            {
               if (trendDown <  Trend_period) //Print the gray bar
                  {
                     CCINoTrend[i] = TrendCCI[i];
                     trendDown++;
                  }
               if (trendDown ==  Trend_period) //Print the yellow bar
                  {
                     CCITimeBar[i] = TrendCCI[i];
                     trendDown++;
                  }
               if (trendDown >  Trend_period) //Print the red bar
                  {
                     CCITrendDown[i] = TrendCCI[i];
                  }
            }
         }
Hope someone can help me fixing this indicator.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 07-01-2007, 10:14 AM
mart-hart's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 452
mart-hart is on a distinguished road
Woodies system isn’t very good on 4X 15 mins.
A couple of years ago woodie had a 4X room and he tried 5 mins and then went up to 15 mins.

The problem was ZLR , most other trades worked ok especially trend line trades at or near the zero line.

Now imagine that your 50 cci has just crept past the 100+ line
14 cci has just bounced off zero and the 6 cci has been to 200- and has joined the 14 cci on its up move.
Personally I am not going to care if there are 4/5 or 6 bars, I would be going long.

Now I know that woodie does not use the 50 cci but consider this. 50 cci. mimics price reaction to the 34 ema, by far the most important ema on 15 mins IMHO.

The trade B that you have marked that you maybe would not have taken was also a reject of a trend line produced by a ghost pattern which is a non trend trade, so there is more than one way to skin a cat.

I hope that you take this in the spirt that it was meant as I have spent 3 years watching cci on 4X and it is a very different beast than the YM and other instruments that woodie trades.

Mart
Attached Images
File Type: gif ghost.gif (27.9 KB, 316 views)
__________________
----o00o--°(_)°--o00o----
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 07-01-2007, 10:42 AM
Member
 
Join Date: Feb 2007
Location: Seremban, Negeri Sembilan, Malaysia
Posts: 30
ahmad.ariffin is on a distinguished road
Quote:
Originally Posted by mart-hart View Post
Woodies system isn’t very good on 4X 15 mins.
A couple of years ago woodie had a 4X room and he tried 5 mins and then went up to 15 mins.

The problem was ZLR , most other trades worked ok especially trend line trades at or near the zero line.

Now imagine that your 50 cci has just crept past the 100+ line
14 cci has just bounced off zero and the 6 cci has been to 200- and has joined the 14 cci on its up move.
Personally I am not going to care if there are 4/5 or 6 bars, I would be going long.

Now I know that woodie does not use the 50 cci but consider this. 50 cci. mimics price reaction to the 34 ema, by far the most important ema on 15 mins IMHO.

The trade B that you have marked that you maybe would not have taken was also a reject of a trend line produced by a ghost pattern which is a non trend trade, so there is more than one way to skin a cat.

I hope that you take this in the spirt that it was meant as I have spent 3 years watching cci on 4X and it is a very different beast than the YM and other instruments that woodie trades.

Mart
Thanks for your opinion but this matter does not only happen in 15M chart. It also happen to 5M chart, 1M chart and that is why I try to solve it. I know you are an experience trader but I'm new person. I'm learning Woodies CCI and it's my only trade system now. Maybe because I am new, I alert such small thing.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #4 (permalink)  
Old 07-01-2007, 11:21 AM
mart-hart's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 452
mart-hart is on a distinguished road
O.K, Good luck and enjoy your journey



Mart
__________________
----o00o--°(_)°--o00o----
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #5 (permalink)  
Old 07-01-2007, 03:07 PM
Member
 
Join Date: Feb 2007
Location: Seremban, Negeri Sembilan, Malaysia
Posts: 30
ahmad.ariffin is on a distinguished road
Quote:
Originally Posted by mart-hart View Post
O.K, Good luck and enjoy your journey

Mart
Thanks Mart.

So, how about the indicator? Can someone help me?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks

Tags
Trendcci


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Woodies Cci Indicators fxhst329 Indicators - Metatrader 4 29 12-27-2007 11:08 PM
Can anyone answer this question? Kaper Expert Advisors - Metatrader 4 4 02-14-2007 06:19 PM
Fixing REIMT4 Ind. spiketrader Indicators - Metatrader 4 0 12-13-2006 05:24 AM
Need help fixing this small EA SteveBrown Metatrader 4 mql 4 - Development course 4 12-07-2006 11:11 PM
help fixing EA hexadecimal General Discussion 1 11-03-2006 04:00 PM


All times are GMT. The time now is 04:51 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.