Eugene / Robert,
Is there any way to convert a Synthetic Symbol (5 DataSeries) into a Bars Object?
I found the "PlotSyntheticSymbol" method for plotting but there are some indicators (like CCI) that I would like to use on a Synthetic Symbol but they require the Bars Object.
Thanks.
Size:
Color:
Roy,
Check out the QuickRef example for Bars.SaveToFile.
Size:
Color:
Eugene,
That did the job. Thank you.
Roy
Size:
Color:
This is related to this topic, but definitely has a different cause / solution.
I hacked the QuickRef Bars.SaveToFile code to create a synthetic symbol and it worked as far as that code went. I now want to make it into a real WL symbol and ran the available code to export to ASCII, and then import to a new DataSet using built-in WL feature to create ASCII dataset. I have a problem with the date field which displays in the CSV file as "20190415" and throws an error. PrintDebug output from the SavetoFile code shows '4/15/2019 12:00:00 AM" Is it getting converted by the Exporter code or is there a setting ro code I have to change? I am not able to change the format in Excel and save back to CSV. I'm sure I could write an Excel script to do that, but I suspect that should not be necessary.
Once I get past this hurdle I'.m unclear what I do with the new .WL file. Do I physically move the resulting .WL file into ASCII folder or does it put it there automatically)? Will I be able to use the synthetic symbol in a backtest without using LoadFromFile?
Size:
Color:
Size:
Color:
Hi Eugene,
Here's where I got lost, and somewhat still am. In the post you referenced above, thread #2, you have an update, which appears to be an alternative to the suggested method. It under the heading "An even easier alternative" and has a link to Data | Exporting data out of WL6 to ASCII and binary files, which is how I found out about the export code.
Since I have already successfully completed the "easier alternative" and created a native .WL file (albeit on my C:/ drive), why do I need to regress to these previous steps? Or is this code for a use case that that doesn't apply to what I want to do, which is have a synthetic symbol look like any other symbol to WL?
I got involved with the ASCII conversion activity because I didn't know what to do with the .WL file that the export code put on my C: drive, whether to drop it into a data folder or where else to put it. Don't know how to make it accessible to a WL backtest. Or is this export code method only applicable if you plan to use LoadFromFile in the strategy code (as you did in the export sample code to test the process by charting it).?
Robert
Size:
Color:
"An even easier alternative" referred to creating a native WL version 3/4 .WL file. These were old days of WL. Neither the WL4Files provider is part of our latest installations nor the Wiki instructs how to export to that outdated binary .WL file format (pre-WL6) any longer. We have turned this page. I'm not sure but you may be confusing the ASCII export on the Wiki page with that "easier alternative", now hardly available.
That's why it says at the
bottom of the page:
<<Exporting as WLD 3/4 native binaries (*.WL)
WL3/4 support has ended. Protected content. >>
Use SaveToFile to save in the WL6 native format (.WL), then please refer to the walkthrough in post #2 in the
forum discussion. It's a hackish,
unsupported workaround which may be cumbersome to set up but you do it once. Remember that
WL does not officially support "making a synthetic symbol into a real WL symbol" so you should find all answers in the forum topic.
Size:
Color:
Thanks, Eugene for clearing that up. I think I see there are two different things that I conflated. It sounds like I have to start at step 1 of post # 2.
Does that mean I have to change
CODE:
Please log in to see this code.
to
CODE:
Please log in to see this code.
before running the SaveToFile sample code from QickRef because I need a 1 minute file? When I make that change that I am getting run time error "Divide by zero" which I have yet to troubleshoot.
Since the post #2 sounds like it's outdated, then it appears Fidelity is the only current provider that I can use for 1 min Dataset. Is that true and does my source symbol also has to be 1 min?
Since I have gone down a path that is unsupported, is using LoadFromFile a better option to using the synthetic symbol in a Backtest? Should the code for this function in the QuickRef for the Bars object suffice as a starting point for what I am trying to do? In that code example would I simply use a structure like bars.close[bar] to reference the value of the synthetic in my main loop,after creating the Bars bars = new Bars (...) object?
Whatever approach you recommend, I want to be able to trade this synthetic symbol in backtest so WL can calculate performance.
Robert
Size:
Color:
QUOTE:
Does that mean I have to change...
"Unsupported" implies that you're free to experiment with it completely on your own, by trial and error, using information already available in the forum posts.
QUOTE:
Should the code for this function in the QuickRef for the Bars object suffice as a starting point for what I am trying to do?
I'm fine with whatever approach works for you. Please refer to the QuickRef and decide for yourself if LoadFromFile() is sufficient.
Size:
Color:
Hi Eugene,
I still am unclear whether it is possible to *trade* a synthetic symbol. All the examples / posts I found for LoadFromFile use the loaded data to plot, not transact.
I experimented to understand how I might be able to trade a synthetic symbol modifying the QuickRef code and using SetContext() :
CODE:
Please log in to see this code.
But it gives me an error "Invalid Benchmark Buy and Hold Symbol". I can buy the clicked symbol (without using SetContext), but not the one that was loaded. Don't understand why SetContext() is affecting B&H.
Can you please let me know if I trying to do something that is even possible and if it is, point me in a more productive direction?
Thanks,
Robert
Size:
Color:
CODE:
Please log in to see this code.
is for a REAL symbol
NewBars which exists in a DataSet. In your case the syntax is
CODE:
Please log in to see this code.
P.S. As for the error, having encountered it (or another error message or an issue), please always check out these pages:
1.
Known Errors2.
Open IssuesAs you'll find several suggestions in "Known Errors", let's stay on topic here.
Size:
Color:
Wow. Awesome. I am able to trade the synthetic.Thank you, Eugene!
Robert
Size:
Color:
You're welcome!
Size:
Color: