- ago
I am trying to move a WL6 script to WL8. It is a very simple script to open a Word file for the symbol clicked. If the file does not exist, this will create a new formatted file. I am not finding "Process". Can someone give me a hand?
CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Data; using WealthLab.Indicators; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using System.Diagnostics; using System.IO; namespace WealthScript8 { public class MyStrategy : UserStrategyBase { //create indicators and other objects here, this is executed prior to the main trading loop public override void Initialize(BarHistory bars) {          try          {             Process.Start(@"C:\DataBus\Stock Information History\" + bars.Symbol + ".doc");          }          catch          {             File.Copy(@"C:\DataBus\Stock Information History\AAAAFormat.doc", @"C:\DataBus\Stock Information History\" + bars.Symbol + ".doc");             Process.Start(@"C:\DataBus\Stock Information History\" + bars.Symbol + ".doc");          } } //execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int idx) { if (!HasOpenPosition(bars, PositionType.Long)) { //code your buy conditions here } else { //code your sell conditions here } } //declare private variables below } }
0
192
3 Replies

Reply

Bookmark

Sort
Cone8
 ( 2.67% )
- ago
#1
That probably requires Reference to System.Diagnostics.Process and maybe also System.ComponentModel.Primitives
0
Cone8
 ( 2.67% )
- ago
#2
Oh wait, you said, Word? Then you're missing more than that. Ask ChatGPT to give you a C# snippet example of how to open a Word document.
0
- ago
#3
In WL8, pick menu item Tools -> Assembly References. In the Assembly References window check the following assemblies:

System.ComponentModel.Primitives
System.Diagnostics.Process
0

Reply

Bookmark

Sort