Coding Support and Resistance

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #120757 quote
    Francesco
    Participant
    Veteran

    I asked in the past if it was possible to consider the ProRealTrend automatic detections but seems it’s not.

    Considering that, is there a way to code support and resistance in general for the charts? Or at least something similar to these “hot zones” for the prices?

    It could be helpful for the development of the strategies, especially for forex.

    #120759 quote
    nonetheless
    Participant
    Master

    A Donchian channel can work well for that:

    //Donchian Channel
    Upper = HIGHEST[10](HIGH[1])
    Lower = LOWEST[10](LOW[1])
    Middle = (Upper + Lower) / 2
    c1 = close > Upper//breakout above resistance
    c2 = close < Lower//breakdown below support

    Adjust the number for how many bars to look back

    #120760 quote
    Nicolas
    Keymaster
    Master

    Please describe how to find those support and resistance zones, you should start from the beginning.. 🙂

    #120761 quote
    nonetheless
    Participant
    Master

    you should start from the beginning

    July 8th, 1932 the Dow closed at 41.22 – that’s a pretty safe support level. I’ll start to get worried if we fall below that.

    #120762 quote
    robertogozzi
    Moderator
    Master
    #120763 quote
    GraHal
    Participant
    Master

    that’s a pretty safe support level

    I reckon we may see the DJI around 23,500 as a floor before we start to go back up again?

    #120764 quote
    nonetheless
    Participant
    Master

    Yeah could be … there’s a rising trend line at around 24,000, but still, takes a brave man to call it. I’ve got my stoploss at the 1932 low, so I know I’m safe. 😉

    (nice bounce at the opening bell today, maybe it’s up from here?)

    #120765 quote
    Nicolas
    Keymaster
    Master
    #120766 quote
    GraHal
    Participant
    Master

    maybe it’s up from here?)

    Most likely a sucker’s rally just like the same price action in the last few days between 2:30 and 3:00 ish? i

    #120786 quote
    Francesco
    Participant
    Veteran

    First of all, thanks all of you for the contibutions and the participatory spirit. That always remind me how beautiful this community is.

    Coming back to the topic, i was talking about something very “dynamic”: the price touches n times a x wide zone (number of touches and width of the zone to be optimized for the specific timeframes of reference). Then the system “knows” that the n times touched and x wide zone is a support/resistance and i can operate on that.
    The VERY PROBLEM with this idea is that could be very difficult to coding the spot of the obliques s/r, because of the inability to find a common price touch area.

    I will read your guys topics and indicators suggestions as soon as possible, maybe i will find something also more interesting than this basic idea 🙂

    #120787 quote
    Francesco
    Participant
    Veteran

    To be considered over n and x, in a y number of last bars/time in order to “reset” support and resistance levels when a breakout occurs.

    #120791 quote
    robertogozzi
    Moderator
    Master
    #120814 quote
    Francesco
    Participant
    Veteran

    Thanks, i will study all the cases and try to develope the strategy I have in mind.
    If someone has more hints it’s welcome 🙂

    #120903 quote
    Nicolas
    Keymaster
    Master

    I think that one was great: https://www.prorealcode.com/prorealtime-indicators/zigzag-supdem-supply-and-demand-zones/

    But you’ll have to change the zigzag indicator to something else to be able to use the code in ProOrder. I heard that zigzag would be usable in the future but i’m not sure if it is in the pipe or not.

    Francesco thanked this post
    #120982 quote
    Francesco
    Participant
    Veteran

    Here’s a first try on NIKKEI 15M. Not so bad also on robustness test, put it on demo test.

    defparam cumulateorders = false
    
    once longtrading=1
    once shorttrading=0
    
    // Robustness Tester
    once j = 0
    once flag = 1
    
    if flag = 1 then
    j = j + 1
    if j > qty then
    flag = -1
    j = j - 1
    endif
    endif
    
    if flag = -1 then
    j = j - 1
    if j = 0 then
    j = j + random
    flag = 1
    endif
    endif
    
    tradeon = 1
    if opendate >= 20000101 then
    if barindex mod qty = 0 or barindex mod qty = j then
    tradeon = 1
    endif
    endif
    
    // General Settings
    EMA1 = exponentialaverage[10](close)
    EMA2 = exponentialaverage[70](close)
    bullish = close>EMA1 and close>EMA2 and EMA1>EMA2
    
    EMA1 = exponentialaverage[10](close)
    EMA2 = exponentialaverage[70](close)
    bearish = close<EMA1 and close<EMA2 and EMA1<EMA2
    
    // Strategy Settings
    f = 10
    c1=high[f] >= highest[(f)*2+1](high)
    c2=low[f] <= lowest[(f)*2+1](low)
    
    if longtrading then
    // Long
    if bullish and tradeon then
    if c2 then
    buy 1 contracts at market
    endif
    endif
    endif
    
    if shorttrading then
    // Short
    if bearish and tradeon then
    if c1 then
    sellshort 1 contracts at market
    endif
    endif
    endif
    
    // Stops and Targets
    set stop loss 100
    set target profit 350
    
    // Breakeven
    StartBreakeven = 100
    PointsToKeep = 25
    
    if not onmarket then
    BreakevenLevel=0
    endif
    
    // Breakeven Long
    if longonmarket and close-tradeprice(1)>=startBreakeven*pipsize then
    BreakevenLevel = tradeprice(1)+PointsToKeep*pipsize
    endif
    
    if BreakevenLevel>0 then
    sell at BreakevenLevel stop
    endif
    
    // Breakeven Short
    if shortonmarket and tradeprice(1)-close>startBreakeven*pipsize then
    BreakevenLevel = tradeprice(1)-PointsToKeep*pipsize
    endif
    
    if BreakevenLevel>0 then
    exitshort at BreakevenLevel stop
    endif
    
    1-1.jpg 1-1.jpg 2.jpg 2.jpg NIKKEI15ML.itf
Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.

Coding Support and Resistance


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 14 replies,
has 5 voices, and was last updated by Francesco
5 years, 12 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/28/2020
Status: Active
Attachments: 3 files
Logo Logo
Loading...