- ago
- Create a 1-minute interval strategy on SPY using IQFeed.
- Make sure it takes the strategy few seconds while running to simulate a real strategy ( see sample).
- Drop the strategy in a Streaming chart and make sure "Stream" is on.
- Save your work to a new workspace.
- Open the workspace and make sure the strategy runs.
- You will notice that WL generates a signal sound and signals are generated where they are not supposed to be.

- Please try few times since it is random. sometimes it happens and other it does not. Each time you need to re-load the workspace.
I think it kind of re-running the code while the last run is not completed.

CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Data; using WealthLab.Indicators; using System.Collections.Generic; namespace WealthScript3 {    public class MyStrategy : UserStrategyBase    {       IndicatorBase test;       public override void Initialize(BarHistory bars)       {          // create delay          for (int bar = 0; bar < 3000; bar++)          {             test = new SMA(bars.Close, 100);          }       }       //execute the strategy rules here, this is executed once for each bar in the backtest history       public override void Execute(BarHistory bars, int bar)       {          int barTime = bars.DateTimes[bar].Hour * 100 + bars.DateTimes[bar].Minute;          if (LastOpenPosition == null && barTime == 0945)          {             PlaceTrade(bars, TransactionType.Buy, OrderType.Market);          }          if (barTime == 1000 && LastOpenPosition != null)          {             ClosePosition(LastOpenPosition, OrderType.Market);          }       }       public override void BacktestComplete()       {          if (this.Signals.Count > 0)          {             foreach (Transaction transaction in this.Signals)             {                DrawHeaderText(transaction.ToString() + " Time: " + transaction.EntrySignalDate.ToLongDateString());             }          }       } } }


0
289
Solved
5 Replies

Reply

Bookmark

Sort
- ago
#1
0
Glitch8
 ( 11.81% )
- ago
#2
It should not be an issue because these signals are not staged or placed, it should clear up when the first NEW BAR arrives in streaming.
0
Cone8
 ( 25.44% )
- ago
#3
Doesn't happen for me.. and I tried a dozen times.

Are you connected to a C2 account? The broker account window is blank, which is a difference with my test. (I don't know why that would matter though.)

Some tips -

CODE:
         // create delay - 500 msec          System.Threading.Thread.Sleep(500);          //get integer time          int barTime = bars.DateTimes[bar].GetTime();
0
- ago
#4
Is there a way for me to distinguish these signals from the real ones?

I use Fidelity to trade and since it doesn't have WL API anymore, I use recorded keyboard Macros to generate real-time trades based on signals. so when these signals come I place real trades. Moreover, it is not only one signal but could be in hundreds of them. which floods my account and causes real harm to me.

I figured out a work around: Ignore signals if the count is not reasonable, but why signals are generated when not necessary in the first place!


0
Glitch8
 ( 11.81% )
- ago
#5
It’s a non issue. The initial signals won’t get sent to the order manager. only signals that are generated as a result of a NEW INCOMING STREAMING BAR.
0
Best Answer

Reply

Bookmark

Sort