Buy and sell zones

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #66599 quote
    Real ProReal Pro
    Participant
    Average

    Hi, I’d like to create a graphical representation for buy/sell zones.  I’d like to do this using a support/res code that I made.  It’s based on PSAR so that it doesn’t look ahead and can be used for backtesting.  The line is shifted 8 bars to the right.  If it works maybe I can add it to the library.

    Idea is that a close under the line is in the buy zone, or maybe a cross above = buy.   Any thoughts how I can improve it?  Thanks.

    //suggested parameters for x,y,z are 1,1,1
    
    PSAR = SAR[x,y,z]
     
    IF close crosses under PSAR then
    a = PSAR
    endif
    
    If close crosses over PSAR then
    b = PSAR
    endif
    
    if close<PSAR then
    p = b-(a-b)
    endif
    
    return p[8] coloured (0,0,0)
    
    //IF  close crosses under p then
    //DRAWARROWup(barindex, low) COLOURED(255,255,255)
    //ENDIF
    #66653 quote
    NicolasNicolas
    Keymaster
    Legend

    Thank you, I tried your indicator but found it difficult to know how to interpret this support/resistance line?

    sar-support-and-resistance.png sar-support-and-resistance.png
    #66689 quote
    Real ProReal Pro
    Participant
    Average

    The plotted line is just the buy zone; haven’t done the sell zone yet.  It works a bit like Bollinger bands.

    If you add a parameter ‘x’ to this line:

    return p[8] coloured (0,0,0)

     

    …you can shift it around and find where it gives the best signals.  I like to buy when it crosses back above the line from oversold.

    #66707 quote
    NicolasNicolas
    Keymaster
    Legend

    Oh I understand now, looking forward for the next step of your development 🙂

    #66886 quote
    Real ProReal Pro
    Participant
    Average

    This version adds high volume down bar as a buy condition.  Nicolas, would you mind backtesting on more data please?  I only have limited data through IG.

     

    // https://www.prorealcode.com/topic/how-to-highest10volume-but-only-of-down-bars/
    // Today's volume should be larger than the volume of the highest down day over the last 40 days
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    maxDay = 40
     
    maxDownDay = 0
     
    maxDown = 0
     
    FOR d = 1 TO maxDay DO
     
    r = Close[d] - Open[d]
     
    IF r < 0 and Volume[d] > maxDown THEN
     
    maxDown = Volume[d]
     
    maxDownDay = d
     
    ENDIF
     
    NEXT
     
    IF maxDownDay = 0 THEN
     
    maxDownDayVol = 0
     
    ELSE
     
    maxDownDayVol = Volume[maxDownDay]
     
    ENDIF
     
    cVol2 = (Volume > maxDownDayVol)// sample screener code
    
    ///////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////
    // Conditions to enter long positions
    indicator1  = CALL "SAR supp line"[2, 0.2, 10, 3]
    c1 = (close < indicator1) //or close<indicator1[1] or close<indicator1[2] or close<indicator1[3]
    
    IF c1   and cVol2 THEN
    BUY 5 CONTRACT AT MARKET
    ENDIF
    
    // Conditions to exit long positions
    indicator2 = CALL "SAR res line"[2, 0.2, 2, 3]
    c2 = (close >= indicator2)
    
    IF c2 THEN
    SELL AT MARKET
    ENDIF
    
    // Stops and targets
    //sET STOP pTRAILING 20  //pLOSS 50 //
    SET TARGET pPROFIT 10
    
    #66998 quote
    NicolasNicolas
    Keymaster
    Legend

    What I am supposed to backtest please? (instrument, timeframe..). I also do not have your indicator on my platform 🙂 (SAR supp line and SAR res line)..

    You should add the .itf file in your next post, it will come with the indicators as well.

    #67019 quote
    Real ProReal Pro
    Participant
    Average

    Overwhelmed now.  Have to do it another time.

    #67090 quote
    Real ProReal Pro
    Participant
    Average

    Add n and n1 to price pane.

    Sys.txt is the backtest file.

    Nicolas can you please test on DAX, WallSt and CL (2hr, 1hr, 30m and 5 m)?  Let me know if there’s any issues.  Thanks.

    n.txt n-1.txt sys.txt x-1522807690l48cp.jpg x-1522807690l48cp.jpg
    #67108 quote
    NicolasNicolas
    Keymaster
    Legend

    I moved the topic to automatic trading section. I add your library post at the end of the topic, because I think it would need more refinement before posting it there. Thanks a lot for this indicator and strategy ideas, I still did not have time to test it. Maybe someone will do before me? So n and n-1 are indicators and sys is the strategy.

    Did you made backtest on your side already?

    #67123 quote
    Real ProReal Pro
    Participant
    Average

    So n and n-1 are indicators and sys is the strategy. Did you made backtest on your side already?

    Yes.

    Yes, but it trades infrequently and I have only the data IG gives me, so the backtest is meaningless on such a tiny dataset (as is WF analysis).

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Buy and sell zones


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Real Pro @real-pro Participant
Summary

This topic contains 9 replies,
has 2 voices, and was last updated by Real ProReal Pro
8 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/28/2018
Status: Active
Attachments: 5 files
ProRealCode ProRealCode
Loading...