close half position when reach half limit and move stoploss to breakeven

Forums ProRealTime English forum ProOrder support close half position when reach half limit and move stoploss to breakeven

Viewing 15 posts - 1 through 15 (of 22 total)
  • #163347

    hi,

    can someone help me out with this? i want to close half my position when the market has reach have my limit and then move stoploss to breakeven.

    here’s what i got so far

    thank you

    #163348

    You cannot expect POSITIONPERF to equal 0.5% exactly. Change it to >=

    Also SET STOP pLOSS 0 does not set any stop loss – it simply cancels any stop loss on the market. Use SELL or EXITSHORT AT POSITIONPRICE STOP and place this order at every bar.

    1 user thanked author for this post.
    #163349

    Something like: (not tested)

     

    1 user thanked author for this post.
    #163350

    im getting an error for line

    at the “AT”

    #163351

    Sorry – I cut and pasted your code! Add CONTRACTS before AT.

    #163352

    does not seem to work. i got picture. if it worked then it should sell half and then breakeven with this example.

    #163358

    Yes it needs a little tweeking:

     

    #163397

    still the same result.

    i tried changing the codes but the results are still the same.

     

    #163398

    think i got it

     

    #163415

    My last code worked just fine when I tested it. You seem to have added a variable called longstoploss which is not declared at any value in your code!

    #163562

    my codes seems to work half the time. half being it close half and move stoploss to breakeven and the other one is when profit reaches half the limi, it closes half 2 times resulting closing the full trade. anyone got any ideas why?

    #163566

    As I said – I tested my code and it worked just fine.

    You changed the exit price calculation so that it is no longer a percentage using POSITIONPERF – why?

    It is highly likely that your problem is being created by the code that you are choosing not to show us – do you have any other stop orders in the code? Without all the information such as the value of longstoploss the instrument and time frame and the rest of the code it is very difficult for anyone to help you or see what you are saying is happening.

    A screenshot is worth a thousand words.

     

    #163569

    heres the screen shot  of what my current codes are doing on prorealtime.

    this is only for going long.

     

    #163572

    however, on ig trading the results r different. when it reached half my limit, it close half and another half. resulting in closing full.

     

    #163573

    this is the screenshot with the codes u suggested. line 52 to line 55 replaced with these

     

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

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