Help with coding indicator idea

1 view
Skip to first unread message

WC Maria

unread,
Mar 9, 2016, 10:42:16 AM3/9/16
to The Indicator Store
Pablo or anyone else who has used the Markers Plus can hopefully help me as I try my hand at automating certain signals I have been looking at for years.

I would like to mark on the chart with a market when the following conditions are meet for a bar.

A down arrow above the price bar when:
1. the bar has a high that is higher than the last 5 bars
2. the bar has a close that is lower than the open
3 the bar has a close that is lower than the close of the previous bar.

In reviewing the videos and emailing Pablo it looks like it can be done but it's not so obvious to me at this point.

My thought is that I have to

copy the open of the bar to myopen
copy the close of the bar to myclose
copy the close of the previous bar to myprevclose (using displacement of -1)
copy the high of the bar to myhigh
copy the high of 1 bar ago to myhigh1 (using displacement of -1)
copy the high of 1 bar ago to myhigh2 (using displacement of -2)
copy the high of 1 bar ago to myhigh3 (using displacement of -3)
copy the high of 1 bar ago to myhigh4 (using displacement of -4)
copy the high of 1 bar ago to myhigh5 (using displacement of -5)

Now do I use crossover to create historgram for each condition i.e. when myopen is higher than myclose etc.  When myclose is less than myprevclose

in the end I would have a condition that if cond1 is 1, cond2 is 1 and cond3 is 1 then plot the arrow?

This is where I am currently stuck.

Any advice.

Pablo Maglio

unread,
Mar 10, 2016, 5:30:06 PM3/10/16
to The Indicator Store
Here are some hints ;

A down arrow above the price bar when:
  1. the bar has a high that is higher than the last 5 bars
  1. the bar has a close that is lower than the open
  1. the bar has a close that is lower than the close of the previous bar.
    1) You need the Higher High of last 5 Bars
    Use the Indicator MAX(High,5)


     If this is what you need, then use the Copy Indicator to put that line into a variable.
    I suggest using a displacement of 1 bar, so current bar can cross above that level. Otherwise current bar high will become the higher high ;


    That means that you have to put the displacement on the Copy Indicator ;

    Now you have the Higher High of last 5 Bars counting from previous Bar ( not current ) copied into the variable last5barshigh

    2) a Close lower than the Open;
    Copy the Close to myclose
    Copy the Open to myopen


    3) the bar has a close that is lower than the close of the previous bar

    You already have current close in myclose, so only need to copy the previous bar close using displacement ;



    Now you have all the needed variables, but still need some calculations...

    ...like the distance between current Close and higher high of last 5 bars ( condition #1)

    Use the XO Indicator ( disable its paint options, or at least the down signal option ) ;

    And you get something like this ;

    You are only interested in the positive histogram ; higherhigh > 0


    Calculate the distance between myclose and myopen ( you get another histogram and a new variable ; example ; close0open0


    Calculate the distance between myclose and myclose1 ( you get another histogram and a new variable ; example ; close0close1



    I suggest setting all previous XO indicator with the paint option disabled to avoid confusion


    Now, on the AND Indicator you can set each condition ;

    1. higherhigh > 0
    2. close0open0 < 0
    3. close0close1 < 0
    Please post any question or comments....
    Pablo

    Reply all
    Reply to author
    Forward
    0 new messages