# Orientation – Momentum

I will introduce the ORIENTATION entity that will have attributes describing the market, and the MMS System which will activate automatically the rule corresponding to the Market map after having analyse the Market Map . Actually I am hesitating in implementing the Market Map using a Neuron Network simulator (which is a little heavy) or using binary matching of the periods of the indicators. (i will talk about it later).

Here I’ll discuss how we can determine a market orientation and the things we should focus on at any moment to keep in head a clear look of the market.

To be able to do so we must clearly define the terms we are using when we say Long term orientation, Medium term orientation and short term orientation.

The common periods that traders work on goes from 1 minute chart to the monthly chart. So which period chart we should look and how to look and where to look is personal to every trader and this why new traders are a little bit disturbed when they start trading by seeing all these indicators but in fact things are much easier and this is how I see it.

Here are the chart periods in MT4 :

M1 M5 M15 M30 H1 H4 D1 W1 MN

if for instance the moving average (7 period on my period chart) is UP , I mark for this indicator 1 for the corresponding period otherwise 0.

let’s suppose it is below for period M1, below for the period M5, below for M15, above for M30 , H1, H4 and below D1 and above W1 and MN here how it is represented :

0 0 0 1 1 1 0 1 1

and here how to analyse this representation : I have a down short term trend (M1 , M5, M15) in a up medium-short trend (M30, H1, H4) in a down medium trend (D1) in a up long term trend (W1, MN). but who cares ? let’s continue

OK I already gave a definition for my Long Term Orientation : W1 and MN are the periods . Now by looking at the 2 final digits I can Have a clear image of the long trend , in our example it is UP because it is (1 1).

in case we had 0 1 this means that weekly we are down but monthly we are still up so we can say that the Long term Orientation is reversing down.

now let’s represented by reversing the digits we will have : 1 1 0 1 1 1 0 0 0 . Here we have a binary representation of a number which is 440.

if we are up only for the monthly period we have : 1 0 0 0 0 0 0 0 0 and this is 256 in decimal.

for the weekly chart only we have : 0 1 0 0 0 0 0 0 0 and this is a 128 in decimal.

if we have the weekly and the monthly only : 1 1 0 0 0 0 0 0 0 and this is 384. (128 + 256)

So to every market configuration I have a number for my moving average indicator that goes from 0 to 511

511 means all my moving average are up and 0 all are down.

So here is the function that give us the number for my current indicator :

All (MA_7, S_UP)

it returns the decimal number corresponding to my representation for the periods of my MA_7 indicator.

if my decimal number is below 128 this means that the weekly and monthly periods are (0 0) .

Notice that here my decimal representation is not linear in a sense that my monthly period is 4 times my weekly periods and the number is two times bigger.

