Buying limit order if fail buy at market

Forums ProRealTime English forum ProOrder support Buying limit order if fail buy at market

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

    Hi,

    I just noticed my buy limit order was cancelled because the  price never hit the 50MA on the next bar.

    I’m wondering if there is a way to initially put buy at 50MA but should price not hit there in the next bar (hence limit order gets cancelled), if price is below 50MA buy at market (opening next bar), only if it didn’t buy at the 50MA.

    Again sorry if I put the code in incorrectly? I just click on insert PRT code and type it in?

    Let me know if this code below will work?

    thanks

     

     

    #75614

    Topic moved to the ProOrder forum as this is not an indicator based topic. Please try to post in the correct forum with future posts 🙂

    #75615

    Your code will work and do what you ask but if you prefer to buy at the 50MA then LIMIT and STOP orders last for one bar only so if you want them to stay on the market then you have to re-add them at every bar. Just put the LIMIT or STOP order in your IF NOT ONMARKET with your entry conditions and it will be re-applied at every bar close where your conditions for entry are still true and you do not have a position already open.

     

     

    #75616

    I currently have that code in your above format – but unfortunately it doesn’t work because my conditions include a low[1] <= ma50 and a high > ma50 along with some other specific things.

    So if the above conditions satisfy I buy at limit on the ma50. But if the next bar doesn’t get to the ma50, the trade is cancelled.

    I want to take the trade on the next bar if its lower than the ma50 (this is the missing part).

    So its a very specific condition which may not play out again on subsequent bars, so that code above doesn’t work in that type of loop, at least it didn’t in a live situation?

    As my order history just shows my limit order was cancelled and that’s it.

     

     

     

     

     

    #75617

    I think I understand what you want. First you want to place a limit order and then if that is not filled then buy on the next bar if it closes below the MA but if that does not occur then go back to the start and look to buy at the MA limit. This might work – not tested and after very little coffee.

     

    #75639

    Thanks for your help, I think the code does work, but I found something in the programming trading systems PDF which does what I’m after exactly.

    It will level the limit order in @ the 50ma for at least 10 bars before cancelling.

     

    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