I've just purchased my lifetime license, and will be going live on a new strategy rollout pretty soon. I was hoping to get some advice regarding a question I have with setting limit orders.
In my old breakout strategy, I would immediately enter a market order the moment my breakout conditions were met. However, that always resulted in a bad price, since I'd be buying into the initial breakout spike and selling into the initial breakout plunge.
As such, I'm seeking to enter a limit order 10 pips above/below the price observed when the conditions were first met (ie: 10 pips from where my old strategy would have entered the market immediately).
However, after changing the code, my strategy goes crazy, entering limit orders and cancelling them immediately after entering them. I suspect the problem lies with GetCurrentBid since the current bid is always changing (Have attached a snippet of the code below). As such, what I really need is a method to "fix" or "record" the price initially observed when my entry conditions are all met (where my old strategy would have entered the market), then use that price as a reference for a limit order.
Can someone advise me with a line of code on how I can achieve my desired outcome?
Old Strategy Code
if (Entry Conditions True)
EnterLong(50000,"");
New Strategy Code (Problematic)
if (Entry Conditions True)
{EnterLongLimit(50000, GetCurrentBid() - 100 * TickSize, "");
Many Thanks!
Comment