Is it possible to copy an image of an existing graphic (histogram in this case) from one area within the chart, and paste it into a different area? If I could do this, I could display histograms for 5 or 6 bars on a chart.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Copy and Paste an Image
Collapse
X
-
Copy and Paste an Image
I have a script that creates a histogram of volume within the last bar of data. I know how to position and scale it in the chart window. When a new bar opens, the old histogram is wiped out and a new one starts building.
Is it possible to copy an image of an existing graphic (histogram in this case) from one area within the chart, and paste it into a different area? If I could do this, I could display histograms for 5 or 6 bars on a chart.Tags: None
-
There is a better alternative to accomplish what I want to do. If I can save the volume information for a bar so that it will not be destroyed when the new bar begins, I can draw the "old" histogram in a new location.
My script is a modification of the NinjaScript Indicator "Volume Profile" The information I need seems to reside in a "thing" (sorry, I have not yet grasped the correct terminology for this language) called VolumeInfo, which (in language I do understand) is an array of cumulative tick data that I re-initialize at the start of a new bar using
and which gets updated on new ticks at a line in the original codeif(FirstTickOfBar) volumeInfo = new SortedDictionary<double, VolumeInfoItem>();
The length of the array appears to be "volumeInfo.Count", which can increase as new data arrives, and the elements of the array are price, and the accumulated three volumes volumeInfoItem.up, volumeInfoItem.down, and volumeInfoItem.neutral obtained by incrementing VolumeInfoItem() at each new tick.if (!volumeInfo.ContainsKey(price))
volumeInfo.Add(price, new VolumeInfoItem());
What I think I need is to create a copy of VolumeInfo after each update so that it is still available after a new bar starts.
What I do not know is how to create the array that is a copy of VolumeInfo.
Hope somebody can helpLast edited by HNWtrader; 06-03-2010, 12:54 PM.
Comment
-
It turns out there is a simple way to copy the array. In the original code you find
One or more lines need to be added here to make it#region Variables
internal class VolumeInfoItem
{
public double up = 0;
public double down = 0;
public double neutral = 0;
.
.
.
private SortedDictionary<double, VolumeInfoItem>
volumeInfo = new SortedDictionary<double, VolumeInfoItem>();
#endregion
Then in OnBarUpdate() you need something like the following to shift the array data from one array to another and then initialize a new array#region Variables
internal class VolumeInfoItem
{
public double up = 0;
public double down = 0;
public double neutral = 0;
.
.
.
private SortedDictionary<double, VolumeInfoItem>
volumeInfo = new SortedDictionary<double, VolumeInfoItem>();
private SortedDictionary<double, VolumeInfoItem>
volumeInfo2 = new SortedDictionary<double, VolumeInfoItem>();
private SortedDictionary<double, VolumeInfoItem>
volumeInfo3 = new SortedDictionary<double, VolumeInfoItem>();
private SortedDictionary<double, VolumeInfoItem>
volumeInfo4 = new SortedDictionary<double, VolumeInfoItem>();
#endregion
protected override void OnBarUpdate()
.
.
if(FirstTickOfBar)
{
volumeInfo4 = volumeInfo3;
volumeInfo3 = volumeInfo2;
volumeInfo2 = volumeInfo;
volumeInfo = new SortedDictionary<double, VolumeInfoItem>();
}
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
574 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
332 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
553 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment