protected override void OnBarUpdate() { var sma1 = SMA(this.SMA1_Val); var sma2 = SMA(this.SMA2_Val); /* Enter a long position if 10 SMA crosses above 20 SMA within the last bar */ if (CrossAbove(sma1, sma2, 1)) { nOrderNum++; string sOrderStr = "myEntryOrder" + nOrderNum.ToString(); Print(string.Format(sOrderStr)); EnterLong(sOrderStr); } }
myEntryOrder1 Strategy 'TestStrategy/-1': An order placed at '19/1/2017 5:00:00 AM' has been ignored since the order was submitted before the strategy property BarsRequiredToTrade had been met. myEntryOrder2 myEntryOrder2 is Submitted myEntryOrder2 is Accepted myEntryOrder2 is Working myEntryOrder2 is Filled myEntryOrder3 myEntryOrder4 myEntryOrder5 myEntryOrder6 myEntryOrder7 myEntryOrder8 myEntryOrder9 myEntryOrder10 Exit on session close is Submitted Exit on session close is Accepted Exit on session close is Working Exit on session close is Filled
Next I changed sOrderStr variable in OnBarUpdate() from "myEntryOrder..." to "testingEntryOrder..." and I also changed EntriesPerDirection = 3. This is what I observed in the Output window:
testingEntryOrder1 Strategy 'TestStrategy/-1': An order placed at '19/1/2017 5:00:00 AM' has been ignored since the order was submitted before the strategy property BarsRequiredToTrade had been met. testingEntryOrder2 testingEntryOrder2 is Submitted testingEntryOrder2 is Accepted testingEntryOrder2 is Working testingEntryOrder2 is Filled testingEntryOrder3 testingEntryOrder4 testingEntryOrder5 testingEntryOrder6 testingEntryOrder7 testingEntryOrder8 testingEntryOrder9 testingEntryOrder10 Exit on session close is Submitted Exit on session close is Accepted Exit on session close is Working Exit on session close is Filled
testingEntryOrder1 Strategy 'TestStrategy/-1': An order placed at '19/1/2017 5:00:00 AM' has been ignored since the order was submitted before the strategy property BarsRequiredToTrade had been met. testingEntryOrder2 testingEntryOrder2 is Submitted testingEntryOrder2 is Accepted testingEntryOrder2 is Working testingEntryOrder2 is Filled testingEntryOrder3 testingEntryOrder3 is Submitted testingEntryOrder3 is Accepted testingEntryOrder3 is Working testingEntryOrder3 is Filled testingEntryOrder4 testingEntryOrder4 is Submitted testingEntryOrder4 is Accepted testingEntryOrder4 is Working testingEntryOrder4 is Filled testingEntryOrder5 testingEntryOrder6 testingEntryOrder7 testingEntryOrder8 testingEntryOrder9 testingEntryOrder10 Exit on session close is Submitted Exit on session close is Accepted Exit on session close is Working Exit on session close is Filled
1) In my newly compiled code, why is EntriesPerDirection not updated, yet the sOrderStr variable was?
2) Do I need to select a new strategy and re-select back my strategy in Strategy Analyzer to refresh, before my newly compiled code will run?
Comment