To describe a chart there’s some obvious parameters like open, high, low and close of each candle. If we are in a hourly chart (H1) and lets say its 12 o’clock, then the 11 o’clock candle is for us candle1, the 10 o’clock candle is candle2 and so on. Now we call open, high, low and close of candle1 o1, h1, l1 and c1. For candle2 it is o2, h2 etc.
Our Active Trader code vocabulary, the active code ends regarding single candles at o5, h5, l5 and c5.
From these parameters we deduce some other simple ones:
- r1 = c1 – o1 The amount of points a candle has been rising, we define until r3.
- f1 = o1 – c1 The amount of points a candle has been falling, we define until f3.
- x1 = h1 – l1 The amount of points from the high to its low, we define until x3.
- xx = average high – low of the last 10 candles.
- xl = average high – low of the last 24 candles.
The average parameters have an important role in Active Trader. A currency can have phases with very low or very high variation. In the metatrader chart it looks all the same. Making a code: open a Buy after a long rising candle is difficult without knowing how much is ‘long’. But: open a Buy after a candle that rises more than xx is a clear statement. As code: if (r1 > xx) …
In the page main strategy is described what the horizontal lines mean Active Trader draws. The lines in the chart mark the Highs and Lows of former days, weeks and month. Each line shows its meaning by mouseover:
- hhd1 is the highest high of the day before, hhd2 the high of the day before and so on
- lld1 is the lowest low of the day before, lld2 the lowest low of the day before that day
- hhw1 is the highest high of the week before, hhd2 the high of the week before it etc
- llw1 is the lowest low of the week before, lld2 the lowest low of the week before etc
- hhm1 is the highest high of the month before, hhm2 the high of the month before it etc
- llm1 is the lowest low of the month before, llm2 the lowest low of the month before etc
- hhd and lld are the highs or lows of the current day, they are used often in Active Trader. Possible would be also hhw, llw and hhm, llm but we never use them, so they are not defined in our code.
Whith the above described simple vocabulary and the known mathematical symbols >, >=, <, <= and != (not equal) it is already possible to make statements of details of a chart. To connect statements we use 3 logical symbols: && stands for and,
&! means and not and for or we use ||
But to save space and simplify the coding we create some additional signs.
- hh2 is the highest high of the last 2 candles. ll2 the lowest low.
- hh3 is the highest high of the last 3 candles. ll3 the lowest low.
- hh5 is the highest high of the last 5 candles. ll5 the lowest low.
- hh52 is the highest high of 5 candles but we start counting from candle 2 on. So the high of our latest candle is not included. ll52 describes the same for lows.
- hh55 is the highest high of 5 candles but we start counting from candle 5 on. So the highs of the last 4 candles is not included. ll55 describes the same for lows.
When you start analysing our codes and later building own codes you’ll see how helpful these expressions are. The following expressions describe events in the chart. We can already describe easily the situations shown below.
The price rises over the high of the week before but the candle is falling and closes below it. As code:
h1>hhw1 && o1<hhw1 && o1>c1
The price falls below the low of the week before but the candle is rising and closes above it. As code:
l1<llw1 && o1>llw1 && o1<c1
The shown codes you can put into the Strategy Builder like described there >>
Backtest of it show that this is already a code for a simple but profitable expert advisor. One can change the code a little and use hhw2 and llw2 or …3 or …4 or change the direction of the candle. Testing them you’ll see that the price reactions are fairly different. So it makes sense to distinguish which week is meant. In our code we use these statements to build filters. If we do the same tests regarding price reactions on lines that show highs and lows of month before the price reactions are different, not as clear as it is on ‘younger’ lines. And to not describe a new code line for every month we create some new chart events:
Left pic: monthpass1: candle opens above a month low, closes below it.
Right pic: monthpass2: candle opens below a month low, closes above it. In our code we write mpa1, mpa2.
Left pic: monthpass3: candle opens above a month high, closes below it.
Right pic: monthpass2: candle opens below a month high, closes above it. In our code we write mpa3, mpa4.
It doesn’t matter if the high or low of the month is from 2, 3 … or 6 month ago. We don’t include the month before because even the day before could be the month before. Highs and lows of more than 6 month ago are too ‘old’.
Left pic: monthtouch1: candle opens and closes below a month high, the high reaches above it.
Right pic: monthtouch2: candle opens and closes above a month high, the low is below it. In our code we write mto1 or mto2.
Left pic: monthtouch3: candle opens and closes below a month low, the high reaches above it.
Right pic: monthtouch4: candle opens and closes above a month low, the low is below it. In our code we write mto3 or mto4.
The following monthnear definition describe no events, they just inform that the price is near to a month high or low. Lines often have an effect as if they were magnetic. We just want to know before opening a trade, direction away from line, if we are near enough to the line, that our StopLoss is not triggered if the price reaches the line. The min. distance is always 80% of the StopLoss.
Left pic: monthnear1: candle high is below a month high.
Right pic: monthtnear2: candle low is above a month high. In our code we write mne1 or mne2.
Left pic: monthnear3: candle high is below a month low.
Right pic: monthtnear4: candle low is above a month low. In our code we write mne3 or mne4.
That’s it – nearly. One last special theme is treated in another page: the round numbers. Take a look at it in the middle of the page Filters and their settings >>
Or go to the Strategy Builder >>