Limit Orders to Avoid Spikes

Forums ProRealTime English forum ProOrder support Limit Orders to Avoid Spikes

Viewing 10 posts - 1 through 10 (of 10 total)
  • #118828

    Hi,

    My code has been working as expected; yesterday trading the Dow on 10min candle, my conditions triggered and the system opened a trade on the 3pm candle open. However, the price spiked. The opening price of the candle was say 29,000 but in 1 second it spiked 50 points and opened a position for me at 29,050. Consequently it fell, stopped me out and I lost money.

    IG have said I should use LIMIT orders and at the minute I am using at market.

    So how do I introduce this LIMIT order  into my code, to say, if the price is 5 points (as an example) away from the opening candle, do not open a trade. Same for the sell side.

    Thanks

     

    #118861

    All the answers to most simple coding questions can be found in the manual.

    https://www.prorealcode.com/prorealtime-documentation/

    https://www.prorealcode.com/documentation/limit/

     

    #118864

    Thanks. So to be clear, would this code for long positions:

    change to:

    for short positions would it change from:

    change to:

    Thanks

     

    #118865

    I’m not sure to perfectly understand what IG is talking about. But, bear in mind that the code is read at the close of the candle and if the condition are fullfilled, then the order is opened at next bar open.

    Anyway, we could replace the AT MARKET with LIMIT orders to see how it goes, and to avoid gap, but I think that there will be some rejected orders that could lead to an automatic stop of the strategy, you should try this on demo platform first.

    #118867

    thanks Nicolas.

    what does LIMIT actually do then that you think it would stop the strategy and can I specify a “LIMIT distance” ie open a trade if within 5 points of candle open or reject?

    #118873

    I tried replacing AT MARKET with LIMIT but it comes up with an error. Any advice on what I should do here?

    #118912

    In your examples above you use OPEN. OPEN refers to the opening price of the just closed candle so it is likely that your order is sometimes the wrong side of current price for a pending order so it is rejected. Change OPEN to CLOSE.

    #119090

    ok thanks. will give it a try. See if I can avoid that happening again.

    I assume for short positions I should put ” at close -2 LIMIT”?

    #119102

    I think will be rejected because limit orders have to be at a better/more favourable price than current price.

     

    Will mean that if the next open is the same as the current close or the market gaps up then your order will be filled at the opening price.

    There is the possibility that this order could also be rejected if the broker sets a minimum order distance from price. They do for STOP orders but I’m not certain if they do for LIMIT orders. However as Nicolas suggested just putting the idea live in demo should tell you if this is the case or not.

    #119114

    Thank you both. Will give it a whirl. The previous code worked fine 6 times but on Monday price shot up and filled my order 50 points away…very odd.

     

    Thanks

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

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