mql4 help

Moderator: moderators

User avatar
forexjake80
rank: 50+ posts
rank: 50+ posts
Posts: 137
Joined: Sun Nov 15, 2009 12:20 pm
Reputation: 0
Gender: Male

mql4 help

Postby forexjake80 » Mon Nov 28, 2011 2:29 pm

I wanna draw a horizontal line in a given time period... can anyone help me with that? Best thing i could come up with so far is a OBJ_TREND with 2x the same price.
It's time to kick ass and chew bubble gum. And I'm all out of gum.

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

Relativity
rank: 150+ posts
rank: 150+ posts
Posts: 364
Joined: Mon Nov 15, 2010 4:19 pm
Reputation: 0
Gender: None specified

Postby Relativity » Mon Nov 28, 2011 3:53 pm

Take this :

void DrawHLine(string objname,string objLabel, double LinePrice, color LineColor, int styleno, datetime myStartTime,datetime myEndTime, int thicknessCtrl, int RayCtrl)
{
string linename = objname+"HLine";
string lblname = objname+"HLineLbl";

ObjectDelete(linename);
ObjectCreate(linename, OBJ_TREND, 0, myStartTime, LinePrice, myEndTime, LinePrice);
ObjectSet(linename, OBJPROP_COLOR, LineColor );
ObjectSet(linename, OBJPROP_RAY, RayCtrl );
ObjectSet(linename, OBJPROP_WIDTH, thicknessCtrl );
ObjectSet(linename,OBJPROP_STYLE,styleno);

ObjectDelete(lblname);
ObjectCreate(lblname, OBJ_TEXT, 0, myEndTime + (myStartTime-myEndTime)/2, LinePrice);
ObjectSetText(lblname, objLabel, myFontSize, myFont, LineColor);
}


Usage Example :
DrawHLine("PsychLine"," Psych Line ", PsychLinePrice, PsychLineColor, 0 , Time[1000],Time[0],1,0);

User avatar
forexjake80
rank: 50+ posts
rank: 50+ posts
Posts: 137
Joined: Sun Nov 15, 2009 12:20 pm
Reputation: 0
Gender: Male

Postby forexjake80 » Mon Nov 28, 2011 6:40 pm

ahhhhhhhh.... OBJPROP_RAY gotta be false.... thanks Rel!!
It's time to kick ass and chew bubble gum. And I'm all out of gum.

Relativity
rank: 150+ posts
rank: 150+ posts
Posts: 364
Joined: Mon Nov 15, 2010 4:19 pm
Reputation: 0
Gender: None specified

Postby Relativity » Mon Nov 28, 2011 10:34 pm

no probs!

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.


Return to “MetaTrader”