How can I Store the Ask Price, then Stop Storing it, Until a Certain Condition is Met?

 

How can I store the Ask price, then add 10 points to it, and when this new level is hit, store that, and then add another 10 points?  


It would need to be something like, stored Ask price, plus 10 points, then make this the target price, in which the alert will be triggered.  


So, I need the Ask to get stored, and then the storing of the Ask to be shut off (while at the same time, adding 10 points to it), until the target price is hit, and when the target price is hit, store this new Ask price and repeat.  

The double target I have here is obviously static so it wont be changed, but how can you cause things in metaeditor to change by themselves?

extern int AddPipp = 1000;
extern int SubtractPipp = 1000;



void OnTick()
  {
  

double target = 27820;

if(Ask > target);

Alert(Ask);

target + AddPipp*Point;
  }

What I think I need to do, is to be able to change the double target figure inside Metaeditor, but I can't figure out how.  I've been Googling all sorts, but what I am finding is related to candle open start price, close price etc, and not the live price.  


I know this code is not enough and something else needs to be inserted, which is what I'm trying to figure out, if anyone can help.   


Thanks

 
  1. if(Ask > target);
    This if does nothing.
  2. target + AddPipp*Point;
    
    This statement does nothing.
 
William Roeder:
  1. This if does nothing.
  2. This statement does nothing.

I see what you mean, since I'm only new to this, I have been changing things around and sometimes they were working and other times not.  


I have some code (the new one attached) that may be a little bit better, but still has errors.  For example, the part if(Open[0] > Open[4]+AddPipp*Point), doesn't return the value if it is 10 points higher than 4 bars previous, it simply returns the Ask Price if it is simply higher than the 4th bar back.  Even if I got that to work properly it wouldn't be nearly as good as getting the first example done properly.  



Can someone give me some idea please about how I need to go about it, such as what kind of functions or statements do I need to work with.  I'm not asking for someone to do it for me, but just for some information on what I need to work on myself.  As of now I have no clue whatsoever, and I have Googled a ton of search terms and have come across nothing that relates to either doing only one execution for the bid hitting a target, or how to update the code after it hits a bid and set a new price target.  Everything I have found is related to simply making sure the first tick of a new bar is the only one that is triggered.  

extern int AddPipp = 1000;
extern int SubtractPipp = 1000;
datetime NewCandleTime=TimeCurrent();

bool IsNewCandle(){

   if(NewCandleTime==iTime(Symbol(),0,0)) return false;

   else{

      NewCandleTime=iTime(Symbol(),0,0);

      return true;

   }

}



void OnTick(){

   if(IsNewCandle()){



   if(Open[0] > Open[4]+AddPipp*Point)

   

   SendNotification("Dow Price is Higher" + Ask);

   



         }

         

}
 
Can someone tell me if there is a more appropriate place to ask such questions?  
Reason: