Forex



Go Back   Forex Trading > Downloads > Indicators - Metatrader 4
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 03-16-2006, 02:30 PM
Member
 
Join Date: Nov 2005
Posts: 53
donb01 is on a distinguished road
Dynamic trend can someone clean this up?

I found this elsewhere and it has some errors when compiling,
can someone look at it and posibly clean it up
thanks

// +------------------------------------------------------------------+
// | The percentage indicator basis on break |
// | of the dynamic price channel |
// | BDPC_Percent.mq4 |
// | Copyright © 2004, OfficeFX Group |
// | http: // officefx.nm.ru |
// +------------------------------------------------------------------+
#property copyright " Copyright © 2004, OfficeFX Group "
#property link " http:// officefx.nm.ru "

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Yellow // BUY signal
#property indicator_color2 Blue // BUY signal
#property indicator_color3 Red // SELL signal
//----Indicator Buffers--------------------------------------------+
double DynamicLineTrend []; // Data buffer for dynamic line trend
double BUYSignals []; // Data buffer for BUY signals

double SELLSignals []; // Data buffer for SELL signals //----User defines-------------------------------------------------
+ extern int Percent=15; // Percent dynamic channel extern int MaxPeriod=50;
// Maximal period for calculate trend
//----Variables----------------------------------------------------+
int Sshift=0;
// Current bar for calculate trend //
+------------------------------------------------------------------+
// | Custom indicator initialization function | // +
------------------------------------------------------------------+ int init () {
//----Indicators---------------------------------------------------+
SetIndexStyle (0, DRAW_LINE); SetIndexBuffer (0, DynamicLineTrend);
SetIndexStyle
(1, DRAW_ARROW); SetIndexArrow (1,233); SetIndexBuffer (1, BUYSignals);
SetIndexStyle
(2, DRAW_ARROW); SetIndexArrow (2,234); SetIndexBuffer (2, SELLSignals)
; //-
-----------------------------------------
-------------------------+
return (0);}
// +------------------------------------------------------------------+
// | Custom indicator iteration function |
// +------------------------------------------------------------------+
int start ()
{ // Get digits of Symbol
double Point=MarketInfo (Symbol (), MODE_POINT);
// Set count bars for calculate trend int Counted_Bars=IndicatorCounted ()-MaxPeriod;
//----Calculation DynamicLineTrend---------------------------------+
for ( Shift = Counted_Bars; Shift> =0; Shift-) {
// Calculate of maximal period
if (Close [Shift] <DynamicLineTrend [Shift+1]) {

// Calculate Upper trend DynamicLineTrend [Shift] =Close [Highest (NULL, 0, MOD
E_CLOSE, MaxPeriod, Shift+1)]-Percent*Point;}; if (Close [Shift]> =DynamicLineTren
d [Shift+1]) {
// Calculate Down trend Dynamic
LineTrend [Shift] =Clo
se [Lowest (NULL, 0, MODE_
CLOSE, MaxPeriod, Shift+1)] +Percent*Point;};
// Check
crosses DynamicLineTrend and Price if (Close [Shift+3]> DynamicLineTrend [Shift+2]) if (Close [Shift+2] <
DynamicLineTrend [Shift+3]) BUYSignals [Shift] =Low [Shift]-10*Point;
else BUYSignals [Shift] =0; else BUYSignals [Shift] =0;
if (Close [Shift+2] <DynamicLineTrend [Shift+1])
if (Close [Shift+2]> DynamicLineTrend [Shift+3]) SELLSignals [Shift
] =High [Shift]-10*Point; else SELLSignals [Shift] =0; else SELLSignals [Shift] =0;};
//-------------------------------------------------------------------+
return (0);} // ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++
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 03-27-2006, 09:26 AM
MFX's Avatar
MFX MFX is offline
Member
 
Join Date: Oct 2005
Posts: 92
MFX is on a distinguished road
Code:
// +------------------------------------------------------------------+ 
// | The percentage indicator basis on break                          | 
// | of the dynamic price channel                                     | 
// | BDPC_Percent.mq4                                                 | 
// | Copyright © 2004, OfficeFX Group                                 | 
// | http: // officefx.nm.ru                                          | 
// +------------------------------------------------------------------+ 
#property copyright " Copyright © 2004, OfficeFX Group " 
#property link " http:// officefx.nm.ru " 

