my first strategy – beginner level

Forums ProRealTime English forum ProOrder support my first strategy – beginner level

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

    Hello,

    I am starting my first strategy, just to understand the logic of proorder and how things work.

    At this stage I am facing 2 issues:

    • how to take partiel profit (50%) at a certain level
    • have a dynamic stop loss:
      • close 100% if the bar after the entry does not confirm (red bar in case of a long trade)
      • else: stop moves below each bar low

     

     

    #42050

    Partial closure of position is still not supported by ProOrder.

    About your stoploss, the exit at each new bar low should operate nicely the way you have coded it. In the code below I implemented the exit on red candlestick:

    Not tested, please confirm.

    1 user thanked author for this post.
    #42142

    Hello,

    thx a lot Nicolas,

    I tested the proposed code and there still have an issue with the stop execution.

    normally the stop is set to the previous low (low[1]) but as you can see in the screenshot, it executes one bar later than expected. please advice if you have an idea to fix this.

    I tried both “sell at newStop STOP” between the if / endif and outside, but behaviour is the same.

    Below my code:

     

    #42149

    il  me semble qu’avec shortonmarket il faut mettre exitshort et non buy

    #42184

    Madrosat is right, if you want to exit a short position you should use “EXITSHORT” instead of buy (errors are contained in line 28 and 32 of your last code).

    #42276

    Thx gentlemen,

    I have re-written my code, but still struggling with the stop.

    the stop executes one bar late and at close price (not at the defined stop level)

     

    Below my code and I also attached the ITF file

     

    #42369

    Are you sure your “stoplevel” is correctly calculated? If the answer is yes, then the problem should come from the way you are putting your pending stop orders, because they are included in a conditional block, they may be put on market too late.

    #42490

    Hello Nicolas,

    thanks a lot for your help, I did several tests and it does not work correctly.

    could you please tell me simply how to set a stop at the previous low (for a long)?

    illustration in the screenshot.

    My current code (not ok):

     

    #42492

    my solution have been found here:

    https://www.prorealcode.com/topic/bullish-engulfing-breakout-bearish-engulfing/

    below the corrected code:

    PS.: some strategies that I have checked during my research for the stop are wrong, meaning the “lastStop = low[1]” that we can see in several strategies is not ok!!

    #42496

    Because the code is read at Close and position opened at the next candle open, you need to refer to Low[0]. When you find a variable not calculated correctly, use GRAPH! and the solution will come to you quickly 🙂

    1 user thanked author for this post.
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