Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1400

 
Alexey Viktorov:

Look at the Heiken Ashi indicator. It solves this problem somehow. Experiment... maybe it will work.

This is the main chart, no problem there. I'm interested in the basement.
 

So far the issue has been resolved by OBJ_TREND

but don't like it when zooming in(

 
Alexey Viktorov:

Look at the Heiken Ashi indicator. It solves this problem somehow. Experiment... maybe it will work.

Your tip was helpful, but alas it didn't work.

It's not good at scale either(

 
MakarFX:

Your tip helped, but alas it didn't fit

At scale it's no good either(

What's wrong?

 
Alexey Viktorov:

What's wrong?

Visually bad

 

Hi all!

Here's the problem:
Price crosses the MA down or up.
I need to memorise it in order to use it later in calculating the number of points passed.

This is how I understand it:

double FixPrice; // variable

bool Fix=false; // marker

if ( Fix==false) {

if ( Close[0] > MA_lo ) FixPrice = Close[0];
} // measure until the price crosses the MA

if ( Close[0] < MA_lo ) Fix=true;

if ( Fix==true) FixPrice_L = FixPrice ;

And here is the next hitch - the price is not memorized!

I will be very grateful for help!
Files:
 
klub2003:

Hello all!

  if ( Close[0] < MA_lo )    Fix=true; 

only on the screenshot Close is no less than MA

 
klub2003:

Hi all!

Here's the problem:
Price crosses the MA down or up.
I need to memorise it in order to use it later in calculating the number of points passed.

This is how I understand it:

double FixPrice; // variable

bool Fix=false; // marker

if ( Fix==false) {

if ( Close[0] > MA_lo ) FixPrice = Close[0];
} // measure until the price crosses the MA

if ( Close[0] < MA_lo ) Fix=true;

if ( Fix==true) FixPrice_L = FixPrice ;

And here is the next hitch - the price is not memorized!

I would be very grateful for your help!
  1. Learn to insert code.
  2. Where variables are declared
double     FixPrice;        // переменная
bool       Fix=false;       // маркер 

 
klub2003:
And then there's the hitch - the price isn't remembered!
I would be very grateful for your help!

Declare globally

double    FixPrice;        // переменная
bool      Fix=false;        // маркер 

Or

static double    FixPrice;        // переменная
static bool      Fix=false;        // маркер 
 
Konstantin Nikitin:

Declare globally

Or

So what should it look like to lock the price at the moment the MA is crossed?
Reason: