Announcement

Collapse
No announcement yet.

Looking for simple 2-bar reversal study

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Looking for simple 2-bar reversal study

    I'm not a programmer and would appreciate anyone's help with this simple (I hope) study.

    Condition for long:

    -Current bar opens within H/L range of prior bar
    -Current bar's H/L range drops below H/L of prior bar
    -Current bar closes back within or above prior bar H/L

    Reverse conditions for shorts:

    - Current bar opens within H/L range of prior bar
    - Current bar's H/L range rises above H/L of prior bar
    - Current bar closes back within or below prior bar H/L

    Obviously the signal could not be given until the 2nd bar prints. Would be great to see the pattern marked on the chart (e.g. arrow) instead of a lower-pane indicator.

    If this is something I should be paying for, could I please get suggestions for good custom programmers? There's a lot of very simple patterns I would love to have indicators for and I'd like to save my eyes somehow

    Mark

  • #2
    The following code is for a three bar strategy. Maybe you or someone else can tweak it to meet your needs.



    PHP Code:
      EFS Code:
    /*******************************************************************
    Description    : 3-Bar-Reversal-Pattern Strategy
    Provided By    : Developed by TS Support, LLC for eSignal. (c) Copyright 2002
    ********************************************************************/
    function preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("3BR");
        
    setCursorLabelName("3BR");
        
    setColorPriceBars(true);
        
    setDefaultPriceBarColor(Color.grey);
    }


    function 
    main() { 
        if(
    open(-2) > close(-2) && high(-1) < high(-2) && low(-1) < low(-2) && low() > low(-1) && high() > high(-1) + 0.25 && !Strategy.isLong())
                
    Strategy.doLong("Long"Strategy.MARKETStrategy.THISBAR);
        if(
    open(-2) < close(-2) && high(-1) > high(-2) && low(-1) > low(-2) && high() < high(-1) && low() < low(-1) + 0.25 && !Strategy.isShort())
            
    Strategy.doShort("Short"Strategy.MARKETStrategy.THISBAR);

        if(
    Strategy.isLong())
                   
    setPriceBarColor(Color.lime);
        if(
    Strategy.isShort())
                
    setPriceBarColor(Color.red);
        return;

    Comment

    Working...
    X