trying again get the info from Arrows

Back to topics list  | 1 2 To post a new topic, please log in or register
avatar
50
Tradingjunky 2012.04.18 00:14 #
 
RaptorUK:
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

yes it prints an arrow on screen when the value is not 2147483647


which is why i said i can now write some code to make use of that info but i cannot figure out how to read the arrow from the screen

I cant find any info on buffers and how to write them

i did find the setindexbuffer but it is only for indicators when i compile

so it will have to go to the back burner i guess slow process learning to code but i have enough now to write most stuff i want to play with


 
avatar
14167
RaptorUK 2012.04.18 00:28 #
 

What you have to do is check using the index number of a bar to see if there is a Red or Blue arrow there . . . you use the index (bar number) with iCustom and if the value is not 2147483647 then you have an arrow there . . . you have to do it twice, once iCustom call for buffer 0 - Red, and once for buffer 1 - Blue

For example, if you wanted to find the last red arrow and last blue arrow . . . last being the ones nearest to the right side of the chart.

bool BlueArrow = false, RedArrow=false;
int BlueArrowIndex, RedArrowIndex, Index = 0;
double BlueArrowPrice, RedArrowPrice;

while(!BlueArrow && !RedArrow)    //  end while loop when we have found the most recent red and Blue arrows
   {
   if(iCustom(. . . . . 0, Index ) < 2147483647)   //  check for Blue arrow
      {
      BlueArrowIndex = Index;
      BlueArrowPrice = iCustom(. . . . . 0, Index );
      BlueArrow = true;
      }

   if(iCustom(. . . . . 1, Index ) < 2147483647)   //  check for Red arrow
      {
      RedArrowIndex = Index;
      RedArrowPrice = iCustom(. . . . . 1, Index );
      RedArrow = true;
      }
   
   
   Index++;
   }

code is NOT tested . . . . it's just an example to give you some ideas.

 
avatar
50
Tradingjunky 2012.04.18 00:32 #
 
deVries:

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

That's for indicators......


OK i have fixed the code a bit and now i get a 1 or 2147483647 from each signal which is way better ty guys for your help

code below



//+------------------------------------------------------------------+
//|                                               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,0,1,1);
// Print ("EmaArrow ",EmaArrow);
 
 


 
  int BlueArrow= iCustom(NULL,0,"EMA Crossover",4,5,0,1);
 int RedArrow= iCustom(NULL,0,"EMA Crossover",4,5, 1,1);
 Print ("BlueArrow", BlueArrow);
 Print (" RedArrow", RedArrow);
// 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 

 
avatar
99
rocketman99 2012.04.18 01:34 #
 
RaptorUK:

What you have to do is check using the index number of a bar to see if there is a Red or Blue arrow there . . . you use the index (bar number) with iCustom and if the value is not 2147483647 then you have an arrow there . . . you have to do it twice, once iCustom call for buffer 0 - Red, and once for buffer 1 - Blue

For example, if you wanted to find the last red arrow and last blue arrow . . . last being the ones nearest to the right side of the chart.

code is NOT tested . . . . it's just an example to give you some ideas.


if(iCustom(. . . . . 0, Index ) < 2147483647)

Would be better written as

if(iCustom(. . . . . 0, Index ) < EMPTY_VALUE )

 
avatar
50
Tradingjunky 2012.04.18 07:31 #
 
rocketman99:


if(iCustom(. . . . . 0, Index ) < 2147483647)

Would be better written as

if(iCustom(. . . . . 0, Index ) < EMPTY_VALUE )


the code i posted above works perfectly


aside from that when you refer to the index is that the last bar ie last bar =0

but to get the information i need it set to 1 which is previous bar and this give me the correct signal at the start of the new bar

just asking for clarification of "index"

ty again four everyones help


 
avatar
14167
RaptorUK 2012.04.18 09:30 #
 
Tradingjunky:

the code i posted above works perfectly


aside from that when you refer to the index is that the last bar ie last bar =0

but to get the information i need it set to 1 which is previous bar and this give me the correct signal at the start of the new bar

just asking for clarification of "index"

Did you look through my code posted above ?

Do you understand how bars are numbered ?

Read this part of the Book : https://book.mql4.com/variables/arrays

 
avatar
2408
deVries 2012.04.18 11:02 #
 

That you get the value 1 for when there is an arrow is because you have made it an integer

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

To find the correct value of an iCustom(....) function you have to use

double

instead of integer ........

Then the code from RaptorUK very nice..... only not working this way but giving ideas

Index is number for bar to check

bool BlueArrow = false, RedArrow=false;
int BlueArrowIndex, RedArrowIndex, Index = 0;
double BlueArrowPrice, RedArrowPrice;

while(!BlueArrow || !RedArrow)    //  end while loop when we have found the most recent red and Blue arrows
                                    //for both ||  last arrow only  &&
   {
   if(!BlueArrow)//if(iCustom(. . . . . 0, Index ) < 2147483647)   //  check for Blue arrow
      {
      BlueArrowIndex = Index;
      BlueArrowPrice = iCustom(. . . . . 0, BlueArrowIndex );//make it BlueArrowIndex
      if(BlueArrowPrice<2147483647)BlueArrow = true;//BlueArrow true when there is value
      }

   if(!RedArrow)//if(iCustom(. . . . . 1, Index ) < 2147483647)   //  check for Red arrow
      {
      RedArrowIndex = Index;
      RedArrowPrice = iCustom(. . . . . 1, RedArrowIndex );//make it RedArrowIndex
      if(RedArrowPrice<2147483647)RedArrow = true;
      }
   
   
   Index++;
   }

  Comment("RedArrowPrice  ", RedArrowPrice,"  Barnumber Arrow  ",RedArrowIndex,"\n",
      "    BlueArrowPrice  ", BlueArrowPrice,"  Barnumber Arrow  ",BlueArrowIndex); 



avatar
1
9254070 2015.06.17 03:23 #
 
hellow there how do i get code emaycrossover.mq4 in here hope that
Back to topics list   | 1 2  

To add comments, please log in or register