Download MetaTrader 5
To add comments, please log in or register
How to test a program before buying?
nixtrix
17
nixtrix 2014.06.23 16:48 

Hi All,

I currently have an indicator that i am happy using which will simply place an Up Arrow or Down Arrow over a bar.

I would like to know if it is possible to create another indicator that can read/pick up when an arrow has been placed on my chart.


If this is possible could you please point me in the right direction.


Many Thanks.

Boeing747
241
Boeing747 2014.06.23 19:01  
nixtrix:

Hi All,

I currently have an indicator that i am happy using which will simply place an Up Arrow or Down Arrow over a bar.

I would like to know if it is possible to create another indicator that can read/pick up when an arrow has been placed on my chart.


If this is possible could you please point me in the right direction.


Many Thanks.

This script for an example of work with arrows


//+------------------------------------------------------------------+
//|                                                        Happy.mq4 |
//|                        Copyright 2014, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#include <stdlib.mqh>
#property show_inputs
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
extern int timer=1;  //Ask me every  minutes. 
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   long chartID=ChartID();
   int i;
   bool x;
   double y=5*Point;
   int f=60*1000;
   int c=241;
   int ret;
   color clr=SpringGreen;

   while(!IsStopped())
     {
      if(ObjectFind("Happy")==-1)
        {
         Sleep(22);
         x=ObjectCreate("Happy",OBJ_ARROW,0,Time[0],High[0]+y);
         if(x==false)
           {
            Print("Can't create Happy! Error description: "+ErrorDescription(GetLastError())+"");
           }
         ObjectSet("Happy",OBJPROP_COLOR,clrRed);
         ObjectSet("Happy",OBJPROP_WIDTH,5);
        }
      RefreshRates();
      ObjectMove("Happy",0,Time[0],High[0]+y);
      ObjectSet("Happy",OBJPROP_ARROWCODE,c);
      ObjectSet("Happy",OBJPROP_COLOR,clr);
      ChartRedraw(chartID);
      i++;
      Sleep(500);
      if(f-i*500>0)continue;
      i=0;
      c=241;
      clr=SpringGreen;
      ret=MessageBox("ARE YOU HAPPY?","Question",MB_YESNO|MB_ICONQUESTION|MB_TOPMOST);
      if(ret==IDYES)continue;
      c=242;
      clr=DarkGray;
     }
  }
//+------------------------------------------------------------------+
whroeder1
13644
whroeder1 2014.06.24 15:04  
nixtrix: I currently have an indicator that i am happy using which will simply place an Up Arrow or Down Arrow over a bar.
Most likely it's not creating arrow objects. It is putting a value in one of two buffers. (above or below.) Just read the last bar buffer values and see if it's not EMPTY_VALUE.
/
To add comments, please log in or register