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 05-30-2009, 03:41 AM
Member
 
Join Date: Jul 2008
Posts: 48
chiwing is on a distinguished road
Speed up a indicator- I_XO_A_H

i am backtesting a EA -"scalp_net"
and it run very slow, since it use indicator I_XO_A_H, i want to ask how to let indicator not re-calculate previous bar in the ea ? (except the bar[0] )

thanks

below is the code of indicator I_XO_A_H

Code:
//+------------------------------------------------------------------+
//|                                                         Amir.mq4 |
//|                                           Copyright ?2005, Amir |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2005, Amir"
#property link      ""

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
//---- input parameters
extern int       BoxSize=15;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
   int Cur=0;
   int KirUp=0;
   int KirDn=0;
   int kr=0;
   int no=0;
   double valueh=0;
   double valuel=0;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexLabel(0,"XOUP");
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexLabel(1,"XODOWN");
   IndicatorShortName("I-XO-A-H");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int CurrentBar;
   double Hi,Lo,Curb;
   int    counted_bars=IndicatorCounted();
//---- TODO: add your code here

   //----Calculation---------------------------
   for(int i=0;i<=Bars;i++)
   {
      CurrentBar = Bars-i;
      if (Cur<1)
      {
         Hi=Close[CurrentBar];
         Lo=Close[CurrentBar];
         Cur=1;
      }
      Curb=Close[CurrentBar];
      if (Curb>(Hi+BoxSize*Point))
      {
         Cur+=1;
         Hi=Curb;
         Lo=Curb-BoxSize*Point;
         KirUp=1;
         KirDn=0;
         kr+=1;
         no=0;   
      }
      if (Curb<(Lo-BoxSize*Point))
      {
         Cur+=1;
         Lo=Curb;
         Hi=Curb+BoxSize*Point;
         KirUp=0;
         KirDn=1;
         no+=1;
         kr=0;
      }
      valueh=kr;
      valuel=0-no;
      ExtMapBuffer1[CurrentBar]=valueh;
      ExtMapBuffer2[CurrentBar]=valuel;
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Last edited by chiwing; 05-30-2009 at 07:35 AM.
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 05-30-2009, 07:39 AM
Member
 
Join Date: Jul 2008
Posts: 48
chiwing is on a distinguished road
btw, do i_XO_A_H essential to re-calculate previous bar?
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 05-30-2009, 09:26 AM
Junior Member
 
Join Date: Aug 2008
Posts: 1
JimsShed is on a distinguished road
Speed up a indicator- I_XO_A_H

Here you go. Interesting Indicator. A setting of around 20 picks up the current 1hr eurusd trend quite nicely.

Indicator now has an extra parameter where you set the maximum number of indicator bars to display.

Cheers, Jim
Attached Files
File Type: mq4 Amir.mq4 (2.9 KB, 134 views)
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 05-31-2009, 02:31 AM
Member
 
Join Date: Jul 2008
Posts: 48
chiwing is on a distinguished road
maybe i set too many bar allowed in the chart, so it cause slow, does it?

Last edited by chiwing; 05-31-2009 at 03:53 AM.
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
For those who use Opera; New Speed Dial feature Diam0nd Non Related Discussions 0 03-01-2007 12:51 AM
Speed-/Acceleration-System justize Expert Advisors - Metatrader 4 6 02-25-2007 10:04 AM
server speed forexts General Discussion 4 12-13-2005 07:28 PM


All times are GMT. The time now is 11:29 AM.



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