set profit or stop loss after 3 bars

Forums ProRealTime English forum ProOrder support set profit or stop loss after 3 bars

Viewing 14 posts - 1 through 14 (of 14 total)
  • #10002

    is it possible to  set profit or stop loss if the trade is 3 bars in market ?

    this doesn`t work

     

    #10013

    Yes it would be possible, could you change and test your code with:

    Please let me know if it doesn’t work either.

     

    #10016

    Hi Nicolas,

    thanks for reply.

    In Backtest it doesn´t work, i´ll give it a try in live trading.

    #10019

    Do your orders are “on market” ones and not pending stop or limit ones?

    #10020

    The ordertyp is pending stop

    #10022

    Ok, but do you want your pending orders to have these TP/SL values after they have been placed for at least 3 bars or do you want the TP/SL to be set on these orders that have been triggered by price already (so now on market)?

    #10025

    My first idea was, ich used it first for better backtest Results.. So, that the trades are Minimum 2 candles in the market..second idea is, the Orders geht This Stop after they become triggerd.. Tanks for your Patient..

    #10027

    If I asked you the question about kind of trades you’d like to have this condition met, it’s because pending orders can’t have more than 1 bar old : they are deleted and re-placed at each bar (as long as you put them on).

    Ok, so the code I gave you should work for orders at market. Without your whole code strategy, I can’t be sure why it doesn’t work, so you can share me your code and I’ll be glad to debug it! 🙂

    #10032

    Hmm I get a clue from someone already affected by this.

    Setting takeprofit and stoploss must be made before 3 bar elapsed, so I suggest this code instead:

    Which should resolved the problem I believe.

     

    #10033

    thanks a lot .. i will test it.

    and this is the code without all the filters, this works on dax 15 min ..

     

    #10035

    Thanks for the code. I spotted some kind of “mistakes”, but don’t take it bad.

    1/ HOCH1 and HOCH2 are the same variable (they return the same value).

    2/ You can’t buy at a stop level of HOCH because it is the actual highest high and it’s currently moving if the price goes up. You should refer to HOCH[1] instead.

    3/ As I told you already in my previous post, you need to set up your stop order at each bar because IG delete pending order at each new bar (because of no expiration possible). So when you place your pending orders into a conditional statement like you made from line 28 to 30, your order only last 1 bar (because your condition ichi[1] only occurred one time) which maybe not sufficient for them to trigger.

    4/ Replace lines 32 to 35 with the code snippet I gave you.

    #10037

    both solutions did not work.

    whatever market entrance i try, direct trade openings with on market nor on stop buy orders.

    #10041
    1. yes they are the same, in my system a add somme different pips to it
    2. in Realtime trading it works, hmm, i will try hoch[1]
    3. in Realtime trading i put this one in a if Statement with some filters, and the system open on every new bar a new stop buy orde
    #10370

    Hello Guy I’m looking for a similar code which is: after 3 bars from market open / set stop at market entry . If you can give me any help thanks James.

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

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