I have created a strategy to test using the strategy builder wizard. I've used the wizard to get the framework of the system sorted, & am expecting to update the code for some of the more details conditions.
When my conditions are met I want to create 2 buy market orders. I've created them both in the wizard but only one is being triggered, the first one in the list.
I've tried to set the unique entries or all entries, I've also changed from number of entries per direction to 2. Something isn't working correctly here but I'm not sure why.
The reason I want to use 2 orders is so that I can have one set to a fixed profit target & one will use a trailing stop that I'm going to have to code myself I think.
Any help would be appreciated, please see the code below
EntriesPerDirection = 1; EntryHandling = EntryHandling.UniqueEntries;
protected override void OnBarUpdate() { if (BarsInProgress != 0) return; if (CurrentBars[0] < 1) return; // Set 1 if ((RSI1.Avg[0] > RSI_long)) { EnterLong(Convert.ToInt32(DefaultQuantity), @"Buy_2"); EnterLong(Convert.ToInt32(DefaultQuantity), @"Buy_1"); } // Set 2 if (Close[0] < HMA1[0]) { ExitLong(Convert.ToInt32(DefaultQuantity), @"Exit_Long_1", @"Buy_1"); ExitLong(Convert.ToInt32(DefaultQuantity), @"Exit_Long_2", @"Buy_2"); } }
Comment