may be you can try to save them in a file
may be this might help you https://docs.mql4.com/files
birendorf:
Computers don't randomly forget values. If you save the value in a static variable or a global variable then it will be saved from one tick to the next. The data will get lost if the terminal is shutdown but then you could save to a file. I suspect that the simple option of using a static variable will be enough.
Hi guys
Im trying to find high and low of the last 10 bars then keep the value and wait until the price cross it up or down, but I'm losing the value of the high or low, can someone suggest me something
please
Try this:
if(save_my_high_value) GlobalVariableSet("high_last_10", iHigh(Symbol(),PERIOD_H1,iHighest(Symbol(),PERIOD_H1,MODE_HIGH,10,0))); //... // later on, ... You can even shutdown the terminal. double the_highest_bar = GlobalVariableGet("high_last_10"); if(Ask>the_highest_bar) do_something_with_it();
You don't need global variables or statics (persistent storage)
im trying to find high and low of the last 10 bars then keep the value and wait until the price cross it up or down
int start(){ int iLL = Lowest(NULL,0, MODE_LOW, 10, 1), iHH = Highest(NULL,0, MODE_HIGH, 10, 1); double LL = Low[iLL], HH = High[iHH]; if (Bid > HH){ ... } else if (Bid < HH){ ... } // else return and wait. }

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi guys
Im trying to find high and low of the last 10 bars then keep the value and wait until the price cross it up or down, but I'm losing the value of the high or low, can someone suggest me something
please