3 MA Cross Formula

 
 
raven_chrono:

Good Day..

Does this formula that i have modified can be implemented on 3 MA's crossing...

Thank you very much...

  • Certainly not. Can you defined what you mean by "3 MA's crossing" ?
  • The following expression makes no sense, ab and bc are bools, what's the meaning of true>false or true>true ?
  bool abc=ab>bc;
  • a, b, c are values for iMA on the current bar, they can change on every tick. Your conditions (if logically correct) can also change on every tick. You have probably to work with closed bars.
 
angevoyageur:
  • Certainly not. Can you defined what you mean by "3 MA's crossing" ?
  • The following expression makes no sense, ab and bc are bools, what's the meaning of true>false or true>true ?
  • a, b, c are values for iMA on the current bar, they can change on every tick. Your conditions (if logically correct) can also change on every tick. You have probably to work with closed bars.


3 Moving Averages when they cross together or intersect...

 
raven_chrono:


3 Moving Averages when they cross together or intersect...

If we define the 3 ma as fast, mid, slow and fast1 as fast value at candle 1, fast2 as fast value at candle 2, etc... then :

if (fast2>slow2 && mid2>slow2 && fast1<slow1 && mid1<slow1)
 Print("Your cross");

However you will probably get very few crosses, you can extend you condition by using candle 3 instead of candle 2.

 
angevoyageur:

If we define the 3 ma as fast, mid, slow and fast1 as fast value at candle 1, fast2 as fast value at candle 2, etc... then :

However you will probably get very few crosses, you can extend you condition by using candle 3 instead of candle 2.


thank you so much

 

You probably want to compare with a very generous tolerance.

I suspect it only happens with a massive reversal that pulls the fast MA across the others but is big enough to pull the Medium MA too, in which case the price action itself (Bid movement) should be an earlier signal, and easier to code for? (as in your diagram?)

 
ydrol:

You probably want to compare with a very generous tolerance.

I suspect it only happens with a massive reversal that pulls the fast MA across the others but is big enough to pull the Medium MA too, in which case the price action itself (Bid movement) should be an earlier signal, and easier to code for? (as in your diagram?)


Do you have an idea on how to achieve or to have that kind of formula.
 

Depends on your time frames and how fast you want to react- eg

Last candle -

MathAbs(Bid - Open[0] ) > somePriceDifference

or a bit safer but slower for faster timeframes :

MathAbs(Bid - Open[1] ) > somePriceDifference

or compare against price 'n' ticks ago... (You'll need to write own code for that. I store Bid into an array and move the index with each tick, wrapping it back to 0 when the array is full)

You may also want to make it direction specific and use High[], Low[] instead of Open[]. (and remove MathAbs) This may make it a bit more 'reactive'
 

Also, I havent done any real trading yet, but I think such huge movements may be reaction to news. Unless you are specifically trading news, I'd be wary of a fully automated strategy around this.

In fact, I recently added code for my EA to stop looking for entrypoints on any day there is massive pip movement. (using code similar to above)

 
ydrol:

Also, I havent done any real trading yet, but I think such huge movements may be reaction to news. Unless you are specifically trading news, I'd be wary of a fully automated strategy around this.

In fact, I recently added code for my EA to stop looking for entrypoints on any day there is massive pip movement. (using code similar to above)


The logic is when those 3 MA's intercept each other, it will open a trade(if there is no active trades) or close trades (if there is an active trade). Now i am trying to use this formula form geometry "y=mx+b"... and so far the results is fine but not conclusive...
 

Out of curiosity, How often does this happen? What Timeframes & MA Periods are you using?

This might be of interest.. 3 MA Cross with Alert

Reason: