Simple example needed: Buy / Sell (max 2 positions)

Forums ProRealTime English forum ProOrder support Simple example needed: Buy / Sell (max 2 positions)

Viewing 2 posts - 1 through 2 (of 2 total)
  • #81737

    Hi, I’m struggling to pick up the lingo – mainly the financial stuff as I’ve got programming experience (but not been trading much). Apologies therefore for some stupid questions.

    I’m looking for a very simple example that I can build on, e.g.:
    1. Open 2 positions: BUY and SELL
    2. If the BUY price goes up by X% compared to the opening rate, close the BUY position and then open another
    3. If the SELL price goes down by X% compared to the opening rate, close the SELL position and then open another
    4. If either position goes into the red by Y%, close it and then open another in the same direction

    I only want one open position in each direction at any given time to limit exposure.

    I tried the below but it didn’t seem to work (opened too many positions?):

    A few questions also:
    a) Is the order fee taken into account for profit or loss (the last two lines in my example)?
    b) I also can’t figure out why, when I use the ProBacktest, the timescale resolution drives the number of positions that get opened? I only want two (one in each direction) at any given time. What settings should I use to simulate this?
    c) Do I need to set restrictions around trading days, e.g. not to buy/sell on Saturdays or Sundays or will orders for these days just be ignored?

    Many thanks in advance for any pointers! Once I get up to speed I will of course share my success (fingers crossed) 🙂

    #81749

    a) No, orders in backtests are sent at mid level, order fees are added in the settings window manually.

    b) It is not possible to hedge order with a contrarian one with ProBacktest/ProOrder. You can only buy or sell at the same time in the same strategy. Code is also read once per bar, at its Close.

    c) Yes, with Date & Time instructions.

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

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