Download MetaTrader 5

Color Markers for Buy and Sell Orders ?

To add comments, please log in or register
Do you know that MQL5 has classes?
24h-worker
86
24h-worker 2010.01.12 13:37 

In MQL4 it was possible to draw little markers in the chart when placed a Buy/Sell Orders.

Is this feature transfered to MQL5 ? Somewhere in the class  CChartObject ? 

I would like to have it as MqlTradeRequest.Color
 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Data Structures / Trade Request Structure
  • www.mql5.com
Standard Constants, Enumerations and Structures / Data Structures / Trade Request Structure - Documentation on MQL5
24h-worker
86
24h-worker 2010.01.17 17:35  
24h-worker posted  :

In MQL4 it was possible to draw little markers in the chart when placed a Buy/Sell Orders.

Is this feature transfered to MQL5 ? Somewhere in the class  CChartObject ? 

I would like to have it as MqlTradeRequest.Color
 

Here speaks the master of the Universe, the MQL5-Terminator: I have found a solution

if(Result.retcode = Order placed successfully)

{

 // if you want draw a small Line:

           ObjectCreate(0,"Test-1",OBJ_RECTANGLE,0, TimeCurrent()-5500, Ask-Price - 10*_Point, TimeCurrent() ,Ask-Price);   // small Line, about 10 Pixel long and 3 Pixels high

           ObjectSetInteger(0,"Test-1",OBJPROP_COLOR, Green); // green Color perhaps for Buy-Orders; red for .... 

}  

When you make your own tests pay attention that you change the variable "Test-1" every time you change a value.

 

If you want to draw a cross for a closed position in the chart:

ObjectCreate(0,"cross_red",OBJ_ARROW_STOP,0,TimeCurrent(),Ask-Price);  // its not an arrow, its a cross
ObjectSetInteger(0,"cross_red",OBJPROP_COLOR, Red);    //here you change the color

To add comments, please log in or register