Need code example for displaying SYMBOL_LEFTPRICE

 

Hello,

Can someone please provide a code example on how to display the SYMBOL_LEFTPRICE symbol on the chart window on any bar at any price?

What function will place this arrow on the chart?

Thank you.

-charliev

 

Read documentation, please. Fucntion ObjectCreate will help you. Also https://docs.mql4.com/constants/objectconstants/enum_object:

Object type identifier constants used with ObjectCreate(), ObjectsDeleteAll() and ObjectType() functions. It can be any of the following values:
Objects can have 1-3 coordinates related to type.

Constant Value Description
OBJ_VLINE0Vertical line. Uses time part of first coordinate.
OBJ_HLINE1Horizontal line. Uses price part of first coordinate.
OBJ_TREND2Trend line. Uses 2 coordinates.
OBJ_TRENDBYANGLE3Trend by angle. Uses 1 coordinate. To set angle of line use ObjectSet() function.
OBJ_REGRESSION4Regression. Uses time parts of first two coordinates.
OBJ_CHANNEL5Channel. Uses 3 coordinates.
OBJ_STDDEVCHANNEL6Standard deviation channel. Uses time parts of first two coordinates.
OBJ_GANNLINE7Gann line. Uses 2 coordinate, but price part of second coordinate ignored.
OBJ_GANNFAN8Gann fan. Uses 2 coordinate, but price part of second coordinate ignored.
OBJ_GANNGRID9Gann grid. Uses 2 coordinate, but price part of second coordinate ignored.
OBJ_FIBO10Fibonacci retracement. Uses 2 coordinates.
OBJ_FIBOTIMES11Fibonacci time zones. Uses 2 coordinates.
OBJ_FIBOFAN12Fibonacci fan. Uses 2 coordinates.
OBJ_FIBOARC13Fibonacci arcs. Uses 2 coordinates.
OBJ_EXPANSION14Fibonacci expansions. Uses 3 coordinates.
OBJ_FIBOCHANNEL15Fibonacci channel. Uses 3 coordinates.
OBJ_RECTANGLE16Rectangle. Uses 2 coordinates.
OBJ_TRIANGLE17Triangle. Uses 3 coordinates.
OBJ_ELLIPSE18Ellipse. Uses 2 coordinates.
OBJ_PITCHFORK19Andrews pitchfork. Uses 3 coordinates.
OBJ_CYCLES20Cycles. Uses 2 coordinates.
OBJ_TEXT21Text. Uses 1 coordinate.
OBJ_ARROW22Arrows. Uses 1 coordinate.
OBJ_LABEL23Text label. Uses 1 coordinate in pixels.


and Arrow codes:

Predefined Arrow codes enumeration. Arrows code constants. It can be one of the following values:

Constant Value Description
SYMBOL_THUMBSUP67Thumb up symbol (C).
SYMBOL_THUMBSDOWN68Thumb down symbol (D).
SYMBOL_ARROWUP241Arrow up symbol (ñ).
SYMBOL_ARROWDOWN242Arrow down symbol (ò).
SYMBOL_STOPSIGN251Stop sign symbol (û).
SYMBOL_CHECKSIGN252Check sign symbol (ü).

Special Arrow codes that exactly points to price and time. It can be one of the following values:

Constant Value Description

1Upwards arrow with tip rightwards ().

2Downwards arrow with tip rightwards ().

3Left pointing triangle ().

4En Dash symbol (–).
SYMBOL_LEFTPRICE5Left sided price label.
SYMBOL_RIGHTPRICE6Right sided price label.


Don't be layzy!

 
Rosh :

Read documentation, please. Fucntion ObjectCreate will help you. Also https://docs.mql4.com/constants/objectconstants/enum_object:

Object type identifier constants used with ObjectCreate(), ObjectsDeleteAll() and ObjectType() functions. It can be any of the following values:
Objects can have 1-3 coordinates related to type.

