Noob coding advice RSI stop

Forums ProRealTime English forum ProOrder support Noob coding advice RSI stop

Viewing 4 posts - 1 through 4 (of 4 total)
  • #186725

    Hi Team,

    Please be gentle with me, Im a complete noob and Im pretty sure my questions may be daft and basic. Anyway I`ve created a simple RSI strategy using the Simplified creation builder and applied it to the FTSE100 at 20min timeframe, on back-testing, it seems to turn a profit most of the time

    However, back-testing further, there are certain dates like Feb / March 2020 where the market took a severe nose dive or October 2020 where there was a sharp upturn and I was wrong side and get stopped out. Is there a way I can prevent it from opening positions when the market is moving in one direction or another sharply?

    Sorry if I sound like a complete noob.

    Code looks like this, thanks in advance:

    ===================================================

     

    DEFPARAM CumulateOrders = False // Cumulating positions deactivated

    // Conditions to enter long positions
    indicator1 = RSI[17](close)
    c1 = (indicator1 CROSSES OVER 29)

    IF c1 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF

    // Conditions to exit long positions
    indicator2 = RSI[17](close)
    c2 = (indicator2 CROSSES OVER 70)

    IF c2 THEN
    SELL AT MARKET
    ENDIF

    // Conditions to enter short positions
    indicator3 = RSI[17](close)
    c3 = (indicator3 CROSSES UNDER 70)

    IF c3 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF

    // Conditions to exit short positions
    indicator4 = RSI[17](close)
    c4 = (indicator4 CROSSES UNDER 29)

    IF c4 THEN
    EXITSHORT AT MARKET
    ENDIF

    #186753

    Yes, you can add two variables to enable, or disable, opening Long or Short trades by setting them to either 1 or 0. I named them GoLong and GoShort:

    1 user thanked author for this post.
    #186773

    I may be completely wrong, but I think what he’s looking for is more of  a trend detection – another condition that will prevent his trade opening in the wrong direction, or will cut out if the trend moves sharply against him ???

    for example

     

    2 users thanked author for this post.
    #186859

    Hi Guys,

    Thank you so much for you time and responses, much appreciated. I understand I can use additional indicators to determine if I should open a position, I guess Im wondering what specific indicators and values would prevent opening the trades on the dates where the markets fell or rose in a big way.

    Maybe some code that says if the market has shifted +/- 2% since open, dont trade?

    Thanks Again

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

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