Jump to content

I want to write something on the LH side of the chart


Freddie

Recommended Posts

Hi, I am too old to learn programming so I wonder if anyone could tell me how to access ????? - don't know what to call it- and write a set of instructions for myself.(Top LH corner)

 

I have Russ Horne's FMM system. Here is the screen area:... I just realised that I need to make a picture and share it. I will do that and come back to add it to the post.

 

Thank you

http://i914.photobucket.com/albums/ac341/freddieforII/FMM1H_zps86f8e0dc.png

Edited by Freddie
Link to comment
Share on other sites

I can't attach the file so here is the code. Open notepad (or any other text editor) and paste this into it. Then Save-As "Add_Notes.mq4" (not "Add_Notes.txt") in your Experts | Indicators folder. Then open the *.MQ4 file in MetaEditor and compile it. You'll need to re-start MT4 to make the compiled ex4 available for use. Then you can attach it to a chart and play with the settings to get what you want in the correct corner, font size, font colour etc. I Hope this is what you seek. (Clicking "Thanks" is always appreciated).

 

//----

#property indicator_chart_window

 

extern int myChartX = 10 ;

extern int myChartY = 100 ;

extern int myCorner = 0 ;

extern string myFont = "Arial Bold" ;

extern int myFontSize = 18 ;

extern color colorHead = DarkGray ;

extern color colorComment = Orange ;

extern int LineSpacing=10;

 

extern string myNote01 = "note 1" ;

extern string myNote02 = "note 2" ;

extern string myNote03 = "note 3" ;

extern string myNote04 = "" ;

extern string myNote05 = "" ;

extern string myNote06 = "" ;

extern string myNote07 = "" ;

extern string myNote08 = "" ;

extern string myNote09 = "" ;

extern string myNote10 = "note10" ;

 

// add extra notes here-increment by 1 each note

extern string myNote11 = "note11" ;

 

int Space=0;

 

string symbol, tChartPeriod, ShortName ;

 

int glimit, digits, period, win, digits2, n, j, i, k, g;

 

double point, point2, value ;

//string lbl[15], lbl2[15];

 

 

 

string Indicator_Name = "MyNotes:" ;

int Objs = 0;

 

//+------------------------------------------------------------------+

int ind_bufferOp[] ;

string shortName ;

// int cpairsLenH;

// int cpairsLenV;

int shortLength;

// int ctimesLen;

// string cpairsh[];

// string cpairsv[];

// int aTimes[];

// string addition = "";

 

//+------------------------------------------------------------------+

int init(){

 

period = Period() ;

 

tChartPeriod = TimeFrameToString(period) ;

symbol = Symbol() ;

digits = Digits ;

point = Point ;

ShortName = tChartPeriod + "MyNotes" ;

win = 1 ;

 

if(digits == 5 || digits == 3) { digits2 = 0 ; point = point * 10 ; } else { digits2 = 0 ; }

 

 

shortName = ShortName ;

shortLength = StringLen(shortName);

IndicatorShortName(shortName);

 

deinit() ;

DoHelp () ;

 

 

return(0);

}

 

//+------------------------------------------------------------------+

int deinit()

{

//----

 

 

//increment 11 by one for each note added

for( int h = 0 ; h < 11 ; h++ )

{

ObjectDelete("aHelp"+h) ;

}

 

//----

return(0);

}

 

//+------------------------------------------------------------------+

int start()

{

 

 

 

WindowRedraw() ;

 

 

return(0);

}

//+------------------------------------------------------------------+

string TimeFrameToString(int tf)

{

string tfs;

switch(tf) {

case PERIOD_M1: tfs="M1" ; break;

case PERIOD_M5: tfs="M5" ; break;

case PERIOD_M15: tfs="M15" ; break;

case PERIOD_M30: tfs="M30" ; break;

case PERIOD_H1: tfs="H1" ; break;

case PERIOD_H4: tfs="H4" ; break;

case PERIOD_D1: tfs="D1" ; break;

case PERIOD_W1: tfs="W1" ; break;

case PERIOD_MN1: tfs="MN";

}

return(tfs);

}

 

 

//+------------------------------------------------------------------+

 

 

 

void DoHelp()

