Channel breakout system can't move stoploss level

Forums ProRealTime English forum ProOrder support Channel breakout system can't move stoploss level

Viewing 6 posts - 1 through 6 (of 6 total)
  • #32699

    I have a problem with my code.

    My code is a channel breakout system with pyramiding.

    My channel breakout system for the short side is:

    When the price breaks through 20-day low, I sellshort 1 position. (Pos #1).

    My stoploss is the low of the previous day (SL #1).

     

    My rules for pyramiding (Position #2, #3, etc.) are :

    Condition: The 20-day low has to be flat or rising for at least five days.

    As soon as I enter the second position (breakout of 20-day low) (Pos. #2), the stoploss of Pos #2 is the high of the previous day. I also move the stoploss of the first position (SL #1) to the high of one day before my second position entry day =previous day. (SL #1 à SL #2).

    Now I have 2 positions (Pos. #1, Pos.#2) with the same stoploss (SL #2).

     

    I have two more rules to filter out false breakouts after pyramiding.

    Rule1: On the breakout day (=first day) the close must be lower than 20-day low of the day before the breakout day.

    Rule2: One day after the breakout day (=second day) the close also must be lower than the 20-low of the day before the breakout day.

    If rule1 OR rule2 are broken I exit all positions at the close of the day.

    This prevents false breakout signals.

    If first day and second day both close lower, then I’ll let the positions run until

    • There is another condition for pyramiding.
      OR
    • The market reverses and my stoploss (SL #2) is hit.
      OR
    • The 20-day high becomes lower than my (previous day low)stoploss (20-day high < SL #2)- in which case I adjust my stoploss to the 20-day high (SL #2 change toà 20-day high) and it is hit.

     

     

    Here is my code.

    It’s not working as my rules.

    I can’t move my stoploss level lower.

    Please help me to fix my code.

    Thank you very much.

    #34107

    Could anyone help me?

    Please.

    Thank you very much.

     

    #34165

    Sure, but I must say that your code is difficult to read because of all these blank lines. Could you please repost it without the blank lines please? You can separate every IF/THEN block of course. Many thanks 🙂

    #34194

    Thank you Nicolas.

    I hope it is better now. 🙂

    I really look forward to your answer.

    I already struggle for a long with this code. Puuhhh

     

    #34542

    Thanks, I don’t understand the pyramiding function with “Condition: The 20-day low has to be flat or rising for at least five days.”.  So you are adding more sellshort orders if the price is rising above the first order? But in this case the first stoploss should have already been triggered? I think I should recode the whole thing to get a better comprehension of the strategy 🙂 Could you please add some screenshots of how the strategy should operate on a price chart please? Thanks in advance.

    #34646

    Thank you, Nicolas!
    I try to explain clearer. This is short-side pyramidding system.
    My first SL#1 is HIGH of previous bar (sorry – I wrote “low” in my desciption above).
    When the 20-day low channel broken to downside, I sellshort 1 position, and my SL is HIGH of last day (=previous day).
    I sellshort 2nd position if (20-day channel is flat or rising for at least 5 days (5-day Cond.)) AND (price breaks 20-day channel to DOWNSIDE).
    The SL for 2nd position is High of previous bar. I also want to automatically move the SL of 1st position to the 2nd pos. SL. (This is my main issue…)
    When the 20-day High channel become < SL#1, I want to switch SL#1 to follow 20-day High channel. Until enter 2nd pos., then move SL to SL#2.
    Very Sorry.!!.. My explanation was not clear for you!!

    I wait eveyr day for Nicolas brilliant code!! 🙂 Thank you! Thank you!!
    I make screenshot with all detail below. I hope you understand.

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

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