could you please change the code in a way that the indicator simply puts some kind of text in the upper right corner,
a sample that can be used for every indicator in separate window
I put the code with self-explanatory comments
BR,
Investeo
//+------------------------------------------------------------------+//| UpperRightCornerText.mq5 |//| Copyright 2010, Investeo.pl |//| http://Investeo.pl |//+------------------------------------------------------------------+#property copyright "2010, Investeo.pl"#property link "http://Investeo.pl"#property version "1.00"#property indicator_separate_window#property indicator_plots 1string label_info="label1";
int window=-1;
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+int OnInit()
{
//--- initialize a label in upper right corner// find indicator's window handleif((ENUM_PROGRAM_TYPE)MQL5InfoInteger(MQL5_PROGRAM_TYPE)==PROGRAM_INDICATOR)
window=ChartWindowFind();
// check if label object does not already exist and create itif(ObjectFind(0,label_info)<0)
{
// Create label in indicator's window ObjectCreate(0,label_info,OBJ_LABEL,window,0,0);
// Set X and Y distance from UPPER RIGHT CORNERObjectSetInteger(0,label_info,OBJPROP_XDISTANCE,200);
ObjectSetInteger(0,label_info,OBJPROP_YDISTANCE,20);
ObjectSetInteger(0,label_info,OBJPROP_CORNER, CORNER_RIGHT_UPPER);
// Set text properties: colour, font and font sizeObjectSetInteger(0,label_info,OBJPROP_COLOR,LightPink);
ObjectSetString(0,label_info,OBJPROP_FONT,"Arial");
ObjectSetInteger(0,label_info,OBJPROP_FONTSIZE,14);
// Set text to displayObjectSetString(0,label_info,OBJPROP_TEXT,"HELLO I am a label");
} elsePrint("label_info already exists");
//---return(0);
}
//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+int OnCalculate(constint rates_total,
constint prev_calculated,
constdatetime& time[],
constdouble& open[],
constdouble& high[],
constdouble& low[],
constdouble& close[],
constlong& tick_volume[],
constlong& volume[],
constint& spread[])
{
//---//--- return value of prev_calculated for next callreturn(rates_total);
}
//+------------------------------------------------------------------+void OnDeinit(constint reason)
{
//---if(!ObjectFind(0,label_info)<0)
ObjectDelete(0, label_info);
}
15
I made a proof-of-concept EA interacting with an indicator through a temporary global variables changed by using different keystrokes.
Corners do work, but one has to remember that lower corners are relative to indicator frame, not the timeline - see the video.
Unfortunately video upload does not seem to work on this forum :(
For the time being I put it on
http://www.youshare.com/Guest/c94bb3e9cfe6a424.flv.html
(see fullscreen for best results)
best regrds,
Hi
There was no audio attached to this videao.
Can you please post the code of the SampleTextIndicator?
Regards
539
Hi
There was no audio attached to this videao.
Can you please post the code of the SampleTextIndicator?
Regards
Hi
The video does not contain audio track. I will post the code today in the evening because I left it on another laptop.
539
The code may not be very elegant, but works properly
15
Hi
thanks for posting the code,
could you please change the code in a way that the indicator simply puts some kind of text in the upper right corner,
a sample that can be used for every indicator in separate window
539
Hi
thanks for posting the code,
could you please change the code in a way that the indicator simply puts some kind of text in the upper right corner,
a sample that can be used for every indicator in separate window
I put the code with self-explanatory comments
BR,
Investeo
22
I need a suggestion for a simple indicator:
Close > EMA 34 = green historgam or ....line or....arrow...
Close< EMA 34 = reed histogram or...line or....arrow...
Thanks for help
15
I put the code with self-explanatory comments
BR,
Investeo
Hi Investeo
many thanks, your code works, i.e.the label shows up, but the value is not updating. Did I make a mistake?
Here is my code.
15
I need a suggestion for a simple indicator:
Close > EMA 34 = green historgam or ....line or....arrow...
Close< EMA 34 = reed histogram or...line or....arrow...
Thanks for help
22
You may try MACD for this purpos
Yes, but should not follow the "curve of the indicator" but only indicate changing color.
Thanks walb
15
Yes, but should not follow the "curve of the indicator" but only indicate changing color.
Thanks walb
The indicator for MT4 is called russian colors, you want
http://www.forexfactory.com/showthread.php?t=173962
You only have to replace the HMA with EMA34