"Historical Trades: No Coding" works inside Strategy Window but errors on SM
Author: Sarath1
Creation Date: 6/18/2020 7:29 AM
profile picture

Sarath1

#1

It works great of this strategy "Historical Trades: No Coding" inside Strategy Window reading Historical trades from the given CSV file and triggers both Trades and also New Alerts for exit strategies as designed on them.

The issue/errors seen only when try to run using "Strategy Monitor" and please find below the details,

To keep it very simple of my Sample code, I just kept the same Code as same downloaded from "Historical Trades: No Coding" strategy of @KGo and only added below Exit-strategy line to the end of it just before the comment "// end execute"
CODE:
Please log in to see this code.




symbols: PLAY
data range: 5 months
position sizing: Override in script


Below SM error log,
QUOTE:
6/18/2020 12:03:42 AM: Run Once beginning ...
6/18/2020 12:03:42 AM: RunNow Processing Beginning
6/18/2020 12:03:42 AM: Preparing for initial Data Population
6/18/2020 12:03:42 AM: Starting Populate Thread
6/18/2020 12:03:42 AM: In Populate Thread
6/18/2020 12:03:42 AM: Populating: X_DS_Play
6/18/2020 12:03:42 AM: Updating: X_DS_Play
6/18/2020 12:03:42 AM: Symbols already up to date: PLAY
6/18/2020 12:03:42 AM: Symbols already up to date: PLAY
6/18/2020 12:03:42 AM: Loading Data for PLAY
6/18/2020 12:03:42 AM: 104 bars returned
6/18/2020 12:03:42 AM: Creating Executor
6/18/2020 12:03:42 AM: Executing: PLAY
6/18/2020 12:03:42 AM: Error(4): Object reference not set to an instance of an object.
6/18/2020 12:03:42 AM: Run Once Processing Completed
6/18/2020 12:03:42 AM: Run Now Ended
6/18/2020 12:03:42 AM: Leaving Populate Thread



>> CSV input file for Historical Trades,
QUOTE:
DEFAULT,~EnterAt:SDP,~ExitAt:SDP,~Print:All,~Transfers:off,~%Equity:,~EntryName:,~ShowPositionLine:On,~TransPhrases:distr:tax paid:royalty:in leiu:fee charged
History: BROKERAGELINK (xxxxxxxxx)
From: 01/01/2020
To: 06/12/2020
All Activity
06/12/2020 05:07:07 AM ET

"Date","Description","Symbol","Quantity","Price","Amount","Commission","Fees","Type"
"05/14/2020","YOU BOUGHT","PLAY","100","$9.565","$-956.50","$0.00","$0.00","Cash"
profile picture

Eugene

#2
The way the error is positioned in the log suggests that it happens right during the script execution phase (as opposed to data collection, bars processing and cache tasks):

QUOTE:
6/18/2020 12:03:42 AM: Executing: PLAY
6/18/2020 12:03:42 AM: Error(4): Object reference not set to an instance of an object.


It's not Wealth-Lab's problem. I leave anything "Historical Trades" to its respected author KGo. If he doesn't have hints for you, consider troubleshooting your WL strategy under Visual Studio's debugger:

How can I debug my trading strategies in Wealth-Lab?

profile picture

KGo

#3
You have a csv format error. The DEFAULT setup instruction takes no commas between the terms. All that text is one token that uses it's own ~ as a separator. Spaces are ok before the ~ to make it more readable. Use this as posted previously.
QUOTE:
DEFAULT ~EnterAt:SDP ~ExitAt:SDP ~Print:All ~Transfers:off ~Symbol:NOSub:FDRXX=SKIPIT ~%Equity: ~EntryName: ~ShowPositionLine:On ~TransPhrases:distr : tax paid :royalty: in leiu:fee charged


The signal name will start with Price: when the order is taken at the price given (SDP is Same Day Price). It started with Open: indicating the trade was taken at the open and the ~EnterAt:SDP instruction was not used because of the extra commas.

profile picture

Sarath1

#4
Sure & Thanks @Eugene and @KGo for your analysis & inputs.
Though changing DEFAULT setup instruction per above not actually helping for SM errors, but overall in this interactions with community on this Forum, I understood using StrategyMonitor(SM) is not only way to do "Live Trading during market hours"

As I initially more of referring
"WL-user-guide (v6.9) Quick-Start section" was with impression SM tool is the only way for Live Trading but now having understood on this Forum, even Experts like @KGo not using SM tool and so went about more exploring detailed and found for my actual requirements can be met just using "Strategy Window" with Streaming ON and Auto-Stage ON in the Alerts-tab and this looks enough solving my requirements which also works well..

Thanks again!


profile picture

Eugene

#5
QUOTE:
I understood using StrategyMonitor(SM) is not only way to do "Live Trading during market hours"

Good to hear it's working for you in a S.Window. On a related note: Choosing optimal trading tool: Strategy Monitor or Strategy window.
profile picture

Sarath1

#6
Thanks a lot for more pointers/insights which help towards related performance tunings.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).