Short Orders execution on Long only strategy

Forums ProRealTime English forum ProOrder support Short Orders execution on Long only strategy

  • This topic has 15 replies, 3 voices, and was last updated 4 years ago by avatarBi.
Viewing 15 posts - 1 through 15 (of 16 total)
  • #129985
    Bi

    Hi

    I am trying to build a long only strategy where I have the below trade management rules.

    1. StopLoss set at 1 ATR (14)
    2. First Target set at 1 ATR(14)
    3. Trailing stop starting at 2 ATR(14) and trailing step at 1.5 ATR(14)

    My StopLoss, First target and trailing seems to work but for some weird reason system is opening short positions even though I have no Short orders. The only sell orders I have exit ones, I tried add the code “Longonmarket” as well as “Countofpositions” still I am getting short orders

    Much appreciate if you could let me know where I am going wrong please?

     

    (See attached strategy and code)

    #129998

    I am trying to run it on my platform to see if I get the same … well weird??

    Is the Strategy01LongV1 and v2 in the Library on this website?

    #129999
    Bi

    Thank you, below the v1,v2 code. I believe rest of the conditions are in the strategy code itself.

     

     

    1 user thanked author for this post.
    #130001

    The problem is in the implementation of the lot closure when reaching first target; removing this condition from the trailing stop there’s no shorts

    #130003

    I confirm same … so you are not seeing things! Unless we are both deluded!? 🙂

    I get 1 short trade when running on DJI 1000 bars and 5 min TF and spread = 2.

    When I put spread = 4 I do not get a short trade on DJI 1000 bars and 5 min TF.

    That’s one of the weirdest thing I’ve ever come across since I’ve been using PRT??

     

     

    #130006

    I think it has something to do with the line of code below.

    When I change to ‘Buy at Market’, I get no shorts … yet!? 🙂

     

     

    #130007

    Somehow the code is buying 2 and selling 3 to exit??

    #130009

    Various values for ptfactor will give shorts or stop shorts also

     

    Seems there are several changes that will stop the Shorts, but how can a System go short when there is NO SellShort command in the code??

    Very worrying!!??

    #130015
    Bi

    thank you for looking into it. I do agree this is odd.

    Also I understand scaling out on a auto-trading is not possible but I am only try to backtest my strategy how I would manually trade it. Hence the first target close is important. But why market is shorting even with the below condition is beyond my understanding.

     

    #130111
    Bi

    I think i fixed it, the issue was the calculation of breakeven and trailingstart were off and also I had to specify lot to close (remaining) at the end. Which I think is the reason for the short position.

    #130116

    Yeah at certain conditions you are selling 3 after buying 2 (?) … still weird though as I would have expected a System Reject / Stop covered by one of IG’s ambiguous screen messages!?

    Maybe one day somebody might be able to make profitable use of this loophole!? 🙂

     

    #130119
    Bi

    haha yes! the shorts were actually making my system look profitable got a bit carried away with the results. Glad to have checked it.

    #130120

    Re profitable … how about introducing (proper) shorts into the strategy?

    #130121
    Bi

    I do have shorts as well with the same logic reversed but wanted to keep the strategies Long only and Short only to review the results accurately. Also I am testing this on US shares where there is a long bias but have to test this out in other markets like FX or Commodities where trends are not one sided.

    Please feel free to improve it, if you do manage to please do let me know.

    #130123

    Please feel free to improve it

    I had a quick go this morning … I could see that it needed a filter to stop Longs when price was clearly in a big downtrend.

    I tried below and I used values of up to x = 10000 on a 5 min TF, but still it was taking Longs … I thought more weirdness!? 🙂

     

Viewing 15 posts - 1 through 15 (of 16 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login