Crosses of a level

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5786 quote
    minmax
    Participant
    Average

    I have seen that the market will often test support/resistance levels 3 times before proceeding to the next level, I can’t work out the best way to keep track of the number of crosses (closes above/below?) in code, please help.

    Regards

    Steve

    #5788 quote
    Nicolas
    Keymaster
    Master

    What kind of support / resistance do you want to test?

    Test if price has crossed up or down a resistance/support price and count it by incrementing a variable.

    This is an example with a rebound on a moving average:

    mm = average[20](close)
    
    IF low < mm  AND close > mm THEN 
     count = count + 1
    ENDIF
    
    IF count = 3 THEN   
     BUY 1 LOT AT MARKET 
     // RESET COUNT 
     count = 0
    ENDIF
    #5794 quote
    minmax
    Participant
    Average

    Thanks Nicolas, that looks really interesting.

    It could be any support/resistance level, such as a pivot, a moving average, a high/low, a round number, I think your code will work for them all, just modify the mm entry.

    Regards

    Steve

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Crosses of a level


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
minmax @minmax Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by minmax
9 years, 10 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/22/2016
Status: Active
Attachments: No files
Logo Logo
Loading...