Maximize profit based on the price move

Forums ProRealTime English forum ProOrder support Maximize profit based on the price move

Viewing 10 posts - 1 through 10 (of 10 total)
  • #182979

    Hi , Anyone can help with the below code please??

    the idea is to not exit a position if it is still going your way. So if longonmarket and it is in profit (+15 points) then update the target profit to 50 and only exit when the candle finishes lower than the previous candle.

    Not sure what is wrong, but it only changes the target profit and the second condition doesnt work.

     

    #182986

    Try this:

    #182994

    Intressting topic. An active TP need an active SL too.
    How do u manage SL in ur strategy Amin1233?

    #183006

    Hi Roberto. Still not working. I try to only add the second part to test and it just doesnt make any difference to the result which is impossible.

     

    if not OnMarket then
    flag = 0
    endif
    if longonmarket and close[0]-positionprice>15 then

    flag = 1
    endif
    if close[0]<lowest[1] and flag then
    sell countofposition contracts at market
    endif

    #183007

    Murre, I dont change the SL.In this strategy you wouldnt need Stop loss because when the price goes below the last bar it should exit.

    #183020

    Hi, “candle finishes lower than previous candle” is close[0]<low[1], not close[0]<lowest[1]

    1 user thanked author for this post.
    #183048

    thanks

    #184743

    Hi,

    The code above is a great idea but it is not working for me.

    Below the code I testen and the target is not moving despite of the fact that the close(0) – positionprice > 5

    What is wrong with the code?

    //profit & loss
    SET TARGET PROFIT 40
    SET STOP pLOSS 20

    if not OnMarket then
    flag = 0
    endif
    if longonmarket and close[0]-positionprice>5 then
    set target profit 50
    flag = 1
    endif

    if close[0]<low[1] and flag then
    sell countofposition contracts at market
    endif

    #184755
    JS

    Hi @RichardVeen

    Remove the “Set Target Profit 40” at the top of your code.

    (Otherwise it will reset every time to 40)

    #184766

    Yes, you are right, it is working!

    Thanks!

    1 user thanked author for this post.
    avatar JS
Viewing 10 posts - 1 through 10 (of 10 total)

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