- ago
I'd like to start auto placing trades based on strategy generated signals, and I need a little guidance. Here's my scenario:

- Strategy is using daily bars
- Buy limit orders and sell market orders are generated after each trading day
- TradeStation is my broker
- I'm using WL's Nasdaq 100 dataset (many NSF positions will be generated)

Here's what I'm trying to achieve:

- Since many NSF positions will be generated, I would like WL to choose which signals to place as trades. I believe this is using a random selection process when backtesting.
- At the end of each trading session, I'd like to run the strategy, generate signals, and auto placed trades.
- My strategy uses % of equity sizing. I'd like to use the live account's equity to calculate position size.

I believe strategy monitor is the tool to use. I've added my strategy to the strategy monitor and set up the configuration (below).



Then, I run the strategy using the "Run Now" option. I expected to generate signals based on the last bar, but no signals are generated.



Below are my portfolio sync preferences.



If I turn off "Use Live Positions" and rerun the strategy via strategy monitor, signals are generated.



I understand why the sell at market orders signals would not be generated; those positions do not exist in the live account. I don't understand why the buy limit orders signals are not being generated. Also, once WL generates 100 signals, my buying power will only support 10. How do I mimic the backtest random selection of these ten positions? I believe the quotes window is involved with this, but I'm not sure exactly how this is supposed to work.

Thank you,
Paul
0
428
19 Replies

Reply

Bookmark

Sort
Cone8
 ( 6.07% )
- ago
#1
QUOTE:
I don't understand why the buy limit orders signals are not being generated.
In this case, it's not obvious, but must be related to strategy logic.

To be sure, it tested it with dip buyer strategy that is sure to signal buy at limit orders. I got the signals with or without Live Positions enabled.

Re: 100 Limit orders.
There's no magic bullet here. You don't know which of the 100 (if any) will hit their trigger price. You need to trade all 100 to get the first 10. Use Granular Processing in the Advanced Strategy settings to get the closest backtest based on the trades that would have occurred first.

You can also limit the number of limit orders you put out based on some other logic/metric, but that reduces opportunities.


0
- ago
#2
Can you test with the WL.com published strategy "OneNight" please? This strategy places buy limit orders at 2% below the last bar's close. It should generate an oder for every symbol in the selected dataset.

I'm getting signals when I don't have "Use Live Positions" enabled. But, when I turn this on and make no other change, no signals are generated.


CODE:
// TwoDays using WealthLab.Backtest; using System; using WealthLab.Core; namespace WealthScript1 { public class MyStrategy : UserStrategyBase { public override void Execute(BarHistory bars, int idx)       {          double percentage = 2.0;          foreach (var pos in OpenPositions) ClosePosition(pos, OrderType.Market);     double limit = bars.Close[idx] * (1.0 - percentage / 100.0);          Transaction tr = PlaceTrade(bars, TransactionType.Buy, OrderType.Limit, limit); } } }
0
- ago
#3
I tried a few things to isolate this.

- Added several other strategies to the strategy monitor to see if the issue is strategy specific. All strategies generated no signals while "Use Live Account" was enabled.
- Change broker to WL Dummy broker. Limit orders were generated while "Use Live Account" was enabled.
- Shut down and restarted WL. Retested using TradeStation. OneNight returned Buy Limit orders.

I'll do some more testing to see if I can find the steps needed to replicate this.
0
- ago
#4
While "Use Live Positions" is enabled...

If I configure OneNight strategy's data range to 3 days, signals get generated. If I set to a value higher than 3 (4 days, 5 days, 7 days, 10 years), signals do not get generated. This is the same for TradeStation and WL Dummy broker.



However, I added a second strategy (knife juggler) to strategy monitor and tried the same test. knife juggler does not return signals at 3 days. It does return signals if I set the date range to 100 bars and "Use Live Positions" is disabled. When I have knife juggler set to 100 bars & I turn on "Use Live Positions" it returns no signals.

