Adjustment in code because combined stops can not be used with pro order

Forums ProRealTime English forum ProOrder support Adjustment in code because combined stops can not be used with pro order

Viewing 5 posts - 31 through 35 (of 35 total)
  • #107826

    If you SET your SL when placing orders, the second (short) will override the first one (long). Now think what happens if your long trade is entered, what kind of SL will it cope with?

    I suggest that you set you SL the next bar, when you are on market so you know what kind of calculation you have to do (but you must have saved your values before).

    #107853

    Hi

    This part of the code is not to add 60 points to my entry but 60 points to my sl. I want it to buy as close as possible to the high of the previous 6 bars (5 min) and sell as close to the low of the last 6 bars. I want the sl to be 60 points below the high for a buy trade and 60 points above the low of the last 6 bars.

    The problem i have is that its not placing trades in real time.. in backtest the code works but in real time it doesnt place any trades.. how can i change the code so that it does place a trade even if price is volatile and already moved and orders are too close to price?

    Another  thing is it also doesnt keep orders open till its filled,, if not filled in first 5 min it cancels all pending orders.

    Please run a backtest and see some days it doesnt place any trades. This is the code i have now.

     

    If you can please adjust code.

    Thank you

    #107855

    The problem i have is that its not placing trades in real time.. in backtest the code works but in real time it doesnt place any trades.. how can i change the code so that it does place a trade even if price is volatile and already moved and orders are too close to price?

    You can’t!

    PRT is just a trading platform. When you place an order it is sent by PRT to your broker. If it is below the minimum distance from the current price that your broker allows for an order on the instrument that you are trading then that order will be rejected by the broker. There is no fix and there is no work around. You have tried to place an order closer than your broker will allow and that is that and the order is rejected.

    #107862

    I suggest that you create a new constant to store the minimum distance required by your broker, then place a BUY/SELLSHORT pending order at a price that at least is equal to, or exceeds, such requirement (my example is 10 pips):

     

    #107868

    Roberto’s suggestion is the same as mine mentioned in this post:

    https://www.prorealcode.com/topic/adjustment-in-code-help-please/page/2/#post-107819

    It does however mean that you will sometimes not be entering at the price you think you should be. Their is also the additional problem that on faster time frames – for example in a 1 second time frame that price will likely creep up to your desired buy price and then when it is too close your minimum distance code will start moving your order level further away to ensure orders are not rejected. If you use a slower time frame then you don’t have this issue so much but you increase the risk of both your long and short orders being hit within one bar.

Viewing 5 posts - 31 through 35 (of 35 total)

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