Stop moved to entry when in profit

Forums ProRealTime English forum ProOrder support Stop moved to entry when in profit

This topic contains 25 replies, has 4 voices, and was last updated by avatar Vonasi 4 months, 1 week ago.

View all attachments
Viewing 15 posts - 1 through 15 (of 26 total)
  • #75795

    Needing help to code so that the stop moves to entry (0) when the trade is in profit by a number of points?

     

    #75797

    I suggest to replace

    with

    to make sure it works with alla instruments.

    Your code seems fine, the only correction to make is line 30, since I don’t think setting a SL to 0 works, you’d better replace thet line with

     

    #75800

    You have long and short in the code so your stoploss change will not work anyway for both. Also Roberts suggestion of changing just the one line won’t work as if the price drops under the 25 pip gap the order will no longer be sent to market. You need something like this I think:

     

    1 user thanked author for this post.
    #75807

    Thanks, Ive made the changes however I get a syntax error, please help?

     

     

    #75808

    Sorry I see it didnt copy it all

     

    #75809

    OK so clearly you can see I’m not a coder!

    #75810

    Please use the ‘Insert PRT Code’ button when posting code. I have tidied up your posts as best as I can but there was a lot of lines that were not PRT code so I had to guess a little.

    I think your syntax error is because you have an ENDIF at the end of the code that you do not need.

    #75811

    Thank you so much, lets see how it behaves live tomorrow!

    #75841

    Ok, so it doesn’t work live

    #75842

    Line 32 does set BREAKEVENFLAG whenever you reach 25 pips, no matter whether you are in profit or loss, since it doesn’t tell between LONG and SHORT trades, I suggest replacing lines 32-34 with

    you could actually combine the two IFs in just one line, but that would make the code much less clear.

     

    #75843

    Thanks for spotting that Robert – you can tell that I never trade short – so my brain does not work very well in that direction!

    #75844

     

    #75845

    Is the above correct?

    When I try activate it for automatic trading I get:

    – Code is invalid. Please correct it.

    #75849

    To write code, please use the <> “insert PRT code” button to make code easier to read and understand. Thank you.

    #75853

    Is the above correct?

    When I try activate it for automatic trading I get:

    – Code is invalid. Please correct it.

    The only warning I get is that the variable BREAKEVENFLAG is not used. Why keeping it if you don’t use it?

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

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