There seems to be an issue with the "Use Live Positions" interacting with Strategy Monitor.

0
Cone8
 ( 6.07% )
- ago
#5
Seems backwards. For me it's a problem loading only 3 days of data. An error is generated and shows in the log for that.

3 days is 3 days, not 3 bars. Today is Monday, so 3 days would be Saturday, Sunday, and Monday. - no data. When you did the test yesterday, you were getting only 1 bar of data - Friday - still not enough.

Why is it different with "Live Positions"? I'm not sure, but for me that error occurs for both configurations when loading essentially NO DATA.

Which DataSet did you select?
Which is the first Historical Provider you have checked (Data Manager)?
0
- ago
#6
I'm using the WL NASDAQ 100 throughout these tests.

I set the data range to 3 days only while trying to figure out why no signals were being generated. Friday should result in 100 signals, and it does so when I select 3 days. If I select 4 days, 5 days, or 10 years, no signals are generated if "Use Live Positions" is enabled.
0
Cone8
 ( 6.07% )
- ago
#7
Before the market closes today, Monday, there's no way to get ANY data if you set "3 days" - assuming US Stocks. Cryptos would be a different story. So something is really, really out of whack with what you're describing.

If you haven't already, restart WealthLab. Do something different, because something is so wrong there I wouldn't know where to begin.
0
- ago
#8
I've restarted WL multiple times. Same behavior.

The data range I use today to get the same results as posted above is 4 days. This includes Friday.

I'll record a video. There is a lot going on in this thread. A short video should make it easier to follow.
0
- ago
#10
Short video of the issue is linked below. Please let me know if I'm doing something wrong or you need more details.
 
https://leapfrogbi-my.sharepoint.com/:v:/p/paul/EXB-CpS7UFpLheyeSiu0IgIBEWPI0B-ONvnqOR21WL4HpQ?e=Kv44ex

0
Cone8
 ( 6.07% )
- ago
#11
Thanks. Excellent video. Still can't duplicate that though!

Some observations and non observables:
1. Are you using Build 98?
2. When if fails, it could be very helpful to see the "Log" instead of the "Status" view.
3. The caret prefix in the Strategy Name is odd, but even renaming a cloned strategy like with the prefix, I couldn't duplicate the failure.
0
- ago
#12
Yes. I'm on build 98. All extensions are also up to date.

I cleared the log prior to running the scenario that results in no signals. Then I ran the strategy. No signals are generated, the log viewer is empty.

I removed the caret prefix. Same results.
0
- ago
#13
@Cone - If you would like, I can do a fresh install and redo all tests. This should be replicatable. Since you can't replicate, I either have something about my install that is different from yours or there is something different about our tests.

Let me know.
0
- ago
#14
I just realized that you probably want the log from the strategy monitor, not the log viewer. Log below represents the scenario that results in no signals.



