trying again get the info from Arrows

 

hi guys i am having another go at this

I know we can get info from the screen or chart directly into an EA because I have done it with trendlines


now I want to do it with the arrows produced by the indicator "EMA Crossover"


so i have started completely new code and i have it post along with the indicator

any help would be most appreciated

Thanks Ron

Files:
 

Your attempt......

//+------------------------------------------------------------------+
//|                                               find the Arrow.mq4 |
//|                                      Copyright © 2011, Ron Kirby |
//|                                            http://www.blsmur.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, Ron Kirby"
#property link      "http://www.blsmur.com"

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift) 



//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
//int fnGetArrowSignal(string strName, int type);
//{
   // get time and color of arrow 
   double dTime        = ObjectGet( "EMA Crossover", OBJPROP_TIME1);
   double dArrowColorP = ObjectGet( "EMA Crossover", OBJPROP_COLOR);
  Print ("dArrowColorP ", dArrowColorP," dTime ",dTime);



double    EmaArrow=iCustom(NULL,0,"EMA Crossover",4,5,1);
Print ("EmaArrow ",EmaArrow);
// int NewArrow= OBJPROP_ARROWCODE [241];

int  win_Arrow=WindowFind( "EMA Crossover");

Print ("win_Arrow ",win_Arrow );
//----
   return(0);
  }
//+------------------------------------------------------------------+

You can use iCustom to get info from a compiled indicator

double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift)
Calculates the specified custom indicator and returns its value. The custom indicator must be compiled (*.EX4 file) and be in the terminal_directory\experts\indicators directory.
Parameters:
symbol - Symbol the data of which should be used to calculate indicator. NULL means current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
name - Custom indicator compiled program name.
... - Parameters set (if necessary). The passed parameters and their order must correspond with the desclaration order and the type of extern variables of the custom indicator.
mode - Line index. Can be from 0 to 7 and must correspond with the index used by one of SetIndexBuffer functions.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Sample:
  double val=iCustom(NULL, 0, "SampleInd",13,1,0);

You tried

double    EmaArrow=iCustom(NULL,0,"EMA Crossover",4,5,1);

This is wrong.....

1 indicator name is not "EMA Crossover"

============ it is "EMAyCrossover"

2 The indicator has 2 inputparameters both type integer

FasterEMA value 4

SlowerEMA value 5

after the input of the parameters we have to choose the buffer we want the value from and then the barnumber for that value

then you forgot or which buffer (maximal 8 buffers) or what bar you want to have the value

So with this info ......

what is the right code using iCustom( ) to get from this indicator the value of buffer 0 bar1

what is the right code using iCustom( ) to get from this indicator the value of buffer 1 bar1

what is the right code using iCustom( ) to get from this indicator the value of buffer 2 bar1

this you can do till buffer 7 (0,1,2,3,4,5,6,7 are totally 8 buffers)

and what you do to find the value at bar1 you can do so for other bars

I think you have to start first with that good luck

 
deVries:

Your attempt......

You can use iCustom to get info from a compiled indicator

double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift)
Calculates the specified custom indicator and returns its value. The custom indicator must be compiled (*.EX4 file) and be in the terminal_directory\experts\indicators directory.
Parameters:
symbol - Symbol the data of which should be used to calculate indicator. NULL means current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
name - Custom indicator compiled program name.
... - Parameters set (if necessary). The passed parameters and their order must correspond with the desclaration order and the type of extern variables of the custom indicator.
mode - Line index. Can be from 0 to 7 and must correspond with the index used by one of SetIndexBuffer functions.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
Sample:

You tried

This is wrong.....

1 indicator name is not "EMA Crossover"

============ it is "EMAyCrossover"

2 The indicator has 2 inputparameters both type integer

FasterEMA value 4

SlowerEMA value 5

after the input of the parameters we have to choose the buffer we want the value from and then the barnumber for that value

then you forgot or which buffer (maximal 8 buffers) or what bar you want to have the value

So with this info ......

what is the right code using iCustom( ) to get from this indicator the value of buffer 0 bar1

what is the right code using iCustom( ) to get from this indicator the value of buffer 1 bar1

what is the right code using iCustom( ) to get from this indicator the value of buffer 2 bar1

this you can do till buffer 7 (0,1,2,3,4,5,6,7 are totally 8 buffers)

and what you do to find the value at bar1 you can do so for other bars

I think you have to start first with that good luck

thankyou for you input I will have a play with it, i must say the ""y"" is new and not in the original file of EMA Crossover but i will certainly try it too

while the file uploaded as "EMAyCrossover " that name will not load when i run the EA in the tester, removing the y and it runs the indicator ok, I can only assume the y was added during the upload but it was not added by me

C
 
Tradingjunky:

thankyou for you input I will have a play with it, i must say the ""y"" is new and not in the original file of EMA Crossover but i will certainly try it too




Use the Exact name of the indicator how it is on your MT4 platform if it is without ""y"" then you have another indicator here I think
 

alright I have some info coming now I had added buffers to the icustom

and added colors to the properties

now when the indicator places an arrow it gives me a price from the journal

so a little gain today

here is my code so far