- m1 1
- m5 2
- m5_m1 3
- m15 4
- m15_m1 5
- m15_m5 6
- m15_m5_m1 7
- m30 8
- m30_m1 9
- m30_m5 10
- m30_m5_m1 11
- m30_m15 12
- m30_m15_m1 13
- m30_m15_m5 14
- m30_m15_m5_m1 15
- h1 16
- h1_m1 17
- h1_m5 18
- h1_m5_m1 19
- h1_m15 20
- h1_m15_m1 21
- h1_m15_m5 22
- h1_m15_m5_m1 23
- h1_m30 24
- h1_m30_m1 25
- h1_m30_m5 26
- h1_m30_m5_m1 27
- h1_m30_m15 28
- h1_m30_m15_m1 29
- h1_m30_m15_m5 30
- h1_m30_m15_m5_m1 31
- h4 32 // H4
- h4_m1 33 // H4 M1
- h4_m5 34 // H4 M5
- h4_m5_m1 35 // H4 M5 M1
- h4_m15 36 // H4 M15
- h4_m15_m1 37 // H4 M15 M1
- h4_m15_m5 38 // H4 M15 M5
- h4_m15_m5_m1 39 // H4 M15 M5 M1
- h4_m30 40 // H4 M30
- h4_m30_m1 41 // H4 M30
- h4_m30_m5 42 // H4 M30 M5
- h4_m30_m5_m1 43 // H4 M30 M5 M1
- h4_m30_m15 44 // H4 M30 M15
- h4_m30_m15_m1 45 // H4 M30 M15 M1
- h4_m30_m15_m5 46 // H4 M30 M15 M5
- h4_m30_m15_m5_m1 47 // H4 M30 M15 M5 M1
- h4_h1 48 // H4 H1
- h4_h1_m1 49 // H4 H1 M1
- h4_h1_m5 50 // H4 H1 M5
- h4_h1_m15 52 // H4 H1 M15
- h4_h1_m15_m5 54 // H4 H1 M15 M5
- h4_h1_m15_m5_m1 55 // H4 H1 M15 M5 M1
- h4_h1_m30 56 // H4 H1 M30
- h4_h1_m30_m1 57 // H4 H1 M30 M1
- h4_h1_m30_m5 58 // H4 H1 M30 M5
- h4_h1_m30_m5_m1 59 // H4 H1 M30 M5 M1
- h4_h1_m30_m15 60 // H4 H1 M30 M15
- h4_h1_m30_m15_m1 61 // H4 H1 M30 M1
- h4_h1_m30_m15_m5 62 // H4 H1 M30 M15 M5
- h4_h1_m30_m15_m5_m1 63 // H4 H1 M30 M15 M5 M1
- d1 64
- d1_m1 65
- d1_m5 66
- d1_m5_m1 67
- d1_m15 68 // D1 M15
- d1_m15_m1 69 // D1 M15 M1
- d1_m15_m5 70 // D1 M15 M5
- d1_m15_m5_m1 71 // D1 M15 M5 M1
- d1_m30 72 // D1 M30
- d1_m30_m1 73
- d1_m30_m5 74
- d1_m30_m5_m1 75
- d1_m30_m15 76 // D1 M30 M15
- d1_m30_m15_m1 77
- d1_m30_m15_m5 78 // D1 M30 M15 M5
- d1_m30_m15_m5_m1 79 // D1 M30 M15 M5 M1
- d1_h1 80 // D1 H1
- d1_h1_m1 81
- d1_h1_m5 82
- d1_h1_m5_m1 83
- d1_h1_m15 84
- d1_h1_m15_m1 85
- d1_h1_m15_m5 86
- d1_h1_m15_m5_m1 87
- d1_h1_m30 88 // D1 H1 M30
- d1_h1_m30_m1 89
- d1_h1_m30_m5 90
- d1_h1_m30_m5_m1 91
- d1_h1_m30_m15 92 // D1 H1 M30 M15
- d1_h1_m30_m15_m1 93
- d1_h1_m30_m15_m5 94 // D1 H1 M30 M15 M5
- d1_h1_m30_m15_m5_m1 95 // D1 H1 M30 M15 M5 M1
- d1_h4 96 // D1 H4
- d1_h4_m1 97
- d1_h4_m5 98
- d1_h4_m5_m1 99
- d1_h4_m15 100
- d1_h4_m15_m1 101
- d1_h4_m15_m5 102
- d1_h4_m15_m5_m1 103
- d1_h4_m30 104
- d1_h4_m30_m1 105
- d1_h4_m30_m5 106
- d1_h4_m30_m5_m1 107
- d1_h4_m30_m15 108
- d1_h4_m30_m15_m1 109
- d1_h4_m30_m15_m5 110
- d1_h4_m30_m15_m5_m1 111
- d1_h4_h1 112 // D1 H4 H1
- d1_h4_h1_m1 113
- d1_h4_h1_m5 114
- d1_h4_h1_m5_m1 115
- d1_h4_h1_m15 116
- d1_h4_h1_m15_m1 117
- d1_h4_h1_m15_m5 118
- d1_h4_h1_m15_m5_m1 119
- d1_h4_h1_m30 120 //D1 H4 H1 M30
- d1_h4_h1_m30_m1 121
- d1_h4_h1_m30_m5 122
- d1_h4_h1_m30_m5_m1 123
- d1_h4_h1_m30_m15 124 //D1 H4 H1 M30 M15
- d1_h4_h1_m30_m15_m1 125
- d1_h4_h1_m30_m15_m5 126 //D1 H4 H1 M30 M15 M5
- d1_h4_h1_m30_m15_m5_m1 127
- w1 128
- —
- mn1 256
- —

551

As you can see from the decimal number I can know which moving average is up or down for all my periods.

Now let’s filter our number as we want to classify the orientation.

If I say that my long term orientation is W1 and MN we do a logical And Operation with : 0 0 0 0 0 0 0 1 1

If I say that my Mid term orientation is H1 H4 I do a logical And Operation with : 0 0 0 0 1 1 0 0 0 . the result here should give me these numbers (0, 16, 32, 48) 0 that means H1 and H4 are down, 16 means only my H1 period is up 32 means that only my H4 period is up and 48 the two of them are up.

