Coding buy/stop orders above or below the price but only for a limited time

Forums ProRealTime English forum ProOrder support Coding buy/stop orders above or below the price but only for a limited time

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

     

    I am trying to create some coding for what I believe should be a simple task but I just can not get my coding head around it. Would really appreciate some help.

    This is based on 4hr charts. I have a simple moving average crossover which I wish to trigger a buy order at a price 10 PIPS BELOW the trade price at the point of the crossover. If the price does not drop to that price within the next 2 bars/candles, then I wish to cancel the order.

    Likewise in reverse for a crossover triggering a sell order at a price 10 PIPS ABOVE the trade price. Also to be cancelled if price does not rise to that level within next 2 bars/candles.

    I have read the programming guide and done many forum searches on this, but still can’t find the solution. The coding shown illustrates how far I have got so far.

    Many thanks

    #98017

    You can use BARINDEX and count of bars to put the limit orders for a limited time:

    Save the BARINDEX in a variable when the MA cross occurs and compare it with the actual bar:

    Just do the same for your sell limit orders code.

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