9/9/2024 09:09:14: Status = LoadingData
9/9/2024 09:09:14: Start Polling Thread
9/9/2024 09:09:14: Populating Data
9/9/2024 09:09:14: Calling GetHistories Pass 1
9/9/2024 09:09:15: GetHistories returned with 100 symbols
9/9/2024 09:09:15: Calling GetHistories Pass 2
9/9/2024 09:09:15: GetHistories returned with 100 symbols
9/9/2024 09:09:15: ANSS:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: AEP:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: AZN:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: AMGN:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: CTAS:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: ADI:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: BKR:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: CMCSA:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: CSCO:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: DASH:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: CDW:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: DXCM:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: FANG:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: HON:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: META:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: NFLX:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: ISRG:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: PANW:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: MDB:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: KLAC:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: GILD:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: PDD:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: ASML:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: LRCX:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: ODFL:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: ILMN:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: TSLA:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: BIIB:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: MRVL:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: QCOM:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: CTSH:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: AMZN:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: SNPS:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: AMAT:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: ROST:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: ADP:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: CSGP:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: CCEP:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: DDOG:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: CEG:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: GEHC:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: MNST:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: FAST:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: EA:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: NVDA:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: KDP:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: GOOGL:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: MDLZ:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: LIN:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: ON:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: PAYX:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: AVGO:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: MAR:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: ARM:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: PEP:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: BKNG:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: TEAM:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: REGN:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: CSX:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: AMD:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: MSFT:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: CRWD:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: INTC:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: CDNS:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: SBUX:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: ADSK:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: CHTR:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: TTD:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: DLTR:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: GFS:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: MRNA:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: KHC:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: NXPI:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: FTNT:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: LULU:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: MELI:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: ABNB:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: ZS:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: WBD:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: SMCI:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: TMUS:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: ORLY:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: PYPL:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: IDXX:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: ROP:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: MU:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: TTWO:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: WDAY:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: TXN:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: ADBE:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: MCHP:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: INTU:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: XEL:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: VRSK:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: VRTX:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: COST:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: CPRT:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: AAPL:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: EXC:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: PCAR:2 bars to 20240906 0000|NASDAQ 100
9/9/2024 09:09:15: Running Now
9/9/2024 09:09:15: Status = Idle
9/9/2024 09:09:15: Status = Processing
9/9/2024 09:09:15: Pass 1 - Requesting updates for 100 symbols...
9/9/2024 09:09:17: Pass 1 - UpdateHistories returned 0 symbols
9/9/2024 09:09:17: Ran Strategy on ANSS,AEP,AZN,AMGN,CTAS,ADI,BKR,CMCSA,CSCO,DASH,CDW,DXCM,FANG,HON,META,NFLX,ISRG,PANW,MDB,KLAC,GILD,PDD,ASML,LRCX,ODFL,ILMN,TSLA,BIIB,MRVL,QCOM,CTSH,AMZN,SNPS,AMAT,ROST,ADP,CSGP,CCEP,DDOG,CEG,GEHC,MNST,FAST,EA,NVDA,KDP,GOOGL,MDLZ,LIN,ON,PAYX,AVGO,MAR,ARM,PEP,BKNG,TEAM,REGN,CSX,AMD,MSFT,CRWD,INTC,CDNS,SBUX,ADSK,CHTR,TTD,DLTR,GFS,MRNA,KHC,NXPI,FTNT,LULU,MELI,ABNB,ZS,WBD,SMCI,TMUS,ORLY,PYPL,IDXX,ROP,MU,TTWO,WDAY,TXN,ADBE,MCHP,INTU,XEL,VRSK,VRTX,COST,CPRT,AAPL,EXC,PCAR: 0 Signals, Run Time=220ms
9/9/2024 09:09:17: NextRun set to 9/9/2024 18:00
9/9/2024 09:09:17: Status = Completed
9/9/2024 09:09:17: Processed all Symbols
0
Cone8
 ( 6.07% )
- ago
#15
Completeliy normal there. No errors.
Try this - humor me and configure it with a Dummy Account and re-run.
Since the problem occurs only with "Live Account", there could be something different about the account connection to TS that we missed.
0
- ago
#16
I see the same behavior when using the WL Dummy Account. Selecting 4 days as the data range returns signals when "Use Live Positions" is enabled. Selecting 5 days results in no signals.

0
Cone8
 ( 6.07% )
- ago
#17
1
- ago
#18
Cone, I went ahead and did a fresh install. Everything is working perfectly. Strategy Monitor generates the expected signals regardless of how I set "Use Live Positions" or the data range.

I can't explain how my prior install is different other than I downloaded the exe instead of using the home page update option. I'll keep testing this as I add extensions and alter the configuration of my latest install.
1
Cone8
 ( 6.07% )
- ago
#19
Great! Too bad we couldn't figure out what was causing that.
1

Reply

Bookmark

Sort