different limit amounts for long and short trades

Forums ProRealTime English forum ProOrder support different limit amounts for long and short trades

Viewing 13 posts - 1 through 13 (of 13 total)
  • #86481

    Hi there,

    I am testing the following code.

    It seems that the short and long are both using the StopLimitShort param ignoring my StopLimit amount which is diffrent.

    Is there a way to set different target Profits for short and long orders?

     

    #86489

    Remove line 4 and, at line 5, replace IF with ELSIF.

    LongTriggered and ShortTriggered are likely to both retain value 0 and, not having other different conditions to filter trades, the code for SHORT trades is always read and executed (despite trades may not be opened due to DEFPARAM CUMULATEORDERS=Fslse) since it is simply written after the code for LONG trades.

    If you switch both code chunks then  STOPLIMIT will override STOPLIMITSHORT.

    1 user thanked author for this post.
    #86496

    Also if ur in a trade and want 1 stop for long trades, and 1 stop for short trades i guess u can use:

     

    #86497

    1 stop for long trades, and 1 stop for short trades

    Yes as you show above, but this means the SL is only effective on the next bar when the code can determine if the position is Long or Short.

    Better way is as below and then the SL is effective immediately after buy and does not have to wait until the next bar.

    Hope that makes sense?

     

     

    #86499

    aland‘s problem is the TP, not the SL which is the same for all trades.

    #86511

    Thanks guys,

    Yes, the problem I have is with target profit (and not stop loss)

    and…I do want both BUY and SELLSTOP orders which is why it is ok that they are both triggered one after the other (not if/else).

    What I am not sure about is why does each order share the limit (and maybe the SL as well)

    The questions are:

    1. whether or not I can set a separate value on each one of the orders as I originally planned
    2. set the limit anew on the next bar like (like jebus89 suggested) – I am not worried about it being on the next bar as it will still work, but not sure if it is possible or if there isn’t an easier method.
    #86525

    Not sure if the above would do what you want – not tested at all.

    1 user thanked author for this post.
    #86541

    Thanks Vonasi,

    I’ll test it.

    I am wondering why you need to set the limit twice in your code, once during the order and than again after it started running.

    Is it because each bar needs a new order and there is no “memory” between the bars?

    Also, a somewhat unrelated question. My code orders a buy and a sell at the same time but only one can be called at a time, Since the margins have gone up so much in the EU, have you guys considered opening just one order at a time. for example:

    if last position is closer to buy stop then to sell stop then create buy order else if sell is closer then close the current buy order and open sell order instead.

    or do you have any other way of working around the high margin requests?

     

    Thanks

    #86565

    Yes you have to repeat the orders as STOP and LIMIT orders only last one bar and are then cancelled so you have to place a new order at every bar.

    Unfortunately there is no coding solution that I know of to overcome the new higher margins – the only solution I’m afraid to say is a bigger bank balance to start with! 🙂

    I don’t really like strategies that chop and change from long to short opening and closing positions just because now long looks like a good idea and in the next moment closing what could have been a good trade if given some room just to go the opposite way. I much prefer two completely separate strategies – one long and one short. Most markets have very different characteristics when going down compared to up so I see no reason to combine the two. It is simpler to keep them separate even if it means that sometimes you might be long as well as short at the same time.

    #86579

    Yes you have to repeat the orders as STOP and LIMIT orders only last one bar and are then cancelled so you have to place a new order at every bar.

    I’m confused now, it’s not difficult! 🙂

    Isn’t below setting the limit order level at time of a buy and then the Order remains (no need to be renewed) until MyTargetLong is triggered (or any StopLoss is triggered or any SellShort is triggered)?

     

     

     

     

    #86580

    I am assuming that LongTriggered can switch back to 1 at any point due to whatever changing conditions are deciding its state. This means that you could place an order and have it filled and then at the next bar LongTriggered switches to 1 and no sell order is placed leaving you with a position on the market with no exit order to close it. Thus the need for separate sell/sellshort orders to be placed at every bar whilst long or short positions are open on the market.

    1 user thanked author for this post.
    #86583

    I looked at it again (now my grandson not wanting to do jigsaws! 🙂 ) and I was confusing myself!

    I was reading it as …

     

    #86585

    Now you are confusing me but as long as we are both confused then all is well with the world. 🙂

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

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