V11 Partial close of orders

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #137910 quote
    rburger
    Participant
    Average

    Hi, I think partial closing a position in V11 is still not possible. Is this true or do I make a mistake?

    I want for instance buy 2 contracts and exit 1 very quickly bring the stoploss to break even and let the other contact run.

    If it is really not there, when can it be expected?

    Regards, Ronald

    #137913 quote
    GraHal
    Participant
    Master

    It is there as a capability in the Platform, but IG don’t allow us to use it!

    #137915 quote
    rburger
    Participant
    Average

    Hi GraHal, I would already be very happy if I can use it in backtesting on my paper trading account from IB. But that does also not seem to work.

    Do you know if that is correct?

    #137916 quote
    GraHal
    Participant
    Master

    Oh so with IB … you can do backtesting of strategy that you want to trade manual … is that correct?

    As we are informed that with IB you cannot do Auto-trading … is that correct?

    #137917 quote
    GraHal
    Participant
    Master

    We can do partial closures on our Demo Accounts on backtest and forward test, but not on Real Live.

    #137921 quote
    rburger
    Participant
    Average

    Thank you for your answers, and very strange it did not work for me. But now I test again…. off course it works.

    #137924 quote
    Nicolas
    Keymaster
    Master

    GraHal is right, it is possible in any but not yet in live trading.

    Automated trading with Interactive Broker (IB) should be available in a near future as I heard.

    #137925 quote
    rburger
    Participant
    Average

    Hi Nicolas, that is very good to hear. Thank you.

    #138047 quote
    schizz
    Participant
    Average

    Interesting news that automated trading should be available with IB soon. Presumably that will be with v.11?

    I suspect that if IB start offering A.T. on v.11 PRT traders will start leaving IG, and IG will then miraculously integrate v.11 with their platform.

    #168940 quote
    Lavallette
    Participant
    Average

    Hello,

    Could somebody advice what is the latest status on partial position closing?

    Several topics have been opened over time on this subject and situation is not very clear to me.

    From what I understood it is working with PRT v11 in backtest using code like the one described on

    https://www.prorealcode.com/topic/bollinger-band-coding-help-please/#post-80959

    or

    https://www.prorealcode.com/topic/code-for-partial-close/

    or

    https://www.prorealcode.com/blog/learning/partial-closure-positions-price-retracing-complete-function/

     

    But as of May 2021 is it working with PRT v11 PRO-ORDER (i.e. live trading) with IG and maybe IB?

    Thanks in advance.

    #168941 quote
    robertogozzi
    Moderator
    Master

    Currently Autotrading is only available through IG.

    Partial closing of positions is available with v11.

    To close the whole position you simply use SELL and EXITSHORT with no LotSize (at Market, Stop or Limit). To close it partially you just need to add the quantity you want to close):

    Sell        1 contract at MARKET
    Exitshort 0.6 contract at MyExitPrice LIMIT
    Exitshort 1.5 contract at MyExitPrice STOP

    Beware no to leave open a quantity less than the minimum required by the broker.

    Midlanddave, Lavallette and Maa thanked this post
    #179627 quote
    Reddington
    Participant
    Junior

    Ciao robertogozzi,

    Thanks for great input.

    How to make the code only exit half the position once, as i coded now, i exits half and then 1 minute later exit another half which i would like to keep as a runner. My current code:

    SHL = ((Positionprice+(Mystop*2)))
    SellHalfL = (Close > SHL)

    SHS = ((Positionprice+(Mystop*2)))
    SellHalfS = (Close > SHL)

    IF LONGONMARKET THEN
    IF ExitL THEN
    SELL AT MARKET
    elsif SellHalfL THEN
    SELL ClQ CONTRACTS AT MARKET
    elsif StopL THEN
    SELL Positionsize CONTRACTS AT MARKET
    endif
    endif

    IF SHORTONMARKET THEN
    IF ExitS THEN
    EXITSHORT AT MARKET
    elsif SellHalfS THEN
    EXITSHORT Clq CONTRACTS AT MARKET
    elsif StopS THEN
    EXITSHORT Positionsize CONTRACTS AT MARKET
    endif
    endif

     

    Br Anders

    #179666 quote
    robertogozzi
    Moderator
    Master

    Try replacing these two lines as follows:

    elsif SellHalfL AND abs(CountOfPosition) = PositionSize THEN
    elsif SellHalfS AND abs(CountOfPosition) = PositionSize THEN

    they should work, unless there is something affecting Positionsize elsewhere in your code.

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.

V11 Partial close of orders


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
rburger @rburger Participant
Summary

This topic contains 12 replies,
has 3 voices, and was last updated by robertogozzi
4 years, 4 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 07/01/2020
Status: Active
Attachments: No files
Logo Logo
Loading...