Forex
Google
New signals service!

Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-11-2006, 04:25 PM
iscuba11's Avatar
Senior Member
 
Join Date: May 2006
Location: Houston
Posts: 400
iscuba11 is on a distinguished road
Question I need help on creating an Icustom statement for my EA using this indicator as input!

PHP Code:
//+------------------------------------------------------------------+
//|                                                    Fisher_v1.mq4 
//|                           Copyright © 2005, TrendLaboratory Ltd. |
//|            http://finance.groups.yahoo.com/group/TrendLaboratory |
//|                                       E-mail: igorad2004@list.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, TrendLaboratory Ltd."
#property link      "http://finance.groups.yahoo.com/group/TrendLaboratory"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_level1 -0.86
#property indicator_level2 0.86
//---- input parameters
extern int Length=10;
extern int Price=4;
extern int NumBars=0
//---- buffers
double UpBuffer [];
double DnBuffer [];     
double Value [];
double Fisher[];   

int init()
  {
  
IndicatorBuffers(4);
  
  
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
  
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2);
  
  
SetIndexBuffer(0,UpBuffer);
  
SetIndexBuffer(1,DnBuffer);
  
SetIndexBuffer(2,Value);
  
SetIndexBuffer(3,Fisher);
  
  
IndicatorShortName ("Fisher(" Length "," Price ")");
  
SetIndexLabel (0"UpTrend");
  
SetIndexLabel (1"DownTrend");
  
  
SetIndexDrawBegin(0,Length);
  
SetIndexDrawBegin(1,Length);
   
  return(
0);
  }