If we look at the periods , we just classify our Long Term Orientation with flags of the MN and W1 periods. What’s about the Medium and the Short Term Orientation ?

if we look at the periods from D1 we can notice that D1 is 6 times H4 and H4 is 8 times M30 which is much more representative than H1 as H4 is 4 times H1 so if I should represent my Medium Orientation I will choose D1 , H4 and M30.

To analyse our Current Market Map we can say that D1 will represent the main orientation (up or down) , H4 the movement inside the Orientation and M30 the momemtum . So by looking at the M30 period I should look at the indicators that represents the momemtum of the market .

Here I am going a little bit fast but I will explain more later.

As for the Short Term Orientation , I will have H1 , M15 and (M5, M1). H1 is 4 times the M15 period which is 3 times M5. and M5 and M1 are the momentum.

Long Term Orientation [MN, W1]

Medium Term Orientation [D1, H4, m_30]

Short Term Orientation [H1, M15, (m_5, m_1)]

I put in small letters periods corresponding the momentum

if we look back at the binary representation , to determine my orientation we do an And logical operation with :

1 1 0 0 0 0 0 0 0 for long term

0 0 1 1 0 1 0 0 0 for medium term which gives the decimal numbers (d1, d1_h4, d1_h4, d1_h4_m30, h4, h4_m30, m_30) see above

0 0 0 0 1 0 1 1 0 for the short term whic should give us the decimals (h1, h1_m15, h1_m15_m5, m_15, m_15_m5, m_5)

The main Orientation is represented by the left digit, the movement the middle digit and the momentum the right digit.

DON’t forget that the orientation doesn’t mean that we should buy or sell it gives an image of the current market. we can have a midterm orientation equal to d1_h4_m30 and 2 seconds after the market start its long down trend .

So what for to determine the orientation ?

The orientation by itself is not important but what’s important is the transition between these representation and the momentum flag .

I explain by an example. Let’s choose to work on a mid term trade , and we have (1, 1, 1) orientation of the Slope indicator.

(1, 1, 1) means my slope is UP for the (D1, H4, M30) periods, at (t + 1) I have now (1, 1, 0) representation of my orientation , that means we have maybe a starting point of retracement. What we do? shall we exit if we have a position or not. Here we look at the indicators which are the most sensitive to the momentum for my period m30.

I classify them by importance :

Acceleration

## Volume

and Moving average (position, angles)

These are the most important indicators that can tell if a market is strongly reacting or not and that’s why for my short term orientation the period M5 is very important to watch as I mentioned already the m5 represents the momentum.

So whenever we have a transition from (1, 1, 0) to (1,0, 0) and then to (0, 1, 1) …. etc My transition combined with the momentum indicators will tell me when to enter a trade and when to exit.

Ok here is the idea , I will detail with examples the two orientations MidTerm and ShortTerm and what are the indicators that I watch during an Orientation representation

## Velocity

Too few traders look at the velocity indicator … very strange but it is the start point of a market trend and that’s why I will talk here about it. In the package you can find the PG_TP_Velocity file. You put the parameter len to 10 because the default value is 14 I forget to change it. In Progress I use it with a 10 Len.

Look at it for the period M5. Below is the picture where you can find the velocity in Progress surrounded in a white rectangle.

you can see -4/-1 ===> VELOCITY/ACCELERATION

the actual value is -4 for the velocity

and -1 is the variation from a bar before

In our Example the market is calm and here there is no sign of a brutal movement. It is important to know !!!! You dont always need an important news to have a brutal movement of the market … So here is the first alert if a sudden movement should happen.

The value should stay between [-15, 15].

the second value which is very important is the variation of the velocity (acceleration) this value should not exceed the [-4, 4] values.

for instance if we have a velocity of 20 which means that the market had a fast run up and an acceleration of -6, this means that it is reversing in a fast way and this is the paramater that you should take.

So FIRST we look at the ACCELERATION… and after on the VELOCITY …

if we have 4/ 6 this means that market is running up. even if the velocity is under 15.

Keep always in mind that we use it for M5 period and M30 period , the first for the short term orientation and the second for the Medium term orientation … I will give you the parmeters of the intervals for the M30 period later.

Hi Guys

