How to place single stop order for a limited time?

Forums ProRealTime English forum ProOrder support How to place single stop order for a limited time?

Viewing 6 posts - 1 through 6 (of 6 total)
  • #39806

    Hi,

    I’d like to have a buy stop order in the market for a limited time, which is possible with the following simple code:

    I’d like the order only to be executed once in that time, which I solved with:

    Still easy, right?

    The tricky part is when I’m being stopped out on the same candle as the entry, so the code haven’t run again and realized that there’s already been an attempt at this trade which failed.

    I looked in the handbook as well, which had the following example:

    I haven’t really tried that one, since I suspect that the result will be the same as with my code.

    So, any ideas how to place a single stop order for a limited time?

    Cheers!

    #39920

    No ideas for this one?

    #39933

    Your first code is good. While the time condition is still true, the pending order will be set at market and because this kind of order only last one candlestick, no new stop order will be set after the “End” time variable value.

    If the trade triggered by the pending order opened and closed on the same bar, you can try to know an order has existed with POSITIONPERF, POSITIONPRICE, TRADEINDEX, TRADEPRICE ..

    #39972

    Worked like a charm! Thanks, Cheif!

    #39996

    If you managed your problem, would be cool to share your code for future reference for other people in trouble 😉 Thanks.

    #40023

    Yes, that was the plan, I just had to try it out last night to make sure it worked. I solved it like this, fairly simple and probably not the most sexy solution but it gets the job done:

    So basically:

    -At one time only, when it’s start to trade, set TRD = TradeIndex

    -Before adding another buy stop in the market, make sure that TradeIndex still equals TRD (since it has changed if a trade was taken)

    I guess the LongCounter variable is now pretty useless, but I’ll just leave it there for now.

    Thanks again!

    1 user thanked author for this post.
Viewing 6 posts - 1 through 6 (of 6 total)

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