Not logged in
Viewing 14 posts - 1 through 14 (of 14 total)

Forums>StrategyQuant>General Discussion>What should happen when short and long signals fire at the same time?

  • #245931|
    Customer
    45 Posts

    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.

    #245933
    Customer
    196 Posts

    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? Sharing of final strategies with real traders just started. Fill in this FORM. 500+ final SQX strategies for members running on demo account SQX demo acc. We provide also strategies for indices - DAX and DOW JONES, because we have realtick data from brokers.

    #245940
    Customer
    45 Posts

    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.
    #245941
    Administrator
    2324 Posts

    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

    #245943
    Customer
    45 Posts

    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

    #245947
    Customer
    45 Posts

    (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.)

    #245948
    Customer
    45 Posts

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

    #245969
    Customer
    32 Posts

    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.

     

    • This reply was modified 1 week, 4 days ago by  keinc301.
    #245971
    Customer
    45 Posts

    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.

     

     

     

    #245972
    Customer
    45 Posts

    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.

    #245974
    Customer
    45 Posts

    @ 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.

    #245976
    Customer
    32 Posts

    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.

    #247186
    Customer
    382 Posts

    @ 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.

    #247244
    Customer
    45 Posts

    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….

Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.