Reply

What should happen when short and long signals fire at the same time?

15 replies

bentra

Customer, bbp_participant, community, sq-ultimate, 22 replies.

Visit profile

4 years ago #245931

At least 5% of strategies from builder will fire longs and short signals simultaneously and actually more than 5% if we include strategies with the long signal = always true and short signal = always true logic.

I’m curious what people think should be happening with the orders when this occurs.

In a LIMIT or STOP order scenario which is your preferred option?
1.just place both stop or limit orders if possible and let them play out by the rules normally.
2.place no orders at all until only one of the signals is true.
3.discard the short signal and only place the long signal because most markets have a long bias. <–this is currently how SQX operates
4.they’re all bugs, longs and short signals should never overlap in the first place so fix the bugs.

Same question for MARKET orders.
1.place both buy and sell orders if possible resulting in a temporary hedge and let them play out by the rules normally.
2.place no orders at all until only one of the signals is true.
3.discard the short signal and only place the long signal because most markets have a long bias. <–this is currently how SQX operates
4.they’re all bugs, longs and short signals should never overlap in the first place so fix the bugs.

May all your fits be loose.


https://www.darwinex.com/darwin/SUG.4.2/

0

hankeys

Customer, bbp_participant, community, sq-ultimate, 487 replies.

Visit profile

4 years ago #245933

everything is in the settings – if the backtest behaves the same way like trading, i can see what strategy is doing and i dont have time to think about what is right. I am an algotrader, and why to bother with these things?

make it more clear: i dont like MARKET orders, they are totally data sensitive, because you are entering in one time with actual price. So i dont trady any

LIMIT, STOP – i am focusing for STOP orders, have only some LIMIT from old SQ and it seems, that LIMIT strats are dying pretty fast. So for SQX i am using only STOP orders. With settings for SQX type strategies condition min 1, max 2 i will not get any non symmetric strategies (dont use EQUAL and DONT EQUAL building block).

You want to be a profitable algotrader? We started using StrateQuant software in early 2014. For now we have a very big knowhow for building EAs for every possible types of markets. We share this knowhow, apps, tools and also all final strategies with real traders. If you want to join us, fill in the FORM.

0

bentra

Customer, bbp_participant, community, sq-ultimate, 22 replies.

Visit profile

4 years ago #245940

Here’s a couple examples example of some logic that gives long and short signals at the same time so you can see what I mean:

//——————————————————————–
// Trading rule: Trading signals (On Bar Open)
//——————————————————————–
LongEntrySignal = True;

ShortEntrySignal = True;

LongExitSignal = false;

ShortExitSignal = false;

 

//——————————————————————–
// Trading rule: Long entry (On Bar Open)
//——————————————————————–
if LongEntrySignal
{
// Action #1
Open Long order at (CloseDaily(Main chart)[1] + (1.20 * BB Range(Main chart,41, 0.6)[1])) Stop;
Order valid for 104 bars;
Duplicate trades: disabled;
Replacing pending orders: allowed;

Stop Loss = 1.1* ATR(44);
Profit target = 17.1* ATR(70);

Exit After 82 bars;

}

 

//——————————————————————–
// Trading rule: Short entry (On Bar Open)
//——————————————————————–
if (ShortEntrySignal
and Not LongEntrySignal)
{
// Action #1
Open Short order at (CloseDaily(Main chart)[1] – (1.2 * BB Range(Main chart,41, 0.6)[1])) Stop;
Order valid for 104 bars;
Duplicate trades: disabled;
Replacing pending orders: allowed;

Stop Loss = 1.1* ATR(44);
Profit target = 17.1* ATR(70);

Exit After 82 bars;

}

That one obviously is long and short always true and SHOULD be symmetrical and it SHOULD place both long and short stop orders well above and bellow the close. But it is broken by the builder and only places long orders. 

Here’s another:

//——————————————————————–
// Trading rule: Trading signals (On Bar Open)
//——————————————————————–
LongEntrySignal = Close below BollingerBands(Main chart,9, 3.5).UpperBand;

ShortEntrySignal = Close above BollingerBands(Main chart,9, 3.5).LowerBand;

LongExitSignal = false;

ShortExitSignal = false;

This will be true for both longs and shorts very often doesn’t matter if it’s market or stop or limit strategy if it comes from builder then it takes 90% longs and 10% shorts because of the way the builder works discarding the short signals when both signals fire.

I’ve attached some typical strategies that came from builder that sometimes or always fire long and short signals at the same time but only places long orders. No, there are no settings to fix this problem, I wish there was. We could be missing out on some great strategies!

Attachments:
You must be logged in to view attached files.

May all your fits be loose.


https://www.darwinex.com/darwin/SUG.4.2/

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

4 years ago #245941

we are discussing this also internally, I’m open to your opinions.

Basically, our standard SQ X template is:
if LongEntrySignal
// Long action – Market, Stop or Limit

if (ShortEntrySignal and Not LongEntrySignal)
// Short action – Market, Stop or Limit

