Newbie needs help

 

Newbie programmer here.

I am working on an EA that uses fractals. "LastUpFractal_Br" is a bool variable that states whether the upfractal broke or not. When a downfractal breaks, it is set to false.
I want the EA to give me a message when that value changes and only then. I changed a code that does the same thing for another variable into this:

   bool TempUp;
   if(TempUp!=LastUpFractal_Br && LastUpFractal_Br==true)
      {
      {PlaySound("alarm"); MessageBox("LastUpFractal_Br");}
      TempUp=LastUpFractal_Br;
      }
I tried several variations of it. Why doesn't it work? It gives me the message over and over again until a downfractal breaks and therefore until LastUpFractal_Br is false.
 
ChrisK99:

Newbie programmer here.

I am working on an EA that uses fractals. "LastUpFractal_Br" is a bool variable that states whether the upfractal broke or not. When a downfractal breaks, it is set to false.
I want the EA to give me a message when that value changes and only then. I changed a code that does the same thing for another variable into this:

I tried several variations of it. Why doesn't it work? It gives me the message over and over again until a downfractal breaks and therefore until LastUpFractal_Br is false.

Run your code through line by line,  on paper if needed . . .  and see what will happen to the variables . . .

1.  Initially TempUp =  false

2.  for the sound to play  LastUpFractal_Br = true

3.  TempUp =  LastUpFractal_Br = true

for the next tick return to 1.  

 

Did you mean for TempUp to be a static declaration ? 

 

I tried that, too, but I just can't get it to work. My code contains way more difficult parts, but for some reason I just can't wrap my head around that one. :D
It's not easy to get into. My only programming before this was a small program to learn some vocabulary about 15 years ago.

 

Can nobody help me?

I tried so many things, I don't know what else to try.

 
ChrisK99:

Can nobody help me?

I tried so many things, I don't know what else to try.

Print() all the variables involved so you can see what is going on,  when you know what is happening you can figure out why.
Reason: