how to sell at a certain price

Forums ProRealTime English forum ProOrder support how to sell at a certain price

Viewing 8 posts - 1 through 8 (of 8 total)
  • #60898

    Hello everyone,

    I’m new to probuilder and to this forum. Perhaps this question is so basic that maybe is the reason i didnt found any post about this.

    I’m trying to create a very simple strategy; If todays open is below yesterday high, then buy if price rallies 70 percent of the previous day’s range above the open. Selling should be triggered when price increases yesterday range from the buy point.

    For the buy I use an STOP with the price i want the buy order to be triggered, however the order is also conditioned to the fact that the rally should occur during today….also for selling it, I’m not really sure how to the refer to the “price” as it (something like “IF price > x then SELL…..)

    Can somebody help me understand how it would work?

     

    Thanks in advance!

     

    #60905

    Your STOP order will be cancelled at the close of each candle if no position is opened so if you are using this on a daily chart you will have no problems. If however you apply it on a smaller time frame then you will need to ensure that a new order is placed at the close of each candle if a position has not been opened.

    As for the SELL use:

    This will close the position at the end of a candle if the price is greater than x.

    An alternative is to sell at a specific price by using a LIMIT order.

     

    #60921

    Thanks a lot for your quick reply!

    The idea is to use daily candles, For selling i want the condition to be: “sell at certain price”, so if I use SELL LIMIT, will this order be ketp until is filled?  the sell price is based on the range of the candle previous to the BUY-day, so I haven find a way to keep this value until the day of sell comes (maybe it will be at 2 to 5 days) and then update it with the new value when a new BUY is triggered. Thing is, according to what i read, the logic we design by programming is repeated over an over, and a variable will be calculated on each loop, so how do i keep the value of the original range and how to updated once is not longer valid. I notice there is a “once” statement but it seems that once the value is set it cannot be changed, so in this case is more like “passing” the value to the next loop but being able to update it.

     

    Thanks again!

    #60930

    Sorry for the delay in this reply but I had to go to bed!

    If you use SELL AT x LIMIT then the instruction will be cancelled at the close of each bar so you will need to ensure that the instruction is repeated if you are still ONMARKET at the close of each bar. Maybe a better solution for you is to use SET TARGET PPROFIT  x  at the end of your code. Calculate the number of pips between your TRADEPRICE (or POSITIONPRICE) and the price you want to exit at with profit and set this as value x. This places a market take profit order that stays on the market until the position is closed or the value of x changes when a new order is placed and the old one cancelled. Supposedly you can set the value at zero to cancel the order altogether but that appears not to work at the moment so I would advise against using it until PRT have fixed that issue.

    #61021

    I really appreciate your help. Thanks a lot!

    #61886

    Good evening!

    Does anyone know the expression for: selling price>=purchase price that I can add to my other Exit conditions as below? Preferable being able to specify minimum % difference. I only buy long. THANKS!!

    Present enter and exit conditions:
    //Enter conditions
    if not onmarket and CBuy THEN
    BUY 50 CONTRACTS AT MARKET
    //Exit conditions
    ELSIF onmarket and CSell THEN
    SELL AT MARKET
    endif
    SET STOP %LOSS 5
    #61892

    They prefer it on here if you use the ‘Insert PRT code’ button when posting code to make it more readable. You don’t need to use ELSEIF. You could use:

     

     

     

     

    2 users thanked author for this post.
    #61952

    Excellent, thank you very much Vonasi.

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

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