How to Draw a Reference Lines Every 10 Pips - page 2

 

Of course! It's just time. And all we have to do is add time to Time[0] to make the rectangle extend out into the future (off the right-hand side of the chart). Thanks. By the way, I found that the left-hand side by simply using Bars.

datetime timeGap = (Time[0] - Time[1]); // get the amount of time between bars
ObjectSet("tensRec"+ix,OBJPROP_TIME2,Time[0] + (timeGap*150)); // multiplying timeGap by 150 seems to extend the rectangle off the right-hand window edge

The color I'm using is very subtle. You almost have to look for the rectangles to see them.

ObjectSet("tensRec"+ix,OBJPROP_COLOR,0x080808) 
 
MisterDog:

Of course! It's just time. And all we have to do is add time to Time[0] to make the rectangle extend out into the future (off the right-hand side of the chart). Thanks. By the way, I found that the left-hand side by simply using Bars.

The color I'm using is very subtle. You almost have to look for the rectangles to see them.

Hi MisterDog,

May we see the pics ?,

On Monday Time[0] is on Monday while Time [1] is on Saturday - that's the gap on Monday ;).

:D

 

I'm guessing that since I run a one minute chart that what You're talking about will take care of itself in one minute. I guess we well see what happens over the weekend.

Here's the pic.

 
onewithzachy:

Hi MisterDog,

Simple.

1. Get the time distance between one bar to another. We can get this by subtracting current bar time with previous bar time or multiplying period with 60 second, choose the latter one, coz there's time gap on Monday.

I have no time gap on Monday, my first bar of the week starts on Sunday ;-)

Why not add PERIOD_W1 * 60 to the end time ? that should just about cover any gaps . .. ;-)

 
MisterDog:

The color I'm using is very subtle. You almost have to look for the rectangles to see them.

Now I "see" what you meant.

RaptorUK

I have no time gap on Monday, my first bar of the week starts on Sunday ;-)

Why not add PERIOD_W1 * 60 to the end time ? that should just about cover any gaps . .. ;-)

You have gap on Sunday then ;).

 
  1. MisterDog:
    Tell me, is there way to use some sort of a "wildcard" for things like the ObjectDelete? I would like to do something like this, ObjectDelete("tensLines"*); in other words, delete anything that starts with "tensLines".
    #define ONDA_BEGINS   0
    #define ONDA_CONTAINS 1
    void ObjectNameDeleteAll(string name, int where=ONDA_BEGINS, int type=EMPTY){
        for(int iObj=ObjectsTotal()-1; iObj >= 0; iObj--){
            string on   = ObjectName(iObj);
            int    iPos = StringFind(on, name);
            if (iPos < 0)                         continue;
            if (iPos > 0 && where == ONDA_BEGINS) continue;
            if      (type == EMPTY))         ObjectDelete(on);
            else if (type == ObjectType(on)) ObjectDelete(on);
        }
    }
    
    Not compiled, not tested.

  2. Also there's no reason to delete them, just move them to the new position. From my code:
    void Rect(string name, datetime T0,double P0, datetime T1,double P1, color clr){
        if (!Show.Objects)  return;                         #define WINDOW_MAIN 0
        if      (ObjectMove( name, 0, T0, P0 ))     ObjectMove(name, 1, T1, P1);
        else if (!ObjectCreate( name, OBJ_RECTANGLE, WINDOW_MAIN, T0, P0, T1, P1 ))
            Alert("ObjectCreate(",name,",RECT) failed: ", GetLastError() );
        if (!ObjectSet(name, OBJPROP_COLOR, clr )) // Allow color change
            Alert("ObjectSet(", name, ",Color) [3] 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,") [1] failed: ", GetLastError());
    }
    

  3. RaptorUK:
    Why not add PERIOD_W1 * 60 to the end time ? that should just about cover any gaps . .. ;-)
    Why not just project the rectangle all the way into the future?
    #define INF 0x6FFFFFFF // Not quite infinite, Jul 2029, or 1,879,048,191
    ObjectSet("tensRec"+ix,OBJPROP_TIME2,INF);
 
WHRoeder:
Why not just project the rectangle all the way into the future?

Thank you very much WHRoeder. I'll take it :D

[ EDIT : So, anyhow, many thankssssssssssss ]

 
WHRoeder:
  1. RaptorUK:
    Why not add PERIOD_W1 * 60 to the end time ? that should just about cover any gaps . .. ;-)
    Why not just project the rectangle all the way into the future?
I didn't want to be greedy ;-)
 
RaptorUK:
I didn't want to be greedy ;-)
Greed Is Good, you know ;)
 
onewithzachy:
Greed Is Good, you know ;)
I have learned the hard way that Greed is most certainly a very, very bad thing. ;-)