MT4 OCO, C2 thinks I'm hedging

I searched for this in the forum before posting, so if I’ve completely missed a post where this is addressed, I apologize and would appreciate guidance.



My system sometimes sets up for trades with a short stop at the low of the previous day, and a long stop at the high of the previous day. I use an expert advisor via MetaTrader 4; when one of these trades is open, the other stop is canceled by the ea. So, I’m not hedging, but Collective 2 views these two stops as hedging and only allows one of them to be placed by my ea.



(However, C2 does allow the two stops to coexist if placed manually.)



Is there a way around this on C2 … for example, could the admin simply allow my ea to place both stops? Or do you have any suggestions?



Thank you so much.[LINKSYSTEM_58622958]

Micah:



You write:



"So, I’m not hedging, but Collective 2 views these two stops as hedging and only allows one of them to be placed…"



Without knowing exactly what you are doing, I can only comment generally.



I think the problem is that you are submitting (for example) a Buy To Open order while you are still Short. That’s a no-no at C2, because it might lead to situations where long and short positions are open simultaneously. So, what we require you do instead is to issue a BUY TO CLOSE when you are short. Once you are flat, then you can issue a Buy To Open, which will then make you long.



I am just surmising about what is going on in your system, and so if I am misunderstanding then you might want to give more details, such as the exact sequence of trades you are trying to place and the exact error messages you receive when trying to place them.



But if my analysis is generally correct, the solution is to first close the trade you have open, and THEN open a position in the opposite direction. Often this can be done with conditional orders, such as this scenario:



When you are SHORT 1 unit



submit: BUY TO CLOSE 1 unit Stop XXX



submit: Buy To Open 1 unit Stop XXX (conditional upon fill of order above)



Again, feel free to provide more detail about your actual signals submitted to c2 and C2’s actual responses, and I might be able to shed more light on this.

Thank you for replying. Btw, I found your site when you first set it up in 2003, and I’m amazed at how far it’s come.



Error log:



16:59:29 AdvisorName AUDJPY,Daily: open #2264227 sell stop 0.01 AUDJPY at 82.020 sl: 83.069 ok

16:59:29 AdvisorName AUDJPY,Daily: open #2264229 buy stop 0.01 AUDJPY at 83.185 sl: 82.137 ok

16:59:43 TradeMonitorBasic EURUSD,Weekly: Hedging is not allowed at Collective2 therefore trade for AUDJPY is ignored



So, it’s just two stop orders, while no orders were open at all. When one of those stops is activated, the EA cancels the other stop. In this case, the sell stop was placed by the EA, but not the buy stop. I was able to place the buy stop manually.

Micah -



I think this may be an issue that needs to be examined by Duncan, the creator of the Mt4/C2 interface. I will forward your message to him and ask for his advice.



More shortly.



Matthew

I am on it :). Needs some code changes, but easily doable. Also noticed the Basic version is out of sync with the paid version - so expect a new free version shortly.

Ok, thank you. Your work is much appreciated. I didn’t realize there was a paid version; I’ll have to check it out.

Will the “TradeStation: Use Fills Only” setting also work for MetaTrader?



I don’t think the answer would be yes, but if it is yes, it would be really helpful. It would solve this hedge problem and another problem (when the stops are hit and a trade is opened, that newly opened trade is sent to C2, which doubles up my position size).



Micah -



That’s a good feature request, but it would need to be supported by the MT4 interface, too – not just C2. Essentially it would require that the MT4 interface send only market orders to C2 whenever a position is initiated by an EA. (Example: Even though the EA internally thinks of an order as “Sell Limit X,” no order is sent to C2 until the price is crossed, at which point it becomes a market order.)



I believe Duncan (the author of the MT4/C2 interface) is working on a fix to the issue you uncovered, so I am not sure if this feature really is required. But I will let Duncan make the final decision about that, of course.



Matthew

You two are awesome. I’ll wait patiently.

If you haven’t been able to get to this yet, it’s ok because my problem is solved. I reprogrammed my system just for C2, so that stop levels are monitored and when touched, a market order is sent.



If anyone has this issue in the future, they might find that it’s very simple to simply take their stop level and insert it into something like this: if (Bid >= BuyStopLevel) {open market order}



and: if (Ask <= SellStopLevel) {open market order}



This even solves the problem of “showing your hand” to your subscribers and broker. The downside is that it increases slippage.