Removing old support/resistance levels at expiration - page 2

 
deVries:

So what kind of names do the Objects get you want delete at expiretime ???

Give examples i'm not running your program ...... might be if you change the name of the object you can easily use the method i gave

basically, VB is the price level at which the object (obj_trend) is created. The level works as the virtual buy stop level, while the object is used just to illustrate where the level is located. So, when the price breaks above the VB (above the virtual buy stop level) the buy order is sent to the market. So, both the level= VB and the object have the price, the time of creation and time of expiration. It is clear how to remove the expired objects. But the level, in fact the price=VB at the time of object creation=tVB, I guess, must be turned into an array to work with. Why? Because, one never knows how many elements there may be, these price levels are all linked to certain point in time, and one needs to remember those, to check, say, at the beginning of a new bar, if the time has expired, so the level has to be deleted, or the price has broken above the level, then the order is sent to the market for execution. Pls let me know if I came across clearly.
 
13toi:
basically, VB is the price level at which the object (obj_trend) is created. The level works as the virtual buy stop level, while the object is used just to illustrate where the level is located. So, when the price breaks above the VB (above the virtual buy stop level) the buy order is sent to the market. So, both the level= VB and the object have the price, the time of creation and time of expiration. It is clear how to remove the expired objects. But the level, in fact the price=VB at the time of object creation=tVB, I guess, must be turned into an array to work with. Why? Because, one never knows how many elements there may be, these price levels are all linked to certain point in time, and one needs to remember those, to check, say, at the beginning of a new bar, if the time has expired, so the level has to be deleted, or the price has broken above the level, then the order is sent to the market for execution. Pls let me know if I came across clearly.


you're wrong if you think you have to do it with array there are more ways

so don't stuck with your idea and answer my question what names do the objects get

and explain with the name what part of the name is expirytime

because you can work with that

 
deVries:


you're wrong if you think you have to do it with array there are more ways

so don't stuck with your idea and answer my question what names do the objects get

and explain with the name what part of the name is expirytime

because you can work with that

the name of the object consists of: LINE_VB_ is just a string, then space, then current symbol, then space, then current period, space, then time of object creation (tVB), space, time of object expiration (expVB), space, price level of the object (VB);

of course I can change the object name whatever way I like.

name_objectb="LINE_VB_"+" "+Symbol()+" "+Period()+" "+tVB+" "+expVB+" "+VB; 
 
13toi:

the name of the object consists of: LINE_VB_ is just a string, then space, then current symbol, then space, then current period, space, then time of object creation (tVB), space, time of object expiration (expVB), space, price level of the object (VB);

of course I can change the object name whatever way I like.


//of course I can change the object name whatever way I like.

name_objectb="LINE_VB_"+" "+Symbol()+" "+Period()+" "+tVB+" "+expVB+" "+VB; 

do some counting characters how many

  1. "LINE_VB_"
  2. " "
  3. Symbol()
  4. " "
  5. Period()
  6. " "
  7. tVB
  8. " "
  9. expVB
  10. " "
  11. VB
How many characters is Period() if Period() == 5M and what will it be if Period() == 4H

As you can see you make it difficult to find inside your objectname the value of expVB

the value we need to have is expVB where does that value start inside Objectname ??

Make a objectname that it is always starting at same position and objectname is made that way it is easy to select

So how you gonna make it ???

 
deVries:

do some counting characters how many

  1. "LINE_VB_"
  2. " "
  3. Symbol()
  4. " "
  5. Period()
  6. " "
  7. tVB
  8. " "
  9. expVB
  10. " "
  11. VB
How many characters is Period() if Period() == 5M and what will it be if Period() == 4H

As you can see you make it difficult to find inside your objectname the value of expVB

the value we need to have is expVB where does that value start inside Objectname ??

Make a objectname that it is always starting at same position and objectname is made that way it is easy to select

So how you gonna make it ???

I can re-format the object name to the following, but would not the time component of the name grow all the time, so what is now 10 characters, may in 20 days become 11 or so. So, this, in turn, requires that the tVB and expVB are definde as strings, probably, so tat we have always the fixed number of characters.

Like this:

 tVBs=TimeToStr(tVB,TIME_DATE|TIME_SECONDS) and expVBs=TimeToStr(expVB,TIME_DATE|TIME_SECONDS)


  1. "LINE_VB_" 8 char
  2. " " 1 char
  3. tVBs 19 char
  4. " " 1 char
  5. expVBs 19 char
  6. " "
  7. Symbol()
  8. " "
  9. VB
  10. " "
  11. Period()

so if we do it like this, then we can try to apply this for an object:

if(StringSubstr(id,0,6)=="LINE_V")
        {
        Print(StringSubstr(id,30,19);
        if(StrToTime(StringSubstr(id,30,19))<TimeCurrent()))) {ObjectDelete(id)};
        }

but I still can't see how we link the price level=VB to this, especially when we have many of those levels, as those levels are not objects, or are they

 

See my earlier post 1 page back how you search through all your objects

finding objects beginning with same characters

and check then if "expVBs" has to be deleted

13toi:


but I still can't see how we link the price level=VB to this, especially when we have many of those levels, as those levels are not objects, or are they


Go to the chart with your levels

use CTRL+B to see what your Objects are

 
deVries:

See my earlier post 1 page back how you search through all your objects

finding objects beginning with same characters

and check then if "expVBs" has to be deleted


Go to the chart with your levels

use CTRL+B to see what your Objects are


thanks for your input, but, VB is not an object, this is a price level to be remembered by the expert and checked on the start of each new bar until expired. Your suggestion will not work here, unfortunately. There is no way to do what needs to be done without arrays.
 
13toi:

thanks for your input, but, VB is not an object, this is a price level to be remembered by the expert and checked on the start of each new bar until expired. Your suggestion will not work here, unfortunately. There is no way to do what needs to be done without arrays.

if ( (TimeCurrent() > expVB) || (TimeCurrent() >expVS) )
   {
   VS=0; VB=0; ObjectDelete(name_objects); ObjectDelete(name_objectb); return(0);
   }

what does this mean ????

 
deVries:

what does this mean ????

it means that if current time is more than the expiration time set at the virtual buy level, or more than the epiration time set at the virtual sell level, expert does the following:

it sets the value of the virtual buy level to zero, sets the value of the virtual sell level to zero, and it deletes the objects created to illustrate those levels: name_objects for the sell level, name_objectb for the buy level. Those objects we delete now ok, no problem. But the levels must be checked for the whole duration of their lives and set to zero when the time expires. And there can be multiple levels co-existing at any one time.

 
13toi:

it means that if current time is more than the expiration time set at the virtual buy level, or more than the epiration time set at the virtual sell level, expert does the following:

it sets the value of the virtual buy level to zero, sets the value of the virtual sell level to zero, and it deletes the objects created to illustrate those levels: name_objects for the sell level, name_objectb for the buy level. Those objects we delete now ok, no problem. But the levels must be checked for the whole duration of their lives and set to zero when the time expires. And there can be multiple levels co-existing at any one time.


according to me VB and VS are both double so they have both its own unique value

'the duration of live' is over moment (TimeCurrent() > expVB) || (TimeCurrent() >expVS)

or your code is not coded what you want....