If stopped out, dont trade for N days

Forums ProRealTime English forum ProOrder support If stopped out, dont trade for N days

This topic contains 5 replies, has 2 voices, and was last updated by avatar Vonasi 7 months, 1 week ago.

View all attachments
Viewing 6 posts - 1 through 6 (of 6 total)
  • #82460


    I’m struggling to write the logic to use when skipping trades for N days if last trade was stopped out. This is to avoid consecutive bad days in poor market conditions.

    Trying this on Usa500 daily 00:00-00:00 hours

    It will skip the third down day but still enter on the second which I’d want to avoid.

    Any ideas?


    You could try something like this:

    I’m guessing that you are trading daily candles?

    2 users thanked author for this post.

    Thank you, Vonasi! However that seems to work at one “SL streak” but at another one it persists? skipTrade is for some reason not propely set

    See attachments where I graph the skipTrade under the equity curve window

    Yes daily bars.


    It is difficult to understand what you think is not working from your description and images. I cannot see what time frame you are on or what the values of the candles are.

    The code as written will stay out of the market any time that the current candles low is less than the previous candles close minus 70. It does not know whether you were on the market with a trade or not.

    I just adjusted the code you provided to do what you wanted!


    I understand. I’ve attached the full strategy code if you’d like to test. On Usa500 (ES) 1eur contract daily bars 00:00-00:00 hours. Spread 1.6.

    As can be seen there are sharp drops in the equity curve at August 24 2015 and February 2 2018, which I was thinking could be avoided if not allowing consecutive trades around stop loss reached days.



    As far as I can see the reason for the poor equity curve at those times is because your entry criteria was met. 70 pips on the SP500 is a big drop and on the day of Aug 20 that condition was not met so a trade was entered at the open of the next day. On the Aug 23 the conditions were also met and another losing trade entered. On Aug 24 your 70 pip drop condition was met and no trade entered.

    Your code has a lot of unnecessary stuff in it so I edited it to make it more readable. Here is my ‘light’ version:

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