
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
Also note that you cannot access "P" from the EA. You can only access the Indicators "buffers", so you indicator code has to written correctly in order to store the required infomation in the "buffers" (arrays).
Ok so in this case i use the PBuffer used in the indicator script,right?
You access the Indicator data from the EA by using the iCustom() function.
I suggest you first have a look at the many examples in the CodeBase section and really go through the documentation thoroughly.
Thanks a lot.
Please read the documentation on iCustom() else you are just guessing at things and the questions you have will not make sense.
Also, run a search on the forum on the this function, as there are many, many posts with newbie coders asking exactly the same thing over and over again.
So, do some research first and look at the many examples available!
Please read the documentation on iCustom() else you are just guessing at things and the questions you have will not make sense.
Also, run a search on the forum on the this function, as there are many, many posts with newbie coders asking exactly the same thing over and over again.
So, do some research first and look at the many examples available!
Okay sorry and thanks.
I search and I made this (for now) it is correct?
No! EAs don't use the OnStart() event. They use the OnTick() event.
As for the rest, it is very "messy" and don't use hard coded values. Use something like this:
No! EAs don't use the OnStart() event. They use the OnTick() event.
As for the rest, it is very "messy" and don't use hard coded values. Use something like this:
Okay now I have redone it thanks for the patience.
and this is the indicator script
It is right now?
Okay now I have redone it thanks for the patience.
and this is the indicator script
It is right now?
Test it yourself first in order to learn to diagnose problems:
That is how most coders do things.
Then if you are still stuck, return here with the specific problem you can't solve yourself.
Test it yourself first in order to learn to diagnose problems:
That is how most coders do things.
Then if you are still stuck, return here with the specific problem you can't solve yourself.
So, i do this and..
Compilation 0 errors.
I have no error .
strategy tester.. now is the problem he give me an alert every millisecond what can I do?
this is my code now
Thanks.
So, i do this and..
Compilation 0 errors.
I have no error .
strategy tester.. now is the problem he give me an alert every millisecond what can I do?
this is my code now
Lets take some time to think - lets use logic.
The OnTick() event gets called when? That is right - on EVERY TICK. So if during one bar there is a volume 1000 ticks, it gets called 1000 times per bar.
Now in this Event handler function OnTick(), you check a condition and when it is true, it calls the Alert. However, the condition will remain true for many, many, many more ticks until it is no longer true. So, it stands to reason, that the alert appears many, many, many times.
So, what must you do? What does logic dictate? How should you only show the alert once per condition?
You must set a flag (boolean), and check that flag to prevent showing the alert again, until the condition is over and at that time you can reset the flag.
Now, do you think you can translate these words into actual code?
This is what coding is about! You have to learn to think logically step-by-step and make a "recipe" of what must be done for every single step. That is why coding is NOT easy (it takes years to become a pro)!
It is difficult for beginners and you have to develop your skills by learning a lot, by reading a lot, by doing plenty of research, and practicing many projects.
Lets take some time to think - lets use logic.
The OnTick() event gets called when? That is right - on EVERY TICK. So if during one bar there is a volume 1000 ticks, it gets called 1000 times per bar.
Now in this Event handler function OnTick(), you check a condition and when it is true, it calls the Alert. However, the condition will remain true for many, many, many more ticks until it is no longer true. So, it stands to reason, that the alert appears many, many, many times.
So, what must you do? What does logic dictate? How should you only show the alert once per condition?
You must set a flag (boolean), and check that flag to prevent showing the alert again, until the condition is over and at that time you can reset the flag.
Now, do you think you can translate these words into actual code?
This is what coding is about! You have to learn to think logically step-by-step and make a "recipe" of what must be done for every single step. That is why coding is NOT easy (it takes years to become a pro)!
It is difficult for beginners and you have to develop your skills by learning a lot, by reading a lot, by doing plenty of research, and practicing many projects.
thanks a lot . I try