#property indicator_chart_window 
#property indicator_buffers 3 
#property indicator_color1 MediumOrchid // BUY signal 
#property indicator_color2 Blue // BUY signal 
#property indicator_color3 Red // SELL signal 
//----Indicator Buffers--------------------------------------------+ 
double DynamicLineTrend []; // Data buffer for dynamic line trend 
double BUYSignals []; // Data buffer for BUY signals 

double SELLSignals []; // Data buffer for SELL signals //----User defines-------------------------------------------------
extern int Percent=1; // Percent dynamic channel  15  Main Trend 10
extern int MaxPeriod=14; // 12 FOR H1 Maximal period for calculate trend 50 Main Trend 89
 //----Variables----------------------------------------------------+ 
 int Shift=0;  // Current bar for calculate trend // 
//+------------------------------------------------------------------+ 
//| Custom indicator initialization function                        |
//+------------------------------------------------------------------+
 int init ()
 {
SetIndexStyle (0, DRAW_LINE);
SetIndexBuffer(0, DynamicLineTrend); 

SetIndexStyle (1, DRAW_ARROW);
SetIndexArrow (1,233);
SetIndexBuffer(1, BUYSignals); 
 
SetIndexStyle (2, DRAW_ARROW);
SetIndexArrow (2,234);
SetIndexBuffer(2, SELLSignals);
 return (0);
 } 
//-------------------------------------------------------------------+

// +------------------------------------------------------------------+ 
// | Custom indicator iteration function                              |
// +------------------------------------------------------------------+ 
 int start () 
 {  
// Get digits of Symbol 
 double point=MarketInfo (Symbol (), MODE_POINT); 
// Set count bars for calculate trend
 int Counted_Bars=IndicatorCounted ()-MaxPeriod; 
//----Calculation DynamicLineTrend---------------------------------+
   for ( Shift = Counted_Bars; Shift>=0; Shift--)
  {
// Calculate of maximal period 
      if (Close [Shift] <DynamicLineTrend [Shift+1])
         {
            // Calculate Upper trend
            DynamicLineTrend [Shift] =Close [Highest (NULL, 0, MODE_CLOSE, MaxPeriod, Shift+1)]-Percent*point;
         }
    
      if (Close [Shift]>=DynamicLineTrend [Shift+1])
         {
            // Calculate Down trend
               DynamicLineTrend [Shift] =Close [Lowest (NULL, 0, MODE_CLOSE, MaxPeriod, Shift+1)] +Percent*point;
         } 

// Checkcrosses DynamicLineTrend and Price
      if (Close [Shift+3]> DynamicLineTrend [Shift+2])              
      if (Close [Shift+2] <DynamicLineTrend [Shift+3])
             BUYSignals [Shift] =Low [Shift]-10*point;
         else
             BUYSignals [Shift] =0;
        
         else
             BUYSignals [Shift] =0;
             
      if (Close [Shift+2] <DynamicLineTrend [Shift+1])       
      if (Close [Shift+2]> DynamicLineTrend [Shift+3])
             SELLSignals [Shift] =High [Shift]-10*point;
         else
             SELLSignals [Shift] =0;
       
         else 
             SELLSignals [Shift] =0;
   } 
//-------------------------------------------------------------------+ 
return (0);
} 
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Try this.
Regards
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


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

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
Dynamic indicators newdigital Indicators - Metatrader 4 34 11-09-2009 03:17 PM
Dynamic RSI !!!! nnjeim Indicators - Metatrader 4 47 06-29-2009 12:59 PM
Anti Trend and Trend Following Systems Maji General Discussion 3 03-08-2007 09:23 PM
What is Dynamic...... babarmughal Indicators - Metatrader 4 1 12-05-2006 06:12 PM
Nice and clean setup elihayun Suggestions for Trading Systems 16 11-19-2006 07:15 AM


All times are GMT. The time now is 12:58 PM.



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