Constant Value Description
OBJ_VLINE 0 Vertical line. Uses time part of first coordinate.
OBJ_HLINE 1 Horizontal line. Uses price part of first coordinate.
OBJ_TREND 2 Trend line. Uses 2 coordinates.
OBJ_TRENDBYANGLE 3 Trend by angle. Uses 1 coordinate. To set angle of line use ObjectSet() function.
OBJ_REGRESSION 4 Regression. Uses time parts of first two coordinates.
OBJ_CHANNEL 5 Channel. Uses 3 coordinates.
OBJ_STDDEVCHANNEL 6 Standard deviation channel. Uses time parts of first two coordinates.
OBJ_GANNLINE 7 Gann line. Uses 2 coordinate, but price part of second coordinate ignored.
OBJ_GANNFAN 8 Gann fan. Uses 2 coordinate, but price part of second coordinate ignored.
OBJ_GANNGRID 9 Gann grid. Uses 2 coordinate, but price part of second coordinate ignored.
OBJ_FIBO 10 Fibonacci retracement. Uses 2 coordinates.
OBJ_FIBOTIMES 11 Fibonacci time zones. Uses 2 coordinates.
OBJ_FIBOFAN 12 Fibonacci fan. Uses 2 coordinates.
OBJ_FIBOARC 13 Fibonacci arcs. Uses 2 coordinates.
OBJ_EXPANSION 14 Fibonacci expansions. Uses 3 coordinates.
OBJ_FIBOCHANNEL 15 Fibonacci channel. Uses 3 coordinates.
OBJ_RECTANGLE 16 Rectangle. Uses 2 coordinates.
OBJ_TRIANGLE 17 Triangle. Uses 3 coordinates.
OBJ_ELLIPSE 18 Ellipse. Uses 2 coordinates.
OBJ_PITCHFORK 19 Andrews pitchfork. Uses 3 coordinates.
OBJ_CYCLES 20 Cycles. Uses 2 coordinates.
OBJ_TEXT 21 Text. Uses 1 coordinate.
OBJ_ARROW 22 Arrows. Uses 1 coordinate.
OBJ_LABEL 23 Text label. Uses 1 coordinate in pixels.

and Arrow codes:

Predefined Arrow codes enumeration. Arrows code constants. It can be one of the following values:

Constant Value Description
SYMBOL_THUMBSUP 67 Thumb up symbol (C).
SYMBOL_THUMBSDOWN 68 Thumb down symbol (D).
SYMBOL_ARROWUP 241 Arrow up symbol (ñ).
SYMBOL_ARROWDOWN 242 Arrow down symbol (ò).
SYMBOL_STOPSIGN 251 Stop sign symbol (û).
SYMBOL_CHECKSIGN 252 Check sign symbol (ü).

Special Arrow codes that exactly points to price and time. It can be one of the following values:

Constant Value Description
1 Upwards arrow with tip rightwards ().
2 Downwards arrow with tip rightwards ().
3 Left pointing triangle ().
4 En Dash symbol (–).
SYMBOL_LEFTPRICE 5 Left sided price label.
SYMBOL_RIGHTPRICE 6 Right sided price label.

Don't be layzy!

Rosh, I assure you the issue has nothiong to do with me being lazy....

I have NEVER been able to get the system to displa SPECIAL ARROW CODES... if you notice the values are shared by other constants... so, I merely requested a code example for SYMBOL_LEFTPRICE that is known to work.

-charliev

 

Well, here is simple script.


//+------------------------------------------------------------------+
//|                                         ShowSYMBOL_LEFTPRICE.mq4 |
//|                      Copyright © 2007, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
   string arrowName="SYMBOL_LEFTPRICE";
//----
   if (ObjectFind(arrowName)<0)
     {
      Print("Create arrow");
      ObjectCreate(arrowName,OBJ_ARROW,0,Time[0],Open[0]);
      ObjectSet(arrowName,OBJPROP_ARROWCODE,SYMBOL_LEFTPRICE);
      ObjectSet(arrowName,OBJPROP_COLOR,Red);
     }
   else
     {
      Print("Delete arrow");
      ObjectDelete(arrowName);
     }     
//----
   return(0);
  }
//+------------------------------------------------------------------+

See video



 

Rosh,

Thank you so much! I was able to see my error.... I wasn't doing the ObjectSet.... was placing SYMBOL_LEFTPRICE in the ObjectCreate line...!

ObjectCreate(arrowName,OBJ_ARROW,0,Time[0],Open[0]);
ObjectSet(arrowName,OBJPROP_ARROWCODE,SYMBOL_LEFTPRICE);

 
You are welcome.
 

See also indicator Fractals_Price