"Hello, I created this function to visualize the stochastic and signal value, but I have this problem:when i put it on the graph in which already is the default stochastic value MT this happens: The default stochastic value MT results as a different value compared to the value which I made, Where is the mistake? How do I fix it. Thanks
- You shouldn't have made your second post. You should have edited your original post.
bool IperVend (double stochastic1now, double signal1now, double LimitUpIperVend, double LimitDownIperVend){ if ((stochastic1now && signal1now > LimitDownIperVend) && ( stochastic1now && signal1now < LimitUpIperVend)) return 1; else return 0; }
stochastic1now is a double say 5. What does it mean when you write if ((5 ...?- Your function returns a bool. Why are you returning an int?
- Simplify your code.
bool IperVend (double NOTUSED, double signal1now, double LimitUpIperVend, double LimitDownIperVend){ bool condition1 = signal1now > LimitDownIperVend; bool condition2 = signal1now < LimitUpIperVend; return condition1 && condition2; }
if(counted_bars>0) counted_bars--; limit=Bars-counted_bars;
No need for the decrement. Contradictory information on IndicatorCounted() - MQL4 forum// if(counted_bars>0) counted_bars--; limit=Bars-counted_bars;
MODE_SIGNAL,i+1); //Segnale precedente
Handle your lookback// stochastic1now = iStochastic(NULL,0,KPeriod1,DPeriod1,Slowing1,0,1,0,i); //Stocastic ora // signal1now = iStochastic(NULL,0,KPeriod1,DPeriod1,Slowing1,0,1,MODE_SIGNAL,i); //Segnale ora // stochastic1previous = iStochastic(NULL,0,KPeriod1,DPeriod1,Slowing1,0,1,0,i+1); //Stocastic precedente // signal1previous = iStochastic(NULL,0,KPeriod1,DPeriod1,Slowing1,0,1,MODE_SIGNAL,i+1); //Segnale precedente int LOOKBACK = KPeriod1 + 1; // if(counted_bars>0) counted_bars--; if(counted_bars < LOOKBACK) counted_bars=LOOKBACK; limit=Bars -counted_bars;
- Get in the habit of counting down.
bool iperVenduto=false, iperComprato=false; for(i = 0; i < limit; i++) { : if (IperComp(stochastic1now,signal1now,LimitUpIpercompr,LimitDownIpercompr)) iperComprato = true;
Do you really want to issue an alert when ANY bar on the chart is IperComp? or only bar zero?
Any bar
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
the indicator of default MT me a value different from the value that gives me the indicator that I did, where is the error? how to correct it?