Need help decreasing number of 'placeholder' trades in strategy
I've been running a strategy for a few weeks, which seems to be doing well, but I'd like to further that by decreasing the commissions I'm paying. My code uses order management similar to an example video made by BigMike, so I will reference his example/template for simplicity's sake.
Upon entry, my strategy opens 3 separate long orders. These 3 orders are managed separately, with their own SL, TP, and breakeven point. The first two orders ("target1" & "target2") are opened with extremely small lot sizes, and are essentially there just to serve as a breakeven point for "target3", which carries the majority of the trade size.
The reason I have done it this way is it's the most effective way I could incorporate dynamic trailing stops and profit triggers. It works great, but since "target1" and "target2" are effectively just placeholders, it would be nice if I could alter this method so I didn't actually have to trade target1 and target2 (this avoiding commissions). So does anyone have experience trading a similar method, but avoiding having to enter "placeholder" trades?
If I'm understanding correctly you use target 1 & 2 to trigger or have a value for use with your trailing stop. Thinkorswim works in the same way. What I did was this:
def crossAbove = price crosses above Avg and price crosses above ValueHi + entry_price ; This is the criteria that fires my buy order it is simply true of false
I then use this to create a separate order for my trailing stop i.e- def trigger = if crossabove then 1 else 0;
def orderprice = close;
rec ts = if trigger then orderprice - trailstop else if low - trailstop > ts then low - trailstop else ts;
def stopout = if trigger then 0 else if low <= ts then 1 else 0;
AddOrder(OrderType.SELL_TO_CLOSE, stopout, ts, name = "Trailing_Stop");
It's mostly about where you point your variables. If you need to discuss this further let me know.