Hello.
So I am having an issue with strings in graphical objects. My understanding is that only ONE graphical object can exist on the screen that has a SPECIFIC NAME.
So for example, let's say that every bar, you print a dot at the top of the each new bar, and the string you assign to it is simply the word "dot", then there will only ever be one item on the screen at a time as you are continually over-writing the last dot you drew. If you wanted a dot on every bar, adding Time[0] to that string name would allow multiple dots on the screen.
The above is correct right?
I have an indie that I am having an issue with. The indie essentially takes the volume for each bar and adds that volume to the close price. The close price and volume are adding to two separate arrays. It is a histogram that counts the volume at each price level.
On each new bar I have a function that draws a histogram from the daily open to the current bar. As I am updating the arrays on each new bar, the histogram is redrawn each time, i.e., I loop through the two arrays and redraw the histogram which is just represented by various horizontal lines of varying lengths.
My idea, is that I would assign the time of the Daily Open bar(since that is a unique identifier since I want each day to have) + the Price level... This should give me a unique identifier for each price level(on the day), and simply erase the old one if the length of the line changes(in the case that volume is added to the same price).
To do this, I should be able to use:
In the above, this sits inside of a loop that loops through the array, and draws each line. The important part is the 'ObjName'. The idea, as can be seen from the attached picture, that I am assigning the openBars time, along with the price level, and should give me unique identifiers for each price level drawn for each session.
However, this does not draw every line. If you install the indicator, the value with the most volume should span the entire width of the session.
What I can do that works, is change the strong objName to use the identifier for each bar on the chart(index), plus the number in the array(i). THEN this works, but it draws a bunch of redundant, unecessary lines, as instead of overwriting the bar at a given price, it just draws a new line on top of the prior one:
My question is, is there something obvious I'm missing about naming graphical objects?
So I am having an issue with strings in graphical objects. My understanding is that only ONE graphical object can exist on the screen that has a SPECIFIC NAME.
So for example, let's say that every bar, you print a dot at the top of the each new bar, and the string you assign to it is simply the word "dot", then there will only ever be one item on the screen at a time as you are continually over-writing the last dot you drew. If you wanted a dot on every bar, adding Time[0] to that string name would allow multiple dots on the screen.
The above is correct right?
I have an indie that I am having an issue with. The indie essentially takes the volume for each bar and adds that volume to the close price. The close price and volume are adding to two separate arrays. It is a histogram that counts the volume at each price level.
On each new bar I have a function that draws a histogram from the daily open to the current bar. As I am updating the arrays on each new bar, the histogram is redrawn each time, i.e., I loop through the two arrays and redraw the histogram which is just represented by various horizontal lines of varying lengths.
My idea, is that I would assign the time of the Daily Open bar(since that is a unique identifier since I want each day to have) + the Price level... This should give me a unique identifier for each price level(on the day), and simply erase the old one if the length of the line changes(in the case that volume is added to the same price).
To do this, I should be able to use:
Inserted Code
string objName =StringConcatenate("mStats ",TimeToStr(Time[openBar])," ",PxpPrices[i]); ObjectCreate(objName,OBJ_TREND,0,Time[openBar+1],PxpPrices[i],Time[openBar+1-x2],PxpPrices[i]); ObjectSet(objName,OBJPROP_RAY,0); ObjectSet(objName,OBJPROP_COLOR,Yellow)
In the above, this sits inside of a loop that loops through the array, and draws each line. The important part is the 'ObjName'. The idea, as can be seen from the attached picture, that I am assigning the openBars time, along with the price level, and should give me unique identifiers for each price level drawn for each session.
However, this does not draw every line. If you install the indicator, the value with the most volume should span the entire width of the session.
What I can do that works, is change the strong objName to use the identifier for each bar on the chart(index), plus the number in the array(i). THEN this works, but it draws a bunch of redundant, unecessary lines, as instead of overwriting the bar at a given price, it just draws a new line on top of the prior one:
Inserted Code
string objName =StringConcatenate("mStats ",TimeToStr(Time[openBar])," ",index," ",i);
My question is, is there something obvious I'm missing about naming graphical objects?
Attached File(s)
Pelt_MarketStats_Daily_v1.2.mq4
11 KB
|
196 downloads