Strategy over buying (& selling) when testing in demo

Forums ProRealTime English forum ProOrder support Strategy over buying (& selling) when testing in demo

Viewing 10 posts - 1 through 10 (of 10 total)
  • #18096

    Hi guys

    I’ve been trying to put together a “dynamic” exit strategy which can be applied across strategies and products. I’ve been helped by a few of you so far (Nicolas on the calculation of the Value Areas and Henry on the difficult bit of the actual exit). The discussion about the exit is in the following link so I won’t repeat it here:

    http://www.prorealcode.com/topic/how-to-code-target-and-stop/

    The exit is almost there although I’m still in discussion with PRT as I’ve spotted a few anomalies which we’re trying to rectify. I’ve just been testing it in demo and encountered a problem with it over buying (and on another occasion over selling). It seems to happen when there is a partially executed entry. I’ve looked at the order list and clicked on the order status history.

    I’ve pasted below the order tickets. Long entry 3 Dax:

     

    Date Side Name Status Qty Qty exec Price
    17:15:01 Buy DAX30 Only1216 Transmitted 3
    17:15:01 Buy DAX30 Only1216 Pending 3
    17:15:01 Buy DAX30 Only1216 Partially executed 3 2 11,185.50
    17:15:01 Buy DAX30 Only1216 Executed 3 1 11,186.00

    As a separate order (or ticket) is the following:

     

    Date Side Name Status Qty Qty exec Price
    17:15:01 Buy DAX30 Only1216 Transmitted 2
    17:15:01 Buy DAX30 Only1216 Pending 2
    17:15:01 Buy DAX30 Only1216 Executed 2 2 11,185.50

     

    The result is that I buy 3 lots as I wanted, but then also an additional 2 lots = net position of 5. However the extra 2 lots are “naked” and unwanted (i.e. they do not fit with the exit targets and are not covered with the stops).

    A similar thing happened previously on a sell order however in this instance the system partially executed 1 lot out of three to begin, and then over bought by 1 lot so the position was short 4.

    I’m pasting the code below. The entry strategy sucks and doesn’t work. I’m not interested in this at the moment. As I said I’m just trying to get the exit sorted into a transferable “product” which can then be used by myself and anyone as they want.

     

    Have any of you come across a similar problem / can you see where I’m going wrong? As always, any help much appreciated.

    Thanks

    Jon

     

     

    #18128

    Just to be clear before I dig into the code and try to understand .. Do you know that it is not possible to close partial position with the code in real trading? It does work in paper trading mode, but IG server will not accept it, like you do in your lines 40 & 41 for example.

     

    #18163

    Hi Nicolas

    Thanks for the reply. No, I didn’t know that. I don’t intend to trade through IG though. For live trading I will definitely trade through Interactive Brokers and using v 10.3. Is this still possible?

    I’ve been passing emails between PRT now for well over a month now and hadn’t heard this and I’m very appreciative that you highlighted it.

    Thanks again.

    #18169

    ProOrder trading (automated systems) are only available through IG (IG or PRT-CFD), not with IB I’m sorry for you. Trading futures through Interactive Brokers would be a great news for everyone, but I don’t know when it will be available!

    #18171

    Thanks Nicolas for the heads-up.

    I don’t think I’ve completely wasted my time. I just spoke with PRT and the person I spoke to said she hopes that IG will allow partial exits some time in 2017. No news on IB as you said. If I have to trade through IG with no partial exits then that’s not the end of the world as a short term solution. Longer term I am sure we would all then move to trade directly through a broker rather than a spread better.

    In the mean time, would you mind glancing at the code at the moment? Forget about the exits as I will have to rethink that. For now any ideas why it may be overbuying / overselling would be appreciated.

     

    Thanks

     

     

    #18444

    Hi Nicolas (& others)

    Just wondering whether you had chance to consider this? Before working on revising the exit from a partial to a full exit it would be good to know if there was anything fundamentally wrong with the entry code causing the over buying/selling and thus resulting in naked positions.

     

    Any help and advice much appreciated.

     

    Thanks

     

    #18451

    Since it has a lot of “sell” instructions that can’t operate properly on servers, I believe your problem belongs to these lines. You should consider first removing all kind of exit (all “sell” instructions) from your code, you’ll have a clearer view of what to do next with a possible exit strategy.

    About stacking orders, you may add this line at the beginning of your code, to prevent adding more orders than the first one:

     

    1 user thanked author for this post.
    #18468

    As per usual many thanks for your reply Nicolas.

    Can I confirm – as per your comment above, I can have partial exits if I’m paper trading? The problem is when I go to live trade with IG and their servers? The reason why I’m persisting is that I’ve seen a fair few strategies with partial exits. At the very least it would be good to paper trade such a strategy as a benchmark against what I would trade live (which would have full exits) if you see what I mean.

    FYI – I just had a successful entry but in this instance I had a full fill (i.e. it bought the full 6 lots) at the open price rather than a partial fill. The problem definitely only seems to occur when there are partial fills.

    Thanks for your cumulative orders line. I actually had it but did not copy it into this thread by accident.

    #22466

    @ Nicolas. This problem occurred again this morning when paper trading @Raul’s great 5min Dax strategy. The code I’m using and screenshot can be found here:

     

    https://www.prorealcode.com/topic/5-min-mini1e-dax-spread-1/page/13/

     

    The code is a lot easier than what I was using in this topic and has no partial exits. Have you come across this before / any suggestions as to what the problem could be? I’ve contacted PRT but there has been silence thus far.

    Thanks

    #26331

    Have you tried phased entry? Instead of Buy 6 Lots, Buy 2 lots then if next bar still meets entry conditions Buy 2 Lots then repeat up to 6 Lots. Then you will be able to exit 2 Lots, exit 2 lots etc using a Live Bot.

    I often use above tactic when manual trading. If I judge wrong / get in a bit too early  and trade goes against me, then phased entry makes it easier to cut (reduced) losses and exit.

    Just simple ideas, you’ve probably tried anyway, ‘bumps’ the topic up also 🙂

    Cheers
    GraHal

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

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