luckyvictor: can someone help me please?
|
Help you with what? You haven't stated a problem.
You have only four choices:
|
whroeder1:
Help you with what? You haven't stated a problem.
You have only four choices:
|
I understand your point, so i am having difficulty to locate this bar.
Can I use something like this?
If (Hour() == 8 && Minute() == 5)
High = iHigh(_symbol, Period_M5,0)
My code here just doesn't work
luckyvictor: Can I use something like this?
If (Hour() == 8 && Minute() == 5) High = iHigh(_symbol, Period_M5,0) My code here just doesn't work |
|
luckyvictor:
Hi
I want to write the following into my indicator but I don't know how, can someone help me please?
On each day, check the 5min bar at 08:05, and draw out the high and low for this 5min bar. (Basically is the high low between 8:00 to 8:05)
Many thanks for helping
Hi,
here I created for you, and you can use it for any time frame, despite you want to check it for period M5
datetime barcheck_at_once; string look_for_time="08:05"; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping barcheck_at_once=iTime(_Symbol,PERIOD_M5,1); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- if(barcheck_at_once!=iTime(_Symbol,PERIOD_M5,0)) //--check on each new bar at M5 { //--time at current bar Print("Time at current Bar: ",StringSubstr(TimeToString(iTime(_Symbol,PERIOD_M5,0)),11,5)); //--time at previous bar Print("Time at previous Bar: ",StringSubstr(TimeToString(iTime(_Symbol,PERIOD_M5,1)),11,5)); //--check your conditions if(StringSubstr(TimeToString(iTime(_Symbol,PERIOD_M5,1)),11,5)==look_for_time) { //--write your strategy here Print("Hey, I am now at ",look_for_time," :)"); } //-- barcheck_at_once=iTime(_Symbol,PERIOD_M5,0); //--new initial time at current bar } //--- return value of prev_calculated for next call return(rates_total); }
Many ways to do that, but I give you the easiest logic to understand ^_^
Good luck,
Yohana
I just try it, look for time: "23:50"
string look_for_time="23:50";
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
I want to write the following into my indicator but I don't know how, can someone help me please?
On each day, check the 5min bar at 08:05, and draw out the high and low for this 5min bar. (Basically is the high low between 8:00 to 8:05)
Many thanks for helping