//+------------------------------------------------------------------+
//| Fisher_v1                                                         |
//+------------------------------------------------------------------+
int start()
  {
  
int shift;
   
  
double smin=0,smax=0;                    

if (
NumBars>0int NBars=NumBars; else NBars=Bars;

for(
shift=NBars;shift>=0;shift--)
   {    
   
UpBuffer[shift]=0.0;
   
DnBuffer[shift]=0.0;     
   
Value [shift]=0.0;
   
Fisher[shift]=0.0;   
   }
   
for(
shift=NBars-1-Length;shift>=0;shift--)
   {    
   
smax High[Highest(NULL,0,MODE_HIGH,Length,shift)];
   
smin Low[Lowest(NULL,0,MODE_LOW,Length,shift)];
  
   
double price iMA(NULL,0,1,0,0,Price,shift);
   if (
smax-smin==0.0double wpr=1.0; else wpr=(price-smin)/(smax-smin);         
   
Value[shift] = 0.33*2*(wpr-0.5) + 0.67*Value[shift+1];     
   
Value[shift] = MathMin(MathMax(Value[shift],-0.999),0.999); 
   
Fisher[shift] = 0.5*MathLog((1.0+Value[shift])/(1.0-Value[shift]))+0.5*Fisher[shift+1];
          
   if (
Fisher[shift]>=0)
     {
     
UpBuffer[shift] = Fisher[shift];
     
DnBuffer[shift] = 0.0;
     }
   else
     {
     
UpBuffer[shift] = 0.0;
     
DnBuffer[shift] = Fisher[shift];  
     }
   }
  return(
0);
  }
//+------------------------------------------------------------------+ 
Could somebody write me an icustom statement for my EA that will import the values coming from this indicator - I am totally confused and really need the professional assistance from you coder pro's.

buy_cur= icustom(NULL,0, "Fisher_v1", _________,_________,0);


Please Help this person in distress!


Dave
<><<<


I tried, it failed!:
buy_cur=iCustom(NULL,0,"Fisher_v1",length,price,1, 0); (The message under the Experts tab reads buy_cur=0). I am not reading the indicator!

Please Help Me!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-11-2006, 05:27 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 987
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Arrow

Quote:
Originally Posted by iscuba11
PHP Code:
//+------------------------------------------------------------------+
//|                                                    Fisher_v1.mq4 
//|                           Copyright © 2005, TrendLaboratory Ltd. |
//|            http://finance.groups.yahoo.com/group/TrendLaboratory |
//|                                       E-mail: igorad2004@list.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, TrendLaboratory Ltd."
#property link      "http://finance.groups.yahoo.com/group/TrendLaboratory"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_level1 -0.86
#property indicator_level2 0.86
//---- input parameters
extern int Length=10;
extern int Price=4;
extern int NumBars=0
//---- buffers
double UpBuffer [];
double DnBuffer [];     
double Value [];
double Fisher[];   

int init()
  {
  
IndicatorBuffers(4);
  
  
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
  
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2);
  
  
SetIndexBuffer(0,UpBuffer);
  
SetIndexBuffer(1,DnBuffer);
  
SetIndexBuffer(2,Value);
  
SetIndexBuffer(3,Fisher);
  
  
IndicatorShortName ("Fisher(" Length "," Price ")");
  
SetIndexLabel (0"UpTrend");
  
SetIndexLabel (1"DownTrend");
  
  
SetIndexDrawBegin(0,Length);
  
SetIndexDrawBegin(1,Length);
   
  return(
0);
  }


//+------------------------------------------------------------------+
//| Fisher_v1                                                         |
//+------------------------------------------------------------------+
int start()
  {
  
int shift;
   
  
double smin=0,smax=0;                    

if (
NumBars>0int NBars=NumBars; else NBars=Bars;

for(
shift=NBars;shift>=0;shift--)
   {    
   
UpBuffer[shift]=0.0;
   
DnBuffer[shift]=0.0;     
   
Value [shift]=0.0;
   
Fisher[shift]=0.0;   
   }
   
for(
shift=NBars-1-Length;shift>=0;shift--)
   {    
   
smax High[Highest(NULL,0,MODE_HIGH,Length,shift)];
   
smin Low[Lowest(NULL,0,MODE_LOW,Length,shift)];
  
   
double price iMA(NULL,0,1,0,0,Price,shift);
   if (
smax-smin==0.0double wpr=1.0; else wpr=(price-smin)/(smax-smin);         
   
Value[shift] = 0.33*2*(wpr-0.5) + 0.67*Value[shift+1];     
   
Value[shift] = MathMin(MathMax(Value[shift],-0.999),0.999); 
   
Fisher[shift] = 0.5*MathLog((1.0+Value[shift])/(1.0-Value[shift]))+0.5*Fisher[shift+1];
          
   if (
Fisher[shift]>=0)
     {
     
UpBuffer[shift] = Fisher[shift];
     
DnBuffer[shift] = 0.0;
     }
   else
     {
     
UpBuffer[shift] = 0.0;
     
DnBuffer[shift] = Fisher[shift];  
     }
   }
  return(
0);
  }
//+------------------------------------------------------------------+ 
Could somebody write me an icustom statement for my EA that will import the values coming from this indicator - I am totally confused and really need the professional assistance from you coder pro's.

buy_cur= icustom(NULL,0, "Fisher_v1", _________,_________,0);


Please Help this person in distress!


Dave
<><<<


I tried, it failed!:
buy_cur=iCustom(NULL,0,"Fisher_v1",length,price,1, 0); (The message under the Experts tab reads buy_cur=0). I am not reading the indicator!

Please Help Me!
This indicator has two buffers, to get the value of the first line use:
PHP Code:
 iCustom(NULL,0,"Fisher_v1",Length,Price,NumBars,0,0); 
for the value of the second buffer use:
PHP Code:
 iCustom(NULL,0,"Fisher_v1",Length,Price,NumBars,1,0); 
Please review this article for more info:
http://www.metatrader.info/node/40
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-11-2006, 05:31 PM
Senior Member
 
Join Date: Mar 2006
Posts: 787
Maji is on a distinguished road
Let me see if I can push you in the right direction.

According to MT help,

double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift)


so, you should have,

buy_cur = iCustom(NULL, 0, "Fisher_v1", Length, Price, NumBars, 3, 1);

So, the lenght, price and numbars are the required parameters for the indicator and the "3" indicates that it will return the values of the 4th buffer, which is the Fisher.

Hope this helps.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-11-2006, 05:46 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 987
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Cool

Quote:
Originally Posted by Maji
Let me see if I can push you in the right direction.

According to MT help,

double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift)


so, you should have,

buy_cur = iCustom(NULL, 0, "Fisher_v1", Length, Price, NumBars, 3, 1);

So, the lenght, price and numbars are the required parameters for the indicator and the "3" indicates that it will return the values of the 4th buffer, which is the Fisher.

Hope this helps.
Yes! That's right! the Fisher buffer is the fourth one (which has the index 3)! but for the current bar it should be :

PHP Code:
 buy_cur iCustom(NULL0"Fisher_v1"LengthPriceNumBars30); 

I'm thinking in creating a little visual basic toy that takes a mql4 file as input and returns the line of the icutom depending in the options (ex: which buffer) the user sets! WHAT DO YOU THINK?
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 09-11-2006, 07:18 PM
iscuba11's Avatar
Senior Member
 
Join Date: May 2006
Location: Houston
Posts: 400
iscuba11 is on a distinguished road
Smile

Thanks CodersGuru and Maji, I think I got it now how this works. I was at your site CodersGuru and the amount of variables messed me up, as well as buffers. Most examples people use in training are basic 1 variable examples. This multiple variable, multiple buffer usage really clarified the more extreme usage of this statement along with both your excellent comments. I dreaded icustom statements, but now I feel I understand them (I'm pretty sure!). What is sad is the examples the MetaEditor has most of the time in the Dictionary suck! I even went on their help site and the past answers to the questions on their forum were deleted - That really helps people - Not!

Trial by fire. Like I told somebody in the past, by the time I reach Moses' of the Bible retirement age, I will know this stuff!

Thanks again guys, if it wasn't for your help and the help we all share with each other, this programming for most of us would be hopeless. Now to fully document what I now have learned concerning icustom statements.

We sincere appreciation!

Dave
<><<<
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

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
Help creating an indicator gkozlyk Indicators - Metatrader 4 3 03-28-2007 02:13 AM
Creating an EA matrixebiz Expert Advisors - Metatrader 4 6 12-01-2006 06:04 PM
EA input screen pete36 Metatrader 4 2 11-25-2006 11:57 PM


All times are GMT. The time now is 10:52 AM.



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