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 15 posts - 1 through 15 (of 35 total)
  • #106303

    I need some help with this code please. First of all i cant run it on pro order because i get an error saying combined stops can not be used with pro order. Is there anyway i can change code so that it places sl first and when trailing conditions become true it cancels SL and continue with trailing? Will this be possible and how must i change the code..

    Second I want to add like a buffer to the entry. For example if the close of candle is at 50 000 i want to add maybe 20 points so that my entry is at 50 020 and not exactly 50 000. Same for sell but just -20 points. Can someone please help me to change the code

     

    #106308

    Line 20 is not supported you have to choose whether using SET STOP LOSS LossValue or SET STOP TRAILING TraillingValue.

    Even if you write them on separate lines, the last line will override the previous one, no matter the order.

    I, and almost everybody else on this forum, use SET STOP LOSS LossValue, then add a snippet of code to trail stops in non-native form. Read https://www.prorealcode.com/blog/trading/complete-trailing-stop-code-function/ for a full working breakeven/trailing stop code.

    You may also read:

    https://www.prorealcode.com/blog/learning/trailing-stop-max-favorable-excursion-mfe/

    https://www.prorealcode.com/topics-tag/trailing/

     

    #106315

    Hi

    Thank you for the reply.. I will try and change the code.  DO you know how i can change my code to not buy exactly on the close high but to add 20 points. Because i need a small buffer. allot of trades just opens a buy immediately but then goes the other way. and if I had a small buffer of like 20 points it would not have taken the buy but the sell instead.

    I hope its clear to understand.

    Thanks for all the help

    #106317

    The simplest way is to use a pending Long(Short order, your line 13 would be (same for line 16, but using SELLSHORT):

    but pending orders only last one bar, so if a trade is not triggered and you still want it to be, you’ll need to place it again and again each candle.

    Or you can slightly modify your code to save your desired price (the one you had increased, then check when CLOSE is >= and enter a trade).

     

    #106532

    Hi

    Thank you very much for all your help and on the forum.. I changed the whole code with some codes you gave on other topics. I need your help please for the last time.(I hope)

    1. I think the code doesnt cancel the sell code when buy is triggered it will do both buy and sell on the same candle  Can you help me how i must change to fix this please.
    2. I want to add the function to add to a winning so if system enters a buy trade and price moves 50 points in my direction i want to add another trade to it. So i try to explain buy order at 50 000 then price moves up 50 050 then i want to enter another buy.. Both if possible be managed by trailing. I dont know if its possible.

    Thank you

     

    #106535

    I already answered this question for you in one of your similar topics. You seem to be asking the same questions in several different places!

    https://www.prorealcode.com/topic/need-help-with-automatic-a-strategy-for-dax-and-sa40/#post-105408

    You have to use MTF and trade in a faster time frame if you want to cancel a pending order when an opposite order is filled.

    #106667

    HI

    Yes but this is a new code that I need help with. So what you are telling me is that its not possible to cancel another pending order if one is activated?

    I dont have much coding experience and i need help please I am trying my best to code and learn but somethings i cant get right to work.. Thats why i am here to ask the experts.

    Please help me to get this code right.

     

    Thank you

    #106669

    Pending orders CANNOT ba cancelled because they are automatically cancelled by ProOrder at the closure of each candlestick. You simply need not place it again.

    #106693

    Yes it is possible to cancel one order if another one is filled (well within 1 second) but as I showed you in the other topic in order to cancel one order if another one is filled you have to use MTF and trade on the 1 second time frame otherwise the two orders are on the market until the close of whatever time frame candle you are using. So if it s a 15 minute chart you have 15 minutes in which both orders could be filled.

    As I also said before using the 1 second chart will limit your available back test data to just about two and a half days if you have 100k bars and double that if you have 200k bars.

    So someone could spend some time trying to work out what you are trying to do with the code (which seems a bit confused at the entry and exit part and also seems to be just other bits of code mixed together) but I doubt very much whether you will be happy with the results or that the back test on only two and a half days data would tell you very much at all about the strategies robustness.

    Perhaps you should just set out in clear and simple terms what the complete strategy theory is and then maybe someone who has been messing around with strategies for a long time can tell you why your theory might or might not work before someone goes to a lot of effort to convert it to a code that you are not happy with.

    #106695

    I spent five minutes on your last code example and I got it to at least open and close trades. Whether they are what you want I have no idea!

    Launch it on 1 second chart.

     

     

    #106843

    Hi Guys

    Thank you for the help.. I know my code is a few codes put together but it sort of does what is needed. I am not a coder and can really find someone who will write a complete code for me so i tried myself I want it to place a trade on the break of the 8:55 candle when market opens at 9:00. So when break up it buys and when breaks down it sell. I wonder of i can just change it somehow not to place pending order buy just buy at market when conditions are met. So not place stop order but just place order at market when price reaches the break, I am running it on South African 40 on 5 min timeframe. If you run it you will see that because of pending order it enters 2 trades on the same candle. Thats why i want to try and change it to just buy when it reaches conditions. If you can just help me to change the code so it buys at market rather then placing pending orders. And if buy is triggered it will not enter sell again if price moves a little down again. Because like you said it wont be possible to cancel pending orders in the same candle. With my exit of course i am trying to trail it as far as possible.

    Thank you in advance

     

    #106857

    In PRT you have two choices pending orders or buy at market. If you place any pending order then it will be on the market from the open of the next candle until the candle closes. There is no way to cancel it mid candle and there is no way to cancel any other orders mid candle if another order is filled. In fact there is absolutely no way to add an order or change an order mid candle.

    At market orders will simply be filled or closed at the opening price of the next candle.

    So unless you use a very fast time frame such as the 1 second time frame just like I have shown you on what now feels like several occasions then you are trying to do the impossible. It is not possible to buy at market mid candle – it is not possible to cancel orders mid candle – unless you do what I have suggest many times and use MTF!

     

    #106870

    Yes this i understand maybe you understood me wrong.. but because of this problem i just want it to buy on the high of the candle and sell on the low. It must not place any stop/pending orders but just buy on the high and sell on the low. like you do it manually if price reach the high i just click on buy or when it reaches low i just click on sell.. So if i understand correct it is not possible to do this? I dont want to place any pending order rather just buy or sell on this condition. Can it be done? I hope its clear. I know about the pending orders but cant it just buy and no go into a sell while still in the buy trade?

     

    #106876

    So when you say ‘buy’ you really mean  SELLSHORT and when you say ‘sell’ you really mean EXITSHORT. Trying to decipher what you are actually trying to do is hard enough without you saying buy when you mean sell!

    All orders are sent to market at candle open so if you want to set a price to SELLSHORT at then you can use a pending LIMIT order to enter at a better price and if you know what price you want to EXITSHORT at then send another pending LIMIT order to market to exit at at a better price than your entry price.

    To do what you want to do which is buy/sellshort at a price or sell/exitshort at a price you HAVE to use pending orders.

    So the conclusion is that – no you can’t do what you want to do -without use pending orders.

     

    #107148

    Hi

    Thank you for all the responses.. Can you please tell me whats wrong why the system will place trades on some days and other days not even though conditions were met? You can run it on 5 min chart South african 40.

    Thanks

Viewing 15 posts - 1 through 15 (of 35 total)

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