**I have a quick question regarding the installation process. All files I have been copied to my trading root folder as instructed. When I try to run PG_expert advisor the system rejects the command error “Can’t open broker c:<subfolder-path> PG_Broker.csv. The installation procedures says that I should create one. Is any chance to have a look on an example. So far I couldn’t find any clue. **

Check if you can create files in the folder <brokertroot>/experts/files , normally this file is created automatically, now another way to solve the problem is to take the example of the file attached and fill an entry with the Terminal Name and a port. The terminal Name you have it in the trace of the experts Tab of the Terminal Window (the one where you look at your orders). When you launch PG_Expert you have a trace saying TERMINAL NAME : xxxxxx, you copy paste the xxxxx and you replace the first field in PG_Brokers.csv with this one, the other field is the port , leave it as it is.

OK I can’t upload attachment so what you do is to create an empty file that you call PG_Brokers.csv in experts/files in notepad and you write the line : xxxxxx, 2010

let me know if it doesn’t work.

Here is the code :

int v_period = period[x]; // number of minutes for the corresponding period

if (TimeOpenBar[0] != iTime (0,PERIOD_M1,0))

{

vol1u=0;

vol1d=0;

for (int i = v_period + 1 ; i <= v_period <<1; i++)

{

h = iClose(0,PERIOD_M1, i);

l = iOpen (0,PERIOD_M1, i);

if (h > l + Threshold)

vol1u += iVolume(0,PERIOD_M1,i);

else

if (l > h + Threshold)

vol1d += iVolume(0,PERIOD_M1,i);

}

volu[x] = 0;

vold[x] = 0;

for (i = 1; i <= v_period; i++)

{

h = iClose (0,PERIOD_M1,i);

l = iOpen (0,PERIOD_M1,i);

if (h > l + Threshold)

volu[x]…

Jurex – need to ask again for your help – I am trying to make an indicator out of this but failed so far – based on my rather limited coding knowledge, there are several un-defined variables in the code provided (eg vol1u, vol1d and Threshold) …. Your time permitting, would you please be so kind and share the corresponding mq4 with me / us….

I modded the velocity indicator to show

– acceleration as as histogram

– pure acceleration as oscillator

to help me visualize this concept over time.

Mob, sorry I just put the code trying to take out everything related to PROGRESS. I attach a clean one with some comments. AS you can notice I calculate all my previous bars except for the current bar and this on a 1 minute basis.

If you want to do an indicator out of this , just look at this :

let’s say

volu is the current volume on up bars

vold is the current volume on down bars

pvolu is the previous volume on up bars

pvold is the previous volume on down bars.

One important variable is (volu – pvolu) – (vold – pvold), this gives you the variation of the up volume and down volume in time. if the result is negative and the total volume up is positive that we are maybe reversing. look at it this parameter for bigger periods.

Here for all periods we will have the same basis for volume which is P_M5.

Thanks for the indicators you just attached, I will check them now.

Attached File

Jurex, thanks a lot but there are no buffers defined, so no output on chart…. which variables should be the output? I probably can do the rest with that information…

Sorry for all trouble on a weekend

Mob, No trouble at all but I just put the squelette of the file , I mean just the function , it is up to you to write how you want to do your indicator. If you want it as a histogram or as a graph, as for the output you can use the total volume (but this you have it in the MT4 indicator) , or maybe you can do an histogram with down volume red down oriented and the up volume green up oriented , and you can add on top of it a graph indicating the variation I just spoke about in my previous comment. Maybe I’ll write a complete indicator file this way when I will have time and I deliver it.

Volume

Another important indicator is the volume , here also the M5 period is very representative, and here also very few look at it . As the Mt4 Volume indicator doesn’t give the volume on up bars and down bars I wrote one. It calculates the period bars in minutes for all periods so we have the actual volume for the last number of minutes .

I advise you to use it even if you are NOT using PROGRESS …

Here is the code :

int v_period = period[x]; // number of minutes for the corresponding period

if (TimeOpenBar[0] != iTime (0,PERIOD_M1,0))

{

vol1u=0;

vol1d=0;

for (int i = v_period + 1 ; i <= v_period <<1; i++)

{

h = iClose(0,PERIOD_M1, i);

l = iOpen (0,PERIOD_M1, i);

if (h > l + Threshold)

vol1u += iVolume(0,PERIOD_M1,i);

else

if (l > h + Threshold)

vol1d += iVolume(0,PERIOD_M1,i);

}

volu[x] = 0;

vold[x] = 0;

for (i = 1; i <= v_period; i++)

{

h = iClose (0,PERIOD_M1,i);

l = iOpen (0,PERIOD_M1,i);

if (h > l + Threshold)

volu[x] += iVolume (0,PERIOD_M1,i);

else

if (l > h + Threshold)

vold[x] += iVolume (0,PERIOD_M1,i);

}

}

vol0u = volu[x];

vol0d = vold[x];

Here also it is the number just above the velocity which is 70/40 for the period M5

[70/40] It means the volume for the Up bars (close > Open) is 70 and the volume of the down bars (close < open) is 40. My total volume is 110 that you can check in the volume indicator of MT4.

My limit parameter for the M5 period is 175 that means when the total volume exceed 175 we are in front of a sharp movement.

We have also the volume variation that I should add also in the panel that gives the variation of the up and down between two bars.

Ok so we saw two of the parameters that will be calculated in my Momentum Design of a market orientation

Just to finish about velocity, look at the actual market and what happens last night. We had a very calm day yesterday, and very boring and see how it jumps at 3.25 timezone in my picture. The Velocity indicator reaches 15, we had a run of 40 pips in a very short time.

Actually the acceleration is 5 and the velocity 9.

The volume is 277 which is above our average of 175.

Hi mobthehop and thanks to you.

I was searching for a velocity algorithm on the net and I just found J_TPO_Velocity indicator. You have it in the package of PROGRESS. If you don’t find exactly the same number , it is just because I use it with the Extern parameter Len = 10. I didn’t go in details to explain to you the algorithm but I think the idea is to go back and look for the Highest High and the lowest low and see the variation in a time interval.

As for the acceleration I just substract the current value to the previous one. If I refer to the post 20 I just put in the panel window for the period P_M5 the value : SValue (VELOCITY, S_CUURENT, P_M5) / SValue (VELOCITY, S_CURRENT, P_M5) – SValue (VELOCITY, S_PREVIOUS, P_M5).

**The variation of the velocity gives me simply the acceleration.**

**Personnaly I only use it for P_M5.**

I hope I answered your question.

**Hi mobthehop and thanks to you.
**

**I was searching for a velocity algorithm on the net and I just found J_TPO_Velocity indicator. You have it in the package of PROGRESS. If you don’t find exactly the same number , it is just because I use it with the Extern parameter Len = 10. I didn’t go in details to explain to you the algorithm but I think the idea is to go back and look for the Highest High and the lowest low and see the variation in a time interval.**

As for the acceleration I just substract the current value to the previous one. If I refer…

As for the acceleration I just substract the current value to the previous one. If I refer…

**Isn’t acceleration rate of change of velocity ? and velocity rate of change of distance ? **

**20 pips a day isn’t too much to ask . . .**

Hi RaptorUK

**Yes acceleration is the variation in velocity divided by variation in time : As I substract the current value from the previous one , which is the bar before and it is one unity of time before, It’s dividing by 1 in our case. As for the velocity it is the rate of change in price.**

I talked about how to determine an orientation by combining the periods signals and I talked about the momentum for entry points and the recovery mode. OK here let’s see a real example of how we can know determine that an orientation is UP or down and we do a example working on the orientation and the recovery mode. I will go step by step slowly to let you understand the idea. What I am going to do is not part of the next version but a introduction to the orientation concept as I will mix the MidTerm orientation and the ShortTerm Orientation without taking in account the D1 period.

The example that I will talk about contains the orientation concept and the recovery mode idea that I talked about.

OK Let’s determine first when and how I say my orientation is UP or DOWN. When I talked about Orientation, I introduced the Direction of a trend, the movement and the momentum, and I said that all indicators that are based on moving average are good candidates for the orientation and movement and the volume and velocity are the one used for tne momentum which gives us a sign for entering a trade or not.

The moving averages I will consider here are from the most sensible to the less sensible : MA_7 (which is the moving average 7 periods), Fast Trix , Slow trix, Slope Indicator, Coral and MA_200 (the moving average 200 periods)

TO understand the picture below, I will take the example of the slope indicator and tells you how I determine the orientation.

I say that my Orientation is UP if I have the Slope Indicator up for the periods P_M15 , P_M30, P_H1, P_H4. It is calculated with the function :

All (OBJECT, SIGNAL) which gives me the decimal result.

if All (SLOPE, S_UP) >= h4_h1_m30_m15 === > My orientation is UP

Now See the picture below :