{

 

//increment 11 by one

string aHelp[11];

 

//increment 11 by one

ArrayResize(aHelp,11) ;

 

aHelp[0] = myNote01 ;

aHelp[1] = myNote02 ;

aHelp[2] = myNote03 ;

aHelp[3] = myNote04 ;

aHelp[4] = myNote05 ;

aHelp[5] = myNote06 ;

aHelp[6] = myNote07 ;

aHelp[7] = myNote08 ;

aHelp[8] = myNote09 ;

aHelp[9] = myNote10 ;

 

//add lines here-increment each number by 1

aHelp[10] = myNote11 ;

 

 

//increment 11 by one for each note added

for( int h = 0 ; h < 11 ; h++ ){

int yAxis = myChartY + myFontSize + myFontSize*h;

int xAxis = myChartX + 10 ;

 

if(aHelp[h] != "") {

drawComment("aHelp"+h,aHelp[h] , xAxis , yAxis , colorComment ) ; }

}

 

}

 

//+------------------------------------------------------------------+

 

void drawComment(string tLabel,string name, int xPos, int yPos ,color Color ){

ObjectCreate(tLabel,23,0,Time[0],PRICE_CLOSE);

ObjectSet(tLabel, OBJPROP_CORNER, myCorner);

ObjectSet(tLabel,OBJPROP_XDISTANCE,xPos);

ObjectSet(tLabel,OBJPROP_YDISTANCE,yPos+Space);

ObjectSetText(tLabel,name,myFontSize,myFont,Color);

Space+=LineSpacing;

}

 

//+------------------------------------------------------------------+

Link to comment
Share on other sites

The code is from an indi called "MyNotes". Somewhere along the line someone had changed the file name (but not the indicator name) from MyNotes (ShortName = tChartPeriod + "MyNotes"). You already have it, so all you need to do is configure the corner, font, font size and desired message etc. to your liking.

 

A tip you might find useful .... I have several of these with pre-prepared "standard" messages to alert me there is a X or Y trade open or something to look for. You need only save each indicator as (something like) Trade - Short Open MyNote.mq4, Trade - Long Open MyNote.mq4, Trade - Monitor MyNote.mq4 etc. I have six charts tiled on my screen so I scan status every little while and go away.

Edited by FxNewbie
Link to comment
Share on other sites

  • 2 months later...

to make a comment in the left hand side of a chart, you should only use Comment(" some text"); and it's not useful to draw by ObjectSet functions.

 

I use this code in my Info() function

 

bool Info() {RefreshRates(); int heure;

if(Hour()!=heure){ heure=Hour(); save();}

 

equitmax=MathMax(equitmax,AccountEquity());

equitmin=MathMin(equitmin, AccountEquity());

if(Hour()==23) zer=true;

if(Hour()==0 && zer) {equitminuit=AccountEquity(); zer=false; Print("Equity at noon=",equitminuit," hour=",TimeToStr(TimeCurrent())); save();}

 

if(IsTesting() && !IsVisualMode()) return(true);

spread=Ask-Bid;

smax=MathMax(smax,spread);

smin=MathMin(smin,spread);

Comment(

"\n "

+ "------------------------------------------------"

+ "\n "

+ "Broker : " + AccountCompany()

+ "\n "

+ "------------------------------------------------"

+ "\n "

+ "Spread : "+ DoubleToStr(spread*tniop,2)+" Spread max : "+ DoubleToStr(smax*tniop,2) +" Spread min : "+ DoubleToStr(smin*tniop,2)

+ "\n "

+ "Gain of the day: "+ DoubleToStr(AccountEquity()-equitminuit,2)+" "+ AccountCurrency()+" Objectif = "+DoubleToStr(objectif,2)+ AccountCurrency()

+ "\n "

+ "Equity : " + DoubleToStr(AccountEquity(), 2)+" "+ AccountCurrency()

+ "\n "

+ "Equity Max : " + DoubleToStr(equitmax, 2)+" "+ AccountCurrency() +" "

+ "Equity Min : "+ DoubleToStr(equitmin, 2)+" "+ AccountCurrency()

+ "\n "

+ "------------------------------------------------"

+"\n "

+ "Lots : "+DoubleToStr(lot,2)

+ "\n "

+ "Server time : " + TimeToStr(TimeCurrent(), TIME_SECONDS)

+ "\n "

+ "------------------------------------------------");

return(true);

 

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...