Conditions on number of trades, reversing trade direction

Forums ProRealTime English forum ProOrder support Conditions on number of trades, reversing trade direction

Viewing 15 posts - 1 through 15 (of 38 total)
  • #203818

    Good day, all! Hope all are doing well. Kindly ask community help on the coding some backtest example for the strategy.

    So, long story short:

    1. I enter with a buy stop to go long, or a sell stop to go short.
    2. I enter with 3 contracts.
    3. Position size: 3 contracts, with profit targets of 1R, 2R, and 3R. Once my first target is hit, my stop loss becomes breakeven.
    4. If I get stopped out on my first signal, I can stop out and reverse (Go long, get stopped, go short or Go short, get stopped, go long) – only 3 attempts per day.

    What I did so far: I can track multitimeframe, open and close positions, but can’t realize how to reverse trade if it fails with one direction, how to count correctly number of attempts, in which timeframe? and how to partially close trade.

     

    #203870

    I’ve been trying to code futher and debug, but when I put GRAPH I received an error. I don’t have any problem with internet, with software, but still receiveng this when added such lines in the code and adding Graph.

    #203872

    Try this as Line 12 to 14 …

     

    #203874

    So, thank you for the reply, I didn’t put all code. Here we go, with what I ended up right now

    What I still don’t get:
    1. How to determine that previous trade had a loss or profit after the close? Strategyprofit and Positionperformance don’t help me, I tried, but failed.
    2. Still have the error with Graph and XML, don’t know why, discovering

    #203885

    thank you for the reply

    My suggestion was in relation to the screenshot of the error you posted above.

    I just ran the code you posted in your last post above and I get no errors at all.

    How to determine that previous trade had a loss or profit after the close?

    Anybody please feel free to help mrbolt on above?

    #203886

    So, the last version, which still doesn’t work properly 🙁

    After closing in loss, new trade wasn’t opened.

    #203887

    thank you for the reply

    My suggestion was in relation to the screenshot of the error you posted above.

    I just ran the code you posted in your last post above and I get no errors at all.

    How to determine that previous trade had a loss or profit after the close?

    Anybody please feel free to help <span class=”bbp-author-name”>mrbolt</span> on above?

    So strange, to be honest 🙁 I don’t know why I’m receiving an error with XML when adding block on trying to turn trade direction as well. So, with commented block on new trade direction GRAPH works well.

    #203945

    So are you all good now?

    If not, make a brief clear statement on what parts / function in the code you need help / a solution?

    #203949

    Thanks for the asking, much appreciated. So, almost all, I’d say.

    Just have two qestions:
    1. What does it mean closing trade like Buy(exit) or Sell(exit)?
    2. Position size: 3 contracts, with profit targets of 1R, 2R, and 3R. Once my first target is hit, my stop loss becomes breakeven. – may you suggest about that, how to tackle it?

    #203952

    What does it mean closing trade like Buy(exit) or Sell(exit)?

    To Exit a Buy (i.e a Long trade) we use Sell.

    To Exit a SellShort (i.e. a Short trade) we use ExitShort.

    #203953

    Position size: 3 contracts, with profit targets of 1R, 2R, and 3R. Once my first target is hit, my stop loss becomes breakeven. – may you suggest about that, how to tackle it?

    Am I correct in saying that above is not (currently) in your code (posted above) in any form?

    So you are looking for somebody to post a new snippet which achieves what you ask for above?

    #203954

    Grahal, let me comment:
    1. Ok, about exiting what you mentioned, I understand, I don’t understand why I see such trades in the order list if I have stop loss all the time? I mean I see trades with label “profit” and “loss” and label “exit” appears so rare, but it appears, so, I’m trying understand what it is, may be some glitch in data or something else
    2. In general, it’d be great, but at least I’m seeking some clue how to do it

    #203962

    label “profit” and “loss” and label “exit” appears so rare

    Where are you seeing these labels? A screenshot will help loads.

    #203964

    So, here you go.
    1. You can find in in order list. Because of such “exit” trades I have wrong trade with another direction, you can see it for 21st October. Moreover, the difference is 1 point(?), like spread I put (?).
    2. Also, may you suggest what spread I should put for ES mini futures? I didn’t find yet what does it mean 1 points for backtesting.

    #203966

    Missed first one.

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

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