- When you post code please use the CODE button (Alt-S)!
(For large amounts of code,
attach it.)
Please edit
your post.
General rules and best pratices of the Forum. - General - MQL5 programming forum - No question asked, no problem stated, no reply required.
- When you post code please use the CODE button (Alt-S)!
(For large amounts of code,
attach it.)
Please edit
your post.
General rules and best pratices of the Forum. - General - MQL5 programming forum - No question asked, no problem stated, no reply required.
okay i fixed it.
regarding point 2, My question is simply "Whats wrong with my code?!"
- How should we know, you haven't stated a problem.
- Do you expect to see arrows in older bars? Unlike most indicators that loop through older bars and displays there also, your code only puts an arrow on bar one, you'll have to let it run for a while. If you change symbols or TF, you loose existing dots.
double KArray[]; double DArray[]; double KValue0=KArray[0]; double DValue0=DArray[0];
The arrays have no size, so your variables have random values. If you had used strict, you would have know that.- After fixing № 3,You never assign values to your arrays, so your variables have random values.
input int MAFastPeriod; input int MASlowPeriod; input int StochasticPeriod; input int StochasticSell; input int StochasticBuy; if(KValue0>=StochasticBuy)
Your variables have random values. So your condition may never be true.
- How should we know, you haven't stated a problem.
- Do you expect to see arrows in older bars? Unlike most indicators that loop through older bars and displays there also, your code only puts an arrow on bar one, you'll have to let it run for a while. If you change symbols or TF, you loose existing dots.
- The arrays have no size, so your variables have random values. If you had used strict, you would have know that.
- After fixing № 3,You never assign values to your arrays, so your variables have random values.
- Your variables have random values. So your condition may never be true.
1. The problem is that there are no arrows appearing on screen at any point.
2. ^
3. Can you explain in more detail or link me to a resource for correcting this error?
4. I don't even understand this one
5. Variables are input by the user before the insdicator runs.
Thanks for the reply, does my code make sense to you aside from the errors that have been pointed out?
Add #property strict to your code and errors are going to be shown
Starting from a fact that you parameters and arrays are not initialized at all, but since there is much more errors, use the strict statement to help you pinpoint all the errors you have in your code
Add #property strict to your code and errors are going to be shown
Starting from a fact that you parameters and arrays are not initialized at all, but since there is much more errors, use the strict statement to help you pinpoint all the errors you have in your code
I have added that line of code at the top. No errors, just one warning about a data loss due to type conversion.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
So I'm trying to create an indicator, here's the basic process
inputs:
buyzone (Stochastic level)
sellzone(stochastic level)
Fast MA
Slow MA
Sell Signal:
IF (Stochastics>= buyzone) AND (Fast MA < Slow MA)
THEN (Display Red down arrow on chart)
Buy Signal:
IF(Stochastics=<sellzone) AND (Fast MA > Slow MA)
THEN (Display Green up arrow on chart)
Code is below. Please forgive any basic errors as I'm still very new to programming.
Thanks