QBJ_HLINE second point in the future?!

 

Hi,

I want to draw an horizontal line which is only valid for the actual day. What do I have to write for ??????

ObjectCreate(name,OBJ_HLINE,0,Time[0],high,?????,high);

 

Oh I see . . mis-read your post . .

Horizontal line has just one parameter though . . price value.

Do you want a TrendLine instead ? OBJ_TREND

 

You can calculate the time yourself.

iTime(Symbol(),PERIOD_D1,0)+ 24 hours

// add, you have to use a Trend line for that

 
RaptorUK:

Oh I see . . mis-read your post . .

Horizontal line has just one parameter though . . price value.

Do you want a TrendLine instead ? OBJ_TREND

Try . . .

Edit: if you want it just for today . . .

ObjectCreate(name,OBJ_TREND,0,(StringConcatenate("D'",Year(),".",Month(),".",Day()," 00:00'")),high,(StringConcatenate("D'",Year(),".",Month(),".",Day()," 23:59'")),high);

ObjectSet(name,OBJPROP_RAY, false);
 
You probably need to use StrToTime on the date/times
 
No need for all that string stuff. just manipulate time
datetime now = Time[0],
         bod = now - now % 86400, // now==bod only on D1
         eod = bod + 86399;
Tline(name, bod, price, eod, price /*, aColor*/);

------------------------------
//++++ These are adjusted for 5 digit brokers.
int     pips2points;    // slippage  3 pips    3=points    30=points
double  pips2dbl;       // Stoploss 15 pips    0.0015      0.00150
int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
int     init(){
    if (Digits == 5 || Digits == 3){    // Adjust for five (5) digit brokers.
                pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
    } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
    // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
}
void TLine( string name, datetime T0, double P0, datetime T1, double P1
          , color clr, bool ray=false ){                #define WINDOW_MAIN 0
    if (!Show.Objects)  return;
    /**/ if(ObjectMove( name, 0, T0, P0 ))      ObjectMove(name, 1, T1, P1);
    else if(!ObjectCreate( name, OBJ_TREND, WINDOW_MAIN, T0, P0, T1, P1 ))
        Alert("ObjectCreate(",name,",TREND) failed: ", GetLastError() );
    else if (!ObjectSet( name, OBJPROP_RAY, ray ))
        Alert("ObjectSet(", name, ",Ray) failed: ", GetLastError());
    if (!ObjectSet(name, OBJPROP_COLOR, clr )) // Allow color change
        Alert("ObjectSet(", name, ",Color) [2] failed: ", GetLastError());
    string  P0t = PriceToStr(P0);           if (MathAbs(P0 - P1) >= Point)
            P0t = StringConcatenate(P0t, " to ", PriceToStr(P1));
    if (!ObjectSetText(name, P0t, 10))
        Alert("ObjectSetText(",name,") [2] failed: ", GetLastError());
}
string  PriceToStr(double p){
    string pFrc = DoubleToStr(p, Digits);       if(Digits.pips==0) return(pFrc);
    string pPip = DoubleToStr(p, Digits-1);
    if (pPip+"0" == pFrc)       return(pPip);           return(pFrc);          }
 
WHRoeder:
just manipulate time
Need to be a Time Lord to manipulate Time, I'm not that proficient yet ;-)
Reason: