2TJV: I try to use for(int i=1;i>=1;i++) but my mt4 just shuts down.
PlotText("Number"
- Infinite loop, of course it dies.
- You can only create one object of a given name.
William Roeder:
- Infinite loop, of course it dies.
- You can only create one object of a given name.
Hello William Roeder,
I'm happy when you comment on my thread. You can see this code is from you:
#define HR2400 86400 #define SECONDS uint SECONDS time(datetime when=0){return SECONDS(when==0?TimeCurrent():when)%HR2400;} datetime date(datetime when=0){return datetime((when==0?TimeCurrent():when)-time(when));} bool TradingTime(SECONDS start, SECONDS end, datetime when=0) { SECONDS now=time(when); return start<end?start<=now&&now<end:!TradingTime(end, start, when); }
I searched a lot to know how to code limit time from "hh1:mm1" to "hh2:mm2" during the day. Thank you so much!
- So.... How can I do to limit the loop? I added if(TradingTime(HR0900,HR1500)) to try to stop when it was 15:00 but like you said: "Infinite loop, of course it dies". How can I start number 1 at 09:00 and go on? And yeah, it will stop at 15:00 then repeat next day. I'm still thinking right now.
- If I just can create only one object of a given name, I will have to create a sequence of different names of objects. That means I must add more like this right?
PlotText("Number" + IntegerToString(i);
2TJV: So.... How can I do to limit the loop?
Why do you need a loop?
William Roeder:
I don't know! I just want to create a sequence of numbers 1, 2, 3, 4,... at the low of each bar everyday. You can see the image I attached on #1. Truly, I think for() works but it's not. Now I got stuck into it. Do I need to use Array or something?
Why do you need a loop?
2TJV:
I don't know!
I just want to create a sequence of numbers 1, 2, 3, 4,... at the low of each bar everyday.
- Stop creating your own problem.
- Each new bar is a new number; no loop required.
William Roeder:
- Stop creating your own problem.
- Each new bar is a new number; no loop required.
But how do I start with number "1" then 2, 3, 4, 5,...?
PlotText("Number",true,0,Time[0],Low[0],????,clrRed,8,"Arial",0,true);
if(isNewBar){ static int count = 0; ++count; PlotIf that is so hard for you, that you couldn't even attempt it, step away from the computer and hire someone; you're wasting everyone's time including your own.
William Roeder:
If that is so hard for you, that you couldn't even attempt it, step away from the computer and hire someone; you're wasting everyone's time including your own.
If that is so hard for you, that you couldn't even attempt it, step away from the computer and hire someone; you're wasting everyone's time including your own.
Thanks for your advice! Have a nice day!
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
1. How can I plot consecutive number (text) with each bar? I want to start "1" at 09:00 and then 2, 3, 4,... I try to use for(int i=1;i>=1;i++) but my mt4 just shuts down.
2. How can I keep the numbers position staying at the bars? It keeps moving, updating to the present bar and the previous bar doesn't have number below it.
Here the code. I know it's a mess. I am a beginner so just teach me. Tell me what to do!
p/s: My goal is to create the indicator in the image.