ZigZag Data Export  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
bryanzim
Posts: 36
Joined: 26 Mar 2013
Has thanked: 5 times
Been thanked: 3 times

ZigZag Data Export

Postby bryanzim » 30 Apr 2013

I would like to export the swing highs/lows of the ZigZag indicators. When I add it to the chart and say File->Export the indicator values are not exported with the Instrument data.

Is there a way to export this indicator data, or does the indicator need to be modified to enable this function?

Thanks

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: ZigZag Data Export

Postby Henry MultiСharts » 01 May 2013

Hello bryanzim,

In order to be able to export study values-your study should be calculated and results should be plotted on your chart. Study code requires no changes to utilize this feature.

Please make sure you have study plots on the chart and the option "Export values for indicators based on symbol" in File->Export Data is checked.

bryanzim
Posts: 36
Joined: 26 Mar 2013
Has thanked: 5 times
Been thanked: 3 times

Re: ZigZag Data Export

Postby bryanzim » 01 May 2013

Dear Henry,

The indicator was added to the chart and showed the appropriate lines indicating it was functioning. I also had the "Export values for indicators based on symbol" checked. However all the was exported in the CSV file was the instrument data, i.e. Date, Time, High, Low, Close, Volume but no indicator values.

FYI, I was using the ZigZagPnts indicator.

Thanks,
Bryan Z

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: ZigZag Data Export

Postby Henry MultiСharts » 01 May 2013

bryanzim,

Please replicate this behavior with one of the prebuilt indicators.
Attach the workspace you are using.
Specify the version and build number of MultiCharts are you using (Help -> About MultiCharts).

bryanzim
Posts: 36
Joined: 26 Mar 2013
Has thanked: 5 times
Been thanked: 3 times

Re: ZigZag Data Export

Postby bryanzim » 01 May 2013

The attached workspace file contains the YM# chart with two indicators, the moveing average 1 and the zigzag_pnts. I also included what is exported by turning each indicator on.

I am using Multicharts.NET 64 V8.5.6862

Thanks
Attachments
Desktop.zip
(42.95 KiB) Downloaded 338 times

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: ZigZag Data Export

Postby Henry MultiСharts » 01 May 2013

bryanzim,

zigzag_pnts indicator creates trendlines on the chart. Trendline values are not written into the text file when you go to File->Export data. Only plots are written with this feature.
You can use File class to write out the values you need into a text file. Here is "How to" guide.

bryanzim
Posts: 36
Joined: 26 Mar 2013
Has thanked: 5 times
Been thanked: 3 times

Re: ZigZag Data Export

Postby bryanzim » 01 May 2013

Henry,

Thank you for the clarification that only plots get exported, I will create a new indicator based off of ZigZag and use the File class capability.

bryanzim
Posts: 36
Joined: 26 Mar 2013
Has thanked: 5 times
Been thanked: 3 times

Re: ZigZag Data Export

Postby bryanzim » 04 May 2013

I was able to get the data to export but ran into a peculiar problem.

If I wrote the code in CalcBar() as follows

Code: Select all


if (OutputTextFile != null)
{
StreamWriter swFile = new StreamWriter(OutputTextFile, true);
swFile.WriteLine(m_swingtime[1] + "," + m_swingprice[1]);
swFile.Close();
}
It would work.

But if I wrote CalcBar() by splitting up the operations such as

Code: Select all

StreamWriter swFile=null;
if (OutputTextFile != null)
{
swFile = new StreamWriter(OutputTextFile, true);
}

...

if (OutputTextFile != null)
{
swFile.WriteLine(m_swingtime[1] + "," + m_swingprice[1]);
swFile.Close();
}
I would get exceptions that the file was opened in another process. Is this expected or does some special locking need to be implemented.

Thanks

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: ZigZag Data Export

Postby Henry MultiСharts » 06 May 2013

I was able to get the data to export but ran into a peculiar problem.

If I wrote the code in CalcBar() as follows

Code: Select all


if (OutputTextFile != null)
{
StreamWriter swFile = new StreamWriter(OutputTextFile, true);
swFile.WriteLine(m_swingtime[1] + "," + m_swingprice[1]);
swFile.Close();
}
It would work.

But if I wrote CalcBar() by splitting up the operations such as

Code: Select all

StreamWriter swFile=null;
if (OutputTextFile != null)
{
swFile = new StreamWriter(OutputTextFile, true);
}

...

if (OutputTextFile != null)
{
swFile.WriteLine(m_swingtime[1] + "," + m_swingprice[1]);
swFile.Close();
}
I would get exceptions that the file was opened in another process. Is this expected or does some special locking need to be implemented.

Thanks
Hello bryanzim,

Do you have this problem during optimization process?

bryanzim
Posts: 36
Joined: 26 Mar 2013
Has thanked: 5 times
Been thanked: 3 times

Re: ZigZag Data Export

Postby bryanzim » 06 May 2013

I am having this problem just by applying indicator to chart and haven't tried optimization process.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: ZigZag Data Export

Postby Henry MultiСharts » 06 May 2013

Do you apply the same study to multiple charts at the same time?

bryanzim
Posts: 36
Joined: 26 Mar 2013
Has thanked: 5 times
Been thanked: 3 times

Re: ZigZag Data Export

Postby bryanzim » 06 May 2013

No sir. This was a single study on a single chart.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: ZigZag Data Export

Postby Henry MultiСharts » 06 May 2013

bryanzim, please change your code condition from

Code: Select all

if (OutputTextFile != null)
{ ... }
to:

Code: Select all

if (swFile != null)
{ .... }

bryanzim
Posts: 36
Joined: 26 Mar 2013
Has thanked: 5 times
Been thanked: 3 times

Re: ZigZag Data Export

Postby bryanzim » 06 May 2013

Here is the indicator changed as requested as well as the error produced if the file is not closed after each access.

Thanks
Attachments
Desktop.zip
(133.11 KiB) Downloaded 317 times

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: ZigZag Data Export  [SOLVED]

Postby Henry MultiСharts » 07 May 2013

Hello bryanzim,

Please find the code fixed by our developer attached.
Attachments
ZigZag_Export_Pnts.pln
(2.06 KiB) Downloaded 712 times

bryanzim
Posts: 36
Joined: 26 Mar 2013
Has thanked: 5 times
Been thanked: 3 times

Re: ZigZag Data Export

Postby bryanzim » 07 May 2013

Hello bryanzim,

Please find the code fixed by our developer attached.
Henry,

Thank your developer for the corrected code. It now works as expected.

Bryan


Return to “MultiCharts .NET”