//+------------------------------------------------------------------+
//|                                               find the Arrow.mq4 |
//|                                      Copyright © 2011, Ron Kirby |
//|                                            http://www.blsmur.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, Ron Kirby"
#property link      "http://www.blsmur.com"
#property  indicator_color1  Red
#property  indicator_color2  Blue
#property indicator_buffers 2
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift) 
 

 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
//int fnGetArrowSignal(string strName, int type);
//{
   // get time and color of arrow 
   double dTime        = ObjectGet( "EMA Crossover", OBJPROP_TIME1);
   double dArrowColorP = ObjectGet( "EMA Crossover", OBJPROP_COLOR);
  Print ("dArrowColorP ", dArrowColorP," dTime ",dTime);



double    EmaArrow=iCustom(NULL,0,"EMA Crossover",4,5,0,1,1);
 Print ("EmaArrow ",EmaArrow);
// int NewArrow= OBJPROP_ARROWCODE [241];
 
 int  win_Arrow=WindowFind( "EMA Crossover");
 
 Print ("win_Arrow ",win_Arrow );
//----
   return(0);
  }
//+------------------------------------------------------------------+

2012.04.17 18:56:30 2012.03.01 13:00 find the Arrow EURUSD,H1: EmaArrow 1.3358 signal


2012.04.17 18:56:29 2012.03.01 12:59 find the Arrow EURUSD,H1: EmaArrow 2147483647 no signal

 

the ema crossover file again


it would seem the space in the name is being filled randomly by the forum server

Files:
 
Tradingjunky:

alright I have some info coming now I had added buffers to the icustom

and added colors to the properties

now when the indicator places an arrow it gives me a price from the journal

so a little gain today

here is my code so far

2012.04.17 18:56:30 2012.03.01 13:00 find the Arrow EURUSD,H1: EmaArrow 1.3358 signal


2012.04.17 18:56:29 2012.03.01 12:59 find the Arrow EURUSD,H1: EmaArrow 2147483647 no signal


double    EmaArrow=iCustom(NULL,0,"EMA Crossover",4,5,0,1,1);
Now there is one input too many

NULL Symbol()

0 Timeframe attached

"EMA Crossover" name of indicator

4 input FasterEMA

5 input SlowerEMA

0 ???????

1 ??????? input for last input is for the buffer we want the value from

1 ???????? last input is for bar

Is there another parameter for the settings in your indicator "EMA Crossover" that is not in "EMAyCrossover" ????

 
Tradingjunky:

the ema crossover file again

it would seem the space in the name is being filled randomly by the forum server

I see ..... the name change by downloading to the forum.

but still the function is not written right....

 
deVries:

I see ..... the name change by downloading to the forum.

but still the function is not written right....


ok well i now have enough to make my EA work but still not able to actually read the red arrow or the blue arrow which is what i wanted to do

i have put in my ideas for using the existing signal at the bottom of this EA

//+------------------------------------------------------------------+
//|                                               find the Arrow.mq4 |
//|                                      Copyright © 2011, Ron Kirby |
//|                                            http://www.blsmur.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, Ron Kirby"
#property link      "http://www.blsmur.com"
#property  indicator_color1  Red
#property  indicator_color2  Blue
#property indicator_buffers 2
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift) 
 

 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----

 double EmaArrow = 0;
//int fnGetArrowSignal(string strName, int type);
//{
   // get time and color of arrow 
  // double dTime        = ObjectGet( "EMA Crossover", OBJPROP_TIME1);
//   double dArrowColorP = ObjectGet( "EMA Crossover", OBJPROP_COLOR);
 // Print ("dArrowColorP ", dArrowColorP," dTime ",dTime);



    EmaArrow=iCustom(NULL,0,"EMA Crossover",4,5,1,1);
 Print ("EmaArrow ",EmaArrow);
// int NewArrow= OBJPROP_ARROWCODE [241];
 
 //int  win_Arrow=WindowFind( "EMA Crossover");
 
// Print ("win_Arrow ",win_Arrow );
//----
   return(0);
  }
//+------------------------------------------------------------------+


//  I am thinking  I now have enough info coming it to make this EA work 
//  if i compare price to the signal and the signal is > price it is a sell signal 
//  and if the  signal  < price it is a buy  signal 
  
//  i still havnt figured out how to read the red and blue arrows  but at least i have something to put in my EA 

// I will have to also eliminate the very large number when there is no signal  I tried setting the  emaArrow to 0 but it had no effect  
 
Tradingjunky:

ok well i now have enough to make my EA work but still not able to actually read the red arrow or the blue arrow which is what i wanted to do

i have put in my ideas for using the existing signal at the bottom of this EA

It looks to me that the Blue Arrow is buffer 0 and the Red Arrow is buffer 1, you will find an arrow at a bar index when the value is NOT 2147483647
 
EmaArrow=iCustom(NULL,0,"EMA Crossover",4,5,1,1);

You have two Arrows and both appear with a signal from a different buffer

so BlueArrow= iCustom(NULL,0,"EMA Crossover",4,5, .........,1);

RedArrow= iCustom(NULL,0,"EMA Crossover",4,5, .........,1);

Also you have to look for every indicator to the chart if the arrows are appearing for the firsttime at bar 0, or 1 or 2 ....... and if they not disappear repaint

If they not repaint you can use them for making an EA

Don't put in the EA

#property  indicator_color1  Red
#property  indicator_color2  Blue
#property indicator_buffers 2
That's for indicators......
Reason: