- ago
I'm trying out the Strategy Monitor to see how it would work with automated trades. I have a Strategy that works very well in Back test. I set up Strategy Monitor with the Strategy and a DataSet, activated it, and set for AutoStage. But I never see any trades. But the Back Test indicate there should be. Is there anyway I can figure out why I don't see trades. I use IQFeed, 5 minute bars. The Log Pane indicates that everything is working , but no trades.
0
1,101
Solved
13 Replies

Reply

Bookmark

Sort
- ago
#1
Trying to find out why no trades using the Strategy Monitor with my Strategy that works great in Back Test. I loaded the Strategy Monitor with a Wealth-Lab sample Opening range breakout and it displays Buys and Sells in the Monitor, so I know it does work. Below is the Buy/Sell code for my problem strategy. Is there anything there I'm doing wrong.
CODE:
   if (!HasOpenPosition(bars, PositionType.Long))          {                          bool cond1 = false;                          if ( BuySellInd[bar] == 1 & OwnStock[bar -1] == 0 & blStartOK == true)             {                cond1 = true;                             }                       if (cond1 == true)             {                               PlaceTrade(bars, TransactionType.Buy, OrderType.Market);                //intBuy = 0;                OwnStock[bar] = 1; //buy at next bar             }             //set back to false             blChartSlope = false;          }          else          {             //code your sell conditions here                                                    if(BuySellInd[bar] == -1 & blStartOK == true)                                         {                PlaceTrade(bars, TransactionType.Sell, OrderType.Market); //SellAtStop(bar, p, stop[bar - 1]);                                     OwnStock[bar] = 2; //sell stock at this bar                                        }          }

0
Glitch8
 ( 11.08% )
- ago
#2
We can't help without having a copy of the entire code. If you don't want to post it here you can email it to support@wealth-lab.com. There are certain things like OwnStock that I have no idea how you defined.
0
Glitch8
 ( 11.08% )
- ago
#3
I asked Eugene to look into this one since he coded that Strategy.
0
- ago
#4
Gary, you're mixing apples and oranges. The "Opening range breakout" strategy does not remotely have the code from your Post #2.
0
- ago
#5
Correct, Opening range breakout has nothing to do with Post #2. I was just trying to prove to myself that Strategy Monitor works on my PC. I wanted to get some idea how it works. Now how do I get my strategy working. What am I missing?
0
- ago
#6
Please see Post #2 by Glitch. If you can avoid emailing it, I'd appreciate if you could post it here.
0
- ago
#7
Eugene,
You should have it now.
Thank you
0
- ago
#8
Gary, the code turns out to be quite lengthy for troubleshooting (600+ lines) given our busy schedules. But most importantly I had a deja vu looking over it because I rememer having already seen a "lite" version of it emailed by another user. And the concern has been that it modifies the charted bars programmatically i.e. Heikin Ashi.

https://www.wealth-lab.com/Discussion/Why-is-my-strategy-disappearing-from-streaming-charts-6229

0
- ago
#9
Eugene,
Does WL now have all the Heiken-Ashi parameters so that I don't have to modify in my code.
0
- ago
#10
Since WL, does not have means to access Heikin-Ashi candlestick data, how would my coding of Heikin-Ashi candlestick data interfere with the Strategy Monitor operation?
0
- ago
#11
Because this coding may modify the tradable BarHistory. At any rate, since you're writing complex strategies it's recommended to use Visual Studio Code or Visual Studio Community (free of charge) for its powerful troubleshooting capability:

https://www.wealth-lab.com/Support/ExtensionApi/StrategyLibrary
https://www.wealth-lab.com/Discussion/New-instruction-for-using-Visual-Studio-to-develop-and-debug-strategies-5494
0
- ago
#12
I took out the code related to Heikin-Ashi candlesticks and still no trades in the Strategy Monitor. Working on other areas.
1
- ago
#13
I have Strategy Monitor working now. The problem was that I had a integer and Boolean variable in if statements that control the Buy/Sell. These variables interfered with the Strategy Monitor operation. With the boolean I was able to start the trading on a specific date and the integer I was able to monitor the gain/loss for the transaction. So I lose those features when I deleted those parameters. See the code
CODE:
//if (LastPosition != null)          if (!HasOpenPosition(bars, PositionType.Long))          {             //code your buy conditions here                                  //if ( BuySellInd[bar] == 1 & OwnStock[bar -1] == 0 & blStartOK == true)             //if ( BuySellInd[bar] == 1 & blStartOK == true)                if ( BuySellInd[bar] == 1 )                {                               PlaceTrade(bars, TransactionType.Buy, OrderType.Market);                //intBuy = 0;                //OwnStock[bar] = 1; //buy at next bar             }             //set back to false             //blChartSlope = false;          }          else          {             //code your sell conditions here                            //if(BuySellInd[bar] == -1 & blStartOK == true)             if(BuySellInd[bar] == -1)             {                PlaceTrade(bars, TransactionType.Sell, OrderType.Market);                                   //OwnStock[bar] = 2; //sell stock at this bar                                        }          }

To solve the issue, I modified the code in 2 steps. Notice the if statements with the //
The original line is at the top with the integer and boolean parameters. That didn't work, so I removed "OwnStock[]", that didn't work either, so I removed blStartOK.
Now Strategy Monitor works and the results are the same as the Back Test transactions.
2
Best Answer

Reply

Bookmark

Sort