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
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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
if(FirstTickOfBar) volumeInfo = new SortedDictionary<double, VolumeInfoItem>();
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
#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
#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 aussugardefender, Today, 01:07 AM
|
0 responses
3 views
0 likes
|
Last Post Today, 01:07 AM | ||
Started by pvincent, 06-23-2022, 12:53 PM
|
14 responses
238 views
0 likes
|
Last Post
by Nyman
Today, 12:47 AM
|
||
Started by TraderG23, 12-08-2023, 07:56 AM
|
9 responses
384 views
1 like
|
Last Post
by Gavini
Today, 12:29 AM
|
||
Started by oviejo, Today, 12:28 AM
|
0 responses
4 views
0 likes
|
Last Post
by oviejo
Today, 12:28 AM
|
||
Started by pechtri, 06-22-2023, 02:31 AM
|
10 responses
125 views
0 likes
|
Last Post Today, 12:03 AM |
Comment