Reply

Trade Opens When Exit Rule Is True…

6 replies

RJL

Customer, bbp_participant, community, 67 replies.

Visit profile

8 years ago #114410

…leading to an immediate loss!

 

Anyone experience the same and have any advice on how to avoid this?

 

Basically, the entry conditions of the EA were true, so it executed the trade, however upon entering the trade the exit rule was also true, so it just immediately closed it – obviously for the loss of the spread. In and out in 1 second, for a loss…lol.

 

It’s something that can’t really be caught in testing, so perhaps a fail-safe has to be introduced in to the generation of the EA code that also looks to ensure any Exit Rules are also false before executing a trade?

 

Mark/Tomas, any ideas?

 

Thankfully I’m still testing strategies on micro lot sizes and it’s just the spread I lose, but if it’s avoidable with something as simple as the above perhaps this can be implemented either as an immediate release but certainly at least for SQ4.

 

If it had caught the market at a time of widened spreads it could have been worse and these type of issues just cause our strategies to hemorrhage money.

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

8 years ago #133895

Is it possible to upload that problematic strategy or send us to [email protected]? What you describe should not be happening

0

RJL

Customer, bbp_participant, community, 67 replies.

Visit profile

8 years ago #133900

Hi Tomas,

 

The strategy is below.

 

All I’m saying is that when the entry conditions are true, the EA of course executes a trade…

 

However, upon entering the trade the EA then realises the exit orders are also true, so it just closes it immediately, resulting in a loss.

 

It’s not likely to happen all the time, but certainly when an EA is uploaded in a particular price cycle, there’s a chance it doesn’t catch the entry rule when it first occurs. i.e. Close10 Closing Above SMA76 might have occurred 5 bars ago, but as my position was flat when the EA was added 5 bars after the first occurrence of the signal, it would have still executed the trade, even though by then the exit order would have been valid too.

 

That’s just one example, however just by chance there could be other instances of an exit order being true at the same time entry conditions are true, so a way for the EA to recognise this and not enter a trade would be useful. So like I mentioned in the OP, maybe checking to confirm exit orders are false before entering a trade?

 

Anyway, let me know if this makes sense and what you think.

 

Thanks!  🙂

 

 

 

====================================================================
== Entry conditions
==================================================================== 
LongEntryCondition = ((Close(10) Closes Above SMA(76)) Or (BBWidthRatio(181, 2.0) Crosses Above BarRange(55)))
ShortEntryCondition = ((Close(10) Closes Below SMA(76)) Or (BBWidthRatio(181, 2.0) Crosses Below BarRange(55)))
 
 
====================================================================
== Entry orders
====================================================================
— Long entry
if LongEntryCondition is true {
   if No position is open then Buy on open at Market;
   Stop Loss = 387 pips;
   Profit Target = (0.79 * ATR(69)) pips;
}
 
— Short entry
if ShortEntryCondition is true {
   if No position is open then Sell on open at Market;
   Stop Loss = 387 pips;
   Profit Target = (0.79 * ATR(69)) pips;
}
 
====================================================================
== Exit orders
====================================================================
— Long exit
if MarketPosition is Long {
   if (ADX_DIMINUS(21) > MACD(12, 26, 9)) {
      Close position at market;
   }
}
 
— Short exit
if MarketPosition is Short {
   if (ADX_DIMINUS(21) < MACD(12, 26, 9)) {
      Close position at market;
   }
}

0

RJL

Customer, bbp_participant, community, 67 replies.

Visit profile

8 years ago #133914

This is quite important as it’s happened again, but it’s impossible for me to legislate if and when it happens. 

 

I think a simple ‘check exit orders’ rule needs to be in place before executing a trade.

 

I frustrating lost more money on a trade that just shouldn’t have been opened based on the exit rule and when spreads are widened at this time of the trading day it just makes it even worse.

 

Please can a solution be provided for this ASAP.

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

8 years ago #133944

I understand the problem, but there is no easy solution.

 

yes, Exit condition can be checked before Entry for simple condition like yours, but what about rules that work with number of bars of open order?

It might be not able to catch every case, because there co, and it will also slow down the backtest – because now the exit rules are checked only if there is some position open.

 

 

This problem is relatively easy to discover – you can check the backtest results and look for orders that were closed immediately after they were opened.

Also, backtester works as same as real trading, so it will cost you a spread in backtest too.

In real trading there is a slippage, broker delays, requotes, and other problems, I don’t think that occasional closing of orders is the biggest problem that needs immediate solution.

 

But we’l try to improve it in the new version.

Mark
StrategyQuant architect

0

RJL

Customer, bbp_participant, community, 67 replies.

Visit profile

8 years ago #133976

yes, Exit condition can be checked before Entry for simple condition like yours, but what about rules that work with number of bars of open order?

 

 

It just has to ignore that part of the equation when looking at exit orders.

 

 

It might be not able to catch every case, because there co, and it will also slow down the backtest – because now the exit rules are checked only if there is some position open.

 

 

It doesn’t necessarily have to be part of the backtest, just added to the generation of the mt4 code.

 

 

In real trading there is a slippage, broker delays, requotes, and other problems, I don’t think that occasional closing of orders is the biggest problem that needs immediate solution.

 

 

I understand it’s not the biggest of issues, but it can be a problem – even if it only occurs occasionally. If you’re trading a few mini lots at a time where there are widened spreads, you lose a fair amount of money for absolutely nothing. I had a trade open and close the other day with spread at 20 pips because it was the middle of the night, and of course many daily strategies can open at this time when the server clocks strike midnight.

 

Like has been already requested however, if you introduce a spread checker in to the rules of newly generated strategies for SQ4, hopefully widened spreads will no longer be an issue.

0

watson7tyler

Subscriber, bbp_participant, community, 3 replies.

Visit profile

8 years ago #134168

There are not many hard-and-fast rules in trading, but this article lists the 10 rules you should never break if you want to be a successful trader.

0

Viewing 6 replies - 1 through 6 (of 6 total)