so when there are signals to both directions only long will be placed.

The proposal is to change the default template to:
if LongEntrySignal
// Long action – Market, Stop or Limit

if (ShortEntrySignal)
// Short action – Market, Stop or Limit

 

This will not have effect on Market orders because strategy controls that you can open market order to one direction only, but it will allow opening Stop/Limit orders to both directions if there is Long & Short signal.

I don’t want to make it configurable, I’m thnking if we should change the default strategy template.

This will affect only newly generated strategies and it could bring more variety in generated strategies.

 

What is your opinion on this?

Mark
StrategyQuant architect

0

bentra

Customer, bbp_participant, community, sq-ultimate, 22 replies.

Visit profile

4 years ago #245943

YAY some discussion!

Love the limit / stop order idea it’s perfect.

I’d like at least an option to do this for MARKET orders pleeeeeaaase  so it can be symmetrical!

if (LongEntrySignal and Not ShortEntrySignal)
// Long action – Market, Stop or Limit

if (ShortEntrySignal and Not LongEntrySignal)
// Short action – Market, Stop or Limit

May all your fits be loose.


https://www.darwinex.com/darwin/SUG.4.2/

0

bentra

Customer, bbp_participant, community, sq-ultimate, 22 replies.

Visit profile

4 years ago #245947

(This will discard longs and shorts for market orders when both signals are true until only one is true so we always have the same chance of longs and shorts being placed for symmetry.)

May all your fits be loose.


https://www.darwinex.com/darwin/SUG.4.2/

0

bentra

Customer, bbp_participant, community, sq-ultimate, 22 replies.

Visit profile

4 years ago #245948

(Otherwise more longs are placed than shorts which is not fair to currency traders or traders who really want symmetry.)

May all your fits be loose.


https://www.darwinex.com/darwin/SUG.4.2/

0

kainc301

Customer, bbp_participant, community, 54 replies.

Visit profile

4 years ago #245969

Simultaneous long/short entry with market orders on one asset makes no sense because it will always result in a loss of the spread no matter what you do. The only way to profit would be to take the losing order off when an opportunity is found in the winning direction and then take profit according to the strategy rules when the edge is finished. However, if this is the case, then there was no reason to take on the initial loss in the first place and it is more beneficial for SQX to find that edge without being in a hedged position that only takes away from the profit as you pay the spread. No matter how you cut it, you will always be at a disadvantage. This has nothing to do with symmetry. Doing something for the sake of symmetry makes no sense if it will lose money no matter what you do.

However, when you instead use stop-limit orders for entry, this can provide some benefit as this allows control over how to trade bidirectionally based on market conditions. Although, in order to accomplish this, you would need a separate mode entirely. Similar to how we have a fuzzy logic and mean reversion mode, we would need to have a hedge mode that explicitly handles this type of logic.

This would be similar to an idea I submitted earlier where instead of canceling the other limit order, it was used as a stop-loss: https://roadmap.strategyquant.com/tasks/sq4_1859. This is essentially the same idea with the understanding that the second order would be canceled after the first trade is entered. Or you could even cancel the second limit order after the market moves x pips in your direction to have a mixture of both. Leaving on the other limit order after the market has moved in your favor already does not make any sense so it should eventually be canceled.

The only way to hedge and use market orders is to do this between different markets. For example, finding some strategy set of rules where you can buy EURUSD and sell AUDUSD and make a profit after x amount of time or when x exit condition occurs. I have also submitted a request for that here: https://roadmap.strategyquant.com/tasks/sq4_2829.

A hedge mode can take care of all three of these ideas.

I wouldn’t necessarily consider hedging “symmetry” as the rules to enter should not be based on any symmetrical indicator block rules between long and short. I would also argue that any blocks that cause simultaneous entry currently would stand to be a bug and instead it should not be indicator blocks that determine simultaneous entry but be a specific trading mode just as fuzzy logic is a specific trading mode. Using indicator symmetry rules to define simultaneous entry is contradictory by nature as long and short conditions should never be true at the same time.

 

0

bentra

Customer, bbp_participant, community, sq-ultimate, 22 replies.

Visit profile

4 years ago #245971

I’m trying to find a multi-currency market order strategy for D1 or H4 but I need to be certain it’s absolutely symmetric otherwise how can I trust it to be multi-currency-market strategy? I want to use the builder without a template so I can have options such as random number of conditions and blocks. The only way I can currently accomplish this is by manually taking every single strategy generated in to the wizard and changing this:

if LongEntrySignal
// Long action – Market, Stop or Limit

if (ShortEntrySignal and Not LongEntrySignal)
// Short action – Market, Stop or Limit

to this:

if LongEntrySignal and Not ShortEntrySignal
// Long action – Market, Stop or Limit

if (ShortEntrySignal and Not LongEntrySignal)
// Short action – Market, Stop or Limit

Changing this for every strategy s is very tedious and frustrating, it should be automatic.

BTW this bit of code will not allow hedging, it will instead suppress both long signal and short signals until only one or the other is true.

