XP Moving Average! - page 4

 

shift is an INDICATOR itself!

deepdrunk:
for(int shift=limit; shift>=0; shift--)

{

UpBuffer[shift] = buffer[shift];

DownBuffer[shift] = buffer[shift];

Buffer3[shift] = buffer[shift];

}

for(shift=limit; shift>=0; shift--)

{

if (buffer[shift+1]>buffer[shift])

{

UpBuffer[shift+1] = EMPTY_VALUE;

//Buffer3 = EMPTY_VALUE;

}

else if (buffer[shift+1]<buffer[shift] )

{

DownBuffer[shift+1] = EMPTY_VALUE;

//Buffer3 = EMPTY_VALUE;

}

else

{

UpBuffer[shift+1] = CLR_NONE;

DownBuffer[shift+1] = CLR_NONE;

}

}

return(0);
only thing what is suspitios to me here is that 'shift';maybe it is the reason for repainting,cant we use it without shift ? like bar[1] bar[0] sorry but it is out of my mql4 knowledg.

Any indicator uses shift (which here is equal to limitand limitequal to Bars-counted_bars)

What does it mean:

In the firstload of the indicator (not only my indicator but it's a general topic for any indicator wrote in MQL4,VT or EL) get the count of bars on chart and make the indicator calculation then draw the indicator.

afterwards, Everytime you get a new tick draw the new bar of indicator.

So, in the first load of the indicator limit will equal to the count of the bar and afterwards it will always be 0. So we using the current bar (Bar[0]) and the previous bar (Bar[1]).

This is another variation of the code and I think this is better (I'll update the indicator in xpworx.com)!

for(int shift=0; shift<limit; shift++)

{

UpBuffer[shift] = buffer[shift];

DownBuffer[shift] = buffer[shift];

Buffer3[shift] = buffer[shift];

}

for(shift=0; shift<limit; shift++)

{

if (buffer[shift]<buffer[shift+1])

{

UpBuffer[shift] = EMPTY_VALUE;

}

else if (buffer[shift]>buffer[shift+1] )

{

DownBuffer[shift] = EMPTY_VALUE;

}

else

{

UpBuffer[shift] = CLR_NONE;

DownBuffer[shift] = CLR_NONE;

}

}
 

HI there.

Off-coarse it will repaint past bars bcoz it's MA of "n" periods of bars. If you want nonrepaint one just put MA period value to 1!

Thank you Codersguru for your amazing work.

Cheers

 
viat:
HI there.

Off-coarse it will repaint past bars bcoz it's MA of "n" periods of bars. If you want nonrepaint one just put MA period value to 1!

Thank you Codersguru for your amazing work.

Cheers

Thanks viat!

You are right! There's no indicator that's not repaint (calculating) the past!

But repainting the past they meant is "An indicator that changes the drawing he made in the past" or they meant "An indicator that calculate the future if the past (-1 index indicator)". or they mean "It's too bad to share your indicator, or you share it because it's bad"!

Anyway, It's a moving average indicator that colored itself according too the value of the previous bar! if this means it repaint the past I'll remove it from my site and close the thread! if it does not repaint the past I'll remove it too from my site but I'll not close the thread! kidding!

 

Codersguru, I am not at all accusing you of maliciously making an indicator, but you need to warn people about this indicator, that it DOES repaint in the past.

For instance, all you need to do is look at a 1M time frame and watch the color of the indicator BEFORE the previous bar (and in some cases before the previous 2 bars) change color. This makes it impossible to backtest, and not a good indicator to trade live.

Afterall, let's say you are in a trade short, and then the indicator changes BEFORE your current bar to green (long) indicating that you SHOULD have gone long before the open of the bar. This is impossible to do.

Again I say, watch your 1M timeframe and watch how the indicator CHANGES COLOR in PREVIOUS bars.

codersguru:
Hi there!

1- I don't know what's going on! I'm sharing all of my works and didn't cheat one of you before! Any member here denies that???

2- Xp moving average is Colored Moving Average no less no more! So, if the moving averages indicators repaint the past (I'm sure they are not) then xpMA repaints the past.

The logic of coloring is very simple:

1- If the previous bar value is Greaterthan the current bar value color the moving average is Green.2- If the previous bar value is Lesserthan the current bar value color the moving average is Red.3-If the previous bar value is Equal tothe current bar value color the moving average is Yellow.Repainting the past or repainting the future:

I want to mention another thing here. Repainting the past means repainting the future for the history!I mean, I can write an indicator that looks for the next bar value which it exist only in the past (because in the current bar there's no next bar yet) That's the meaning of repainting the past I think!

Well, The answer is: XP Moving Average does not repaint the past!
 

Codersguru, are you a trader or merely a coder? If merely a coder, I am sure this indicator is very helpful for all kinds of things that coders do. If you are a trader, would you please tell us how you trade this indicator?

And specifically, what do you do if you are in a long trade and the indicator changes color 2 bars behind you? Do you quickly reverse position? Or do you stay in the trade hoping the indicator will change back according to price movement?

I'm very interested in knowing how someone would trade with an indicator that changes color in previous bars.

Also, how does one backtest using this indicator? I mean, I am sure I could develop an indicator that looks back 50 bars and changes all the previous bars to red when the market was sinking, and all the previous bars to green when the market was climbing.

Then I could release the indicator and people would look at it, backtest it, and think they had the holy grail. Problem is, I would sooner or later have to explain to them that indicators that change the colors previously are no good in backtesting, and not much good in live trading.

Please, help me understand how you actually trade with this indicator.

codersguru:
Thanks viat!

You are right! There's no indicator that's not repaint (calculating) the past!

But repainting the past they meant is "An indicator that changes the drawing he made in the past" or they meant "An indicator that calculate the future if the past (-1 index indicator)". or they mean "It's too bad to share your indicator, or you share it because it's bad"!

Anyway, It's a moving average indicator that colored itself according too the value of the previous bar! if this means it repaint the past I'll remove it from my site and close the thread! if it does not repaint the past I'll remove it too from my site but I'll not close the thread! kidding!
 
mikejody:
Codersguru, are you a trader or merely a coder? If merely a coder, I am sure this indicator is very helpful for all kinds of things that coders do. If you are a trader, would you please tell us how you trade this indicator?

And specifically, what do you do if you are in a long trade and the indicator changes color 2 bars behind you? Do you quickly reverse position? Or do you stay in the trade hoping the indicator will change back according to price movement?

I'm very interested in knowing how someone would trade with an indicator that changes color in previous bars.

Also, how does one backtest using this indicator? I mean, I am sure I could develop an indicator that looks back 50 bars and changes all the previous bars to red when the market was sinking, and all the previous bars to green when the market was climbing.

Then I could release the indicator and people would look at it, backtest it, and think they had the holy grail. Problem is, I would sooner or later have to explain to them that indicators that change the colors previously are no good in backtesting, and not much good in live trading.

Please, help me understand how you actually trade with this indicator.

It does not repaint the past!

Note: To be sure we are using the same version of the indicator please go to:

XP Moving Average v2

 
mikejody:
Codersguru, are you a trader or merely a coder? If merely a coder, I am sure this indicator is very helpful for all kinds of things that coders do. If you are a trader, would you please tell us how you trade this indicator?

And specifically, what do you do if you are in a long trade and the indicator changes color 2 bars behind you? Do you quickly reverse position? Or do you stay in the trade hoping the indicator will change back according to price movement?

I'm very interested in knowing how someone would trade with an indicator that changes color in previous bars.

Also, how does one backtest using this indicator? I mean, I am sure I could develop an indicator that looks back 50 bars and changes all the previous bars to red when the market was sinking, and all the previous bars to green when the market was climbing.

Then I could release the indicator and people would look at it, backtest it, and think they had the holy grail. Problem is, I would sooner or later have to explain to them that indicators that change the colors previously are no good in backtesting, and not much good in live trading.

Please, help me understand how you actually trade with this indicator.

Hi mikejody.

Read post#33 please. Then if you don't understand how MA's works just Google it. If you want to trade only using 1 MA try E/E on slope change. But I think you need more than one indicator for good E/E.

XPMA works like usual MA but have had better visual effect.

Hope this help.

viat

 

If you look right now on Cable 1M, the 2018 GMT bar is at 1.8967, and there are 3 previous bars of red indicator. However, when the price goes to 1.8968 or higher, the indicator 2 BARS PREVIOUSLY changes color from red to yellow.

That is, the bar at 2017, the PREVIOUS bar's indicator, turns color from red to yellow. THIS is what we all mean by "repainting the past." In other words, you are in this trade short right now, but when the price goes up one tick the indicator makes it look like you should have been OUT of the trade at least 1-2 bars EARLIER.

Why is this so difficult to understand?

codersguru:
It does not repaint the past!

Note: To be sure we are using the same version of the indicator please go to:

XP Moving Average v2
 

The way i am using it

The way i am using this indicator:

I am placing in 30 min. chart:

- XP MA 4

- XP MA 20

- XP MA 90

For entries, i wait until all XP MAs changes at the same collor

For exits, i wait until XP MA 20 changes his collor, but the change of XP MA 4 means a warning signal.

I am just starting to test indicator that way. So far, with good results.

THANKS, CODERSGURU !!!!!

 

FXNewbie, you are going to have difficulty trading this way because the indicators repaint the past. Just be cautious and be ready to exit when the indicator several bars BEHIND you changes color.

fxnewbie:
The way i am using this indicator:

I am placing in 30 min. chart:

- XP MA 4

- XP MA 20

- XP MA 90

For entries, i wait until all XP MAs changes at the same collor

For exits, i wait until XP MA 20 changes his collor, but the change of XP MA 4 means a warning signal.

I am just starting to test indicator that way. So far, with good results.

THANKS, CODERSGURU !!!!!
Reason: