Centred moving average

Here you can post and download custom indicators. PLEASE: Do not start topics unless you are posting your own indicator, they will be moved to appropriate section even if you do.

Moderator: admin

Centred moving average

Postby Apprentice » Mon Oct 15, 2012 12:20 pm

CMA.png

This indicator is basically a simple moving average,
if compared with the original, there is a notable reduction in lag time,
last Period/2 values are just a projection of possible future SMA values.
CMA.bin
Supports SMA(MVA)
(1.26 KiB) Downloaded 1707 times

OCMA.bin
Supports SMA(MVA), EMA, LWMA, TMA, SMMA, KAMA, VIDYA, WMA
(1.55 KiB) Downloaded 722 times

CMA.png

CMAD.lua
CMA difference
(3.78 KiB) Downloaded 736 times

CMAD Histogram.lua
(5 KiB) Downloaded 189 times

CMAD = CMA1 -CMA2
CMAS.lua
CMA speed
(4.07 KiB) Downloaded 648 times

CMAS Histogram.lua
(4.36 KiB) Downloaded 181 times

CMAS = CMA-CMA[-1]

CMAD Momentum.png

CMAD Momentum = CMAD- CMAD N Perods Ago
CMAD Momentum.lua
(4.36 KiB) Downloaded 703 times
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 17357
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Centred moving average

Postby Apprentice » Tue Oct 16, 2012 12:16 pm

Two Averages Oscillator.png

TAO= MA1-MA2
Two Averages Oscillator.lua
(5.8 KiB) Downloaded 874 times


Centred moving average is one of the moving averages used.
As Centered moving average repaint,
when CMA is used, TAO will also repaint.
However i have included Static / Dynamic Mode Selector also.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 17357
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Centred moving average

Postby lucmat » Mon Oct 22, 2012 4:22 pm

Hi Apprentice!
Your works are always good!!

Do you think it's possible to build "cyclical indicator" (seehttp://fxcodebase.com/code/viewtopic ... +indicator) with this centered moving average?

Thanks

Lucmat
lucmat
 
Posts: 57
Joined: Sat Aug 13, 2011 12:14 pm

Re: Centred moving average

Postby Apprentice » Tue Oct 23, 2012 7:15 am

I post your simplified version in the Indicator Request subforum.
I have not had time for you first integral version.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 17357
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Centred moving average

Postby Davids0869 » Thu Nov 08, 2012 6:21 am

Hi Appendice, Hello, I would like to know if it is possible at first to have a program which gives a signal of purchase or sale according to three different oscillators in the same graph. A first signal of purchase (1 lot) when 2 two average oscillator are increasing and the second (3 lots) when 3 are increasing. You've an interpretation in this following graph for a short.


Apprentice wrote:
The attachment Two Averages Oscillator.png is no longer available

TAO= MA1-MA2
The attachment Two Averages Oscillator.png is no longer available


Centred moving average is one of the moving averages used.
As Centered moving average repaint,
when CMA is used, TAO will also repaint.
However i have included Static / Dynamic Mode Selector also.
Attachments
CMA.png
Davids0869
 
Posts: 5
Joined: Thu Nov 08, 2012 4:53 am

Re: Centred moving average

Postby Apprentice » Fri Nov 09, 2012 6:14 am

Yes, this is possible.
But i am not sure, CMA is best choice.
Because CMA repaints,
Historical, backtest is meaningless,
trading, in current (last) period is possible...
But I guess with lot of changes in indications.
Write trading algorithm conditions, we can try...
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 17357
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Centred moving average

Postby Davids0869 » Fri Nov 09, 2012 2:14 pm

Thank you Apprentice, I propose that (for short):

Code: Select all
Value for CMA1 = N
Value for CMA2 = 2*N     ,       TAO1=CMA1-CMA2     
Value for CMA3 = 4*N     ,       TAO2=CMA2-CMA3
Value for CMA4 = 8*N     ,       TAO3=CMA3-CMA4

Period = 4*N

Maximum = MAX[PERIOD](close)
Minimum = MIN[PERIOD](close)

G = (CMA2 + CMA3 + CMA4) /3

IF close > G then
C = 1
else C = 0
Endif

IF CMA2 < CMA2[1] then
   C1 = 1
   Else C1 = 0
Endif

IF CMA3 < CMA3[1] then
   C2 = 1
   Else C2 = 0
Endif

IF CMA4 < CMA4[1]  then
   C3 = 1
   Else C3 = 0
Endif

X = C1 + C2 + C3

IF X = 2 and C = 1 and not short on market then
sell 1 lot
Target = G 
Endif

IF X = 3 and C = 1  then
sell 2 lots
Target = 2* G  - MAXIMUM
Endif

The same for long with condition ">" in place of "<", and C = 0  and  MINIMUM in place of MAXIMUM to calculate Target when buy 2 lots.


If you have any question don't hesitate to contact me.

David.


Apprentice wrote:Yes, this is possible.=
But i am not sure, CMA is best choice.
Because CMA repaints,
Historical, backtest is meaningless,
>Gtrading, in current (last) period is possible...
But I guess with lot of changes in indications.
Write trading algorithm conditions, we can try...
Davids0869
 
Posts: 5
Joined: Thu Nov 08, 2012 4:53 am

Re: Centred moving average

Postby Davids0869 » Sun Nov 11, 2012 6:19 am

Maybe there is a particular condition for the calculation of G (and of course the new target). It is a mobile point and I think that we could fix it when the price crosses G. At this moment there we shall have defined the new target of exit of the trade.
Davids0869
 
Posts: 5
Joined: Thu Nov 08, 2012 4:53 am

Re: Centred moving average

Postby Tigre3 » Sat Nov 24, 2012 6:26 am

Could you make a version that shows with a different type of line where there's projection of the MA?

For example
If you have a CMA(10) the last 5 value is just a projection, right? Well, I'm looking for an indicator that shows this projection with a different type of line such as if the CMA is a line, the projection will be a dotted line.. in this way I can know where the will probably repaint.


The options should be like this:
Type of line: [listbox with the different kind of line]
Type of projection: [listbox with the different kind of line]

Thanks :)
Tigre3
 
Posts: 65
Joined: Sun Oct 14, 2012 4:24 pm

Re: Centred moving average

Postby Apprentice » Sat Nov 24, 2012 6:42 am

This is possible.
But i will prefer different Color, not Style difference, compatibility issue,
for line style i have to use two streams, not one as now.
Is this satisfactory.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 17357
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Next

Return to Custom Indicators

Who is online

Users browsing this forum: Bing [Bot] and 12 guests