arrow over candle error

To add comments, please log in or register
faustf
255
faustf  

hi guys  i try to se over the candel a little arrow  i create this script

it create a rrow  but not over the candel and when i zoom it  the arrow is so much over

anyone have some suggestions ?  thankz

//+------------------------------------------------------------------+
//|                                                      ProjectName |
//|                                      Copyright 2018, CompanyName |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+


#property indicator_chart_window
extern int    font_size = 10;
extern color  ColorBull = DodgerBlue;
extern color  ColorBeer = Red;
extern string font_name = "Arial";
 
//+------------------------------------------------------------------+
int start()
  {
 
   int val_index=iHighest(NULL,0,MODE_HIGH,VisibleBar,0);

   string ArrowName="triangle up";
   ObjectCreate(ArrowName, OBJ_ARROW, 0, Time[0], (High[val_index]),0,0);  //draw an up arrow
   ObjectSet(ArrowName, OBJPROP_COLOR,Red);
   ObjectSet(ArrowName,OBJPROP_ARROWCODE,217);
 
   return 0 ;
  }
//+------------------------------------------------------------------+
int deinit()
  {
   ObjectsDeleteAll(0,OBJ_TEXT);
   return(0);
  }
//+------------------------------------------------------------------+
 
William Roeder
21958
William Roeder  
faustf: it create a rrow  but not over the candel and when i zoom it  the arrow is so much over
  1. There are only 6 arrows codes that exactly points to price and time. All the others and Wingdings are drawn from their font base.
  2. To get them to draw such that they touch the H/L of the candle means you have to add/subtract a pixel amount (converted to a price change.)
    1. The offsets (bottom or top,) are constant but depends on the symbol displayed.  Large diamond in the attached indicator is +6 or -8
    2. The pixel offset to price offset, depends on the chart scaling, it must be recalculated periodically and all arrows moved.
Files:
faustf
255
faustf  

i tryed  to use 

//+------------------------------------------------------------------+
//|                                                      ProjectName |
//|                                      Copyright 2018, CompanyName |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+


#property indicator_chart_window
extern int    font_size = 10;
extern color  ColorBull = DodgerBlue;
extern color  ColorBeer = Red;
extern string font_name = "Arial";
 double ExtUpFractalsBuffer[];
//+------------------------------------------------------------------+
int start()
  {
 
   int val_index=iHighest(NULL,0,MODE_HIGH,VisibleBar,0);




  SetIndexBuffer(0,ExtUpFractalsBuffer);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,217);
 
   return 0 ;
  }
//+------------------------------------------------------------------+
int deinit()
  {
   ObjectsDeleteAll(0,OBJ_TEXT);
   return(0);
  }
//+------------------------------------------------------------------+

but not appear nothing


William Roeder
21958
William Roeder  
faustf: i tryed  to use … but not appear nothing
  1. Move your buffer, index calls to init()
  2. Of course nothing appears, you never populate the buffer with anything.
  3. Why are you deleting text objects? Only delete what the indicator creates: Nothing.
faustf
255
faustf  

i ifnd this solution for me is much simply

//+------------------------------------------------------------------+
//|            DRAW ARROW                                            |
//+------------------------------------------------------------------+
void DownShadoWCountVisible(string ArrowName,int PBar,int UPorDown,color ColorArw)
  {

   if (UPorDown==0) ObjectCreate(ArrowName, OBJ_ARROW, 0, Time[PBar], (Low[PBar]-100*Point)); //draw an dow arrow
   if (UPorDown==1) ObjectCreate(ArrowName, OBJ_ARROW, 0, Time[PBar], (High[PBar]+100*Point)); //draw an up arrow

   ObjectSet(ArrowName, OBJPROP_STYLE, STYLE_SOLID);
   ObjectSet(ArrowName, OBJPROP_ARROWCODE, SYMBOL_ARROWUP);
   ObjectSet(ArrowName, OBJPROP_COLOR,ColorArw);

   return ;
  }
//+------------------------------------------------------------------+
To add comments, please log in or register