By symmetrical, I mean has the exact same chance to take a long as a short. If “some price action” will trigger a long, then the “exact opposite price action” will also trigger a short – this is not a guarantee the way the builder currently works and Marc’s suggested fix will only fix this issue for stop/limit order strategies if I understand him correctly.

 

 

 

May all your fits be loose.


https://www.darwinex.com/darwin/SUG.4.2/

0

bentra

Customer, bbp_participant, community, sq-ultimate, 22 replies.

Visit profile

4 years ago #245972

Some strategies will perform much better once made to be symmetrical but good strategies are definitely being filtered before I have a chance to manually make them symmetrical.

May all your fits be loose.


https://www.darwinex.com/darwin/SUG.4.2/

0

bentra

Customer, bbp_participant, community, sq-ultimate, 22 replies.

Visit profile

4 years ago #245974

@ Marc: If you don’t want to add anything to the UI can you expose the “default strategy template.” so we can change it ourselves to accomplish symmetry, or even add it in to the OppositeBlocks file like this?

LongEntrySignal;ShortEntrySignal
LongEntrySignal and Not ShortEntrySignal;ShortEntrySignal and Not LongEntrySignal

If we had that we could even randomize them during building.

May all your fits be loose.


https://www.darwinex.com/darwin/SUG.4.2/

0

kainc301

Customer, bbp_participant, community, 54 replies.

Visit profile

4 years ago #245976

The only way I can currently accomplish this is by manually taking every single strategy generated in to the wizard and changing this: if LongEntrySignal // Long action – Market, Stop or Limit if (ShortEntrySignal and Not LongEntrySignal) // Short action – Market, Stop or Limit to this: if LongEntrySignal and Not ShortEntrySignal // Long action – Market, Stop or Limit if (ShortEntrySignal and Not LongEntrySignal) // Short action – Market, Stop or Limit Changing this for every strategy s is very tedious and frustrating, it should be automatic.

This should not be necessary. Long/short conditions should not be produced where they fire at the same time. For them to fire at the same time, both conditions need to be true at the same time. This should not be the case if symmetry is turned on, even if built randomly. If this is the case, I believe this is a bug. It makes no sense for a strategy to be generated where symmetric long/short conditions can be true at the same time. Now if the long condition was true and a long trade was entered, and then a few minutes later, the short condition became true and entered a short while the long was still active, this would be a different situation. But it doesn’t make sense for both long and short conditions to be true at the same time which leads me to believe there was a bug in how it was made in the first place.

0

mabi

Customer, bbp_participant, community, 261 replies.

Visit profile

4 years ago #247186

@ Mark, I believe this should be implemented. For strategies that don’t benefit from it would be deleted during build. And having biased strategies is not good.  Just look at all breakout strategies the last 6 months they suck and why is that. Well dollar been strong and only short side has been making money wile long side been constantly loosing. If I was trading for a living I would have split the strategies up in 2 parts allowing only longs and shorts in  MT4 and stop trading long side  loooong time ago.  If it wasn’t for XAU my real accounts would have been negative this year.

0

bentra

Customer, bbp_participant, community, sq-ultimate, 22 replies.

Visit profile

4 years ago #247244

Proper resolution of this issue (and other symmetry issues especially this new one I just found which applies to template and non template building: https://roadmap.strategyquant.com/tasks/sq4_5221) will speed up builder production of useful symmetrical strategies drastically plus will eliminate a LOT of work trying to figure out (and fix in wizard) which ones are actually asymmetrical (some asymmetrical can be found AFTER testing by stats but some only a programmer could figure out. It is much more efficient for SQX to weed them out or prevent them from being built in the first place before they get tested on any data.)

For those of you who think they’ve tested some symmetrical strategies in SQX… maybe you haven’t tested as many as you think you have….

May all your fits be loose.


https://www.darwinex.com/darwin/SUG.4.2/

0

mabi

Customer, bbp_participant, community, 261 replies.

Visit profile

4 years ago #247292

@ Mark, I believe this should be implemented. For strategies that don’t benefit from it would be deleted during build. And having biased strategies is not good. Just look at all breakout strategies the last 6 months they suck and why is that. Well dollar been strong and only short side has been making money wile long side been constantly loosing. If I was trading for a living I would have split the strategies up in 2 parts allowing only longs and shorts in MT4 and stop trading long side loooong time ago. If it wasn’t for XAU my real accounts would have been negative this year.

Now i am thinking that when conflicting signal Occur it is better to not trade. Since this will only happen in Flat or Chop markets.

0

FILIPE BONALDO ACERBI

Customer, bbp_participant, community, 27 replies.

Visit profile

4 years ago #247321

Agree with bendx77 that a true symmetric strategy will follow this rule:

 

if LongEntrySignal and Not ShortEntrySignal
// Long action – Market, Stop or Limit

if (ShortEntrySignal and Not LongEntrySignal)
// Short action – Market, Stop or Limit

 

The standard template will favour long entries making the strategy unsymmetrical .

0

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