Hello,
I want to use MA within the Stochastic indicator window. When the 'Signal' line crosses with that MA, Buy/Sell will trigger.
To do this, how can I define the iMAOnArray()?
Now to define iMAOnArray() function would I have to make 'Signal_Sto' an array i.e. Signal_Sto[i] and call it at iMAOnArray() like this:
OR
if I just call Signal_Sto like this without using Array:
will the function work?
And if I have to use the Array then will be the code like this:
My principle is comparing Signal_Sto and MA_Sto.
Regards
Your last block of code you are overwriting MA_Sto 10000 times . . . why ? don't you want to use a buffer/array there ?
Red the documentation and search the forum, iMAOnArray() has been discussed plenty.
Your last block of code you are overwriting MA_Sto 10000 times . . . why ? don't you want to use a buffer/array there ?
Hello
Thanks for the reply.
I have posted this after searching Internet+This Forum.
Yes there are plenty of examples on iMAOnArray() but I haven't found the one I need yet. [With Stochastic].
From there I got the idea what I have presented here but now I need someone to correct me please.
And yes, it's a mistake.
It should be like this, right?
for(int i=0; i<100000; i++) // set the checking limit to 100000 bars double Signal_Sto[i]= iStochastic(NULL,0,70,5,5,MODE_EMA,0,MODE_SIGNAL,0); for(int i=0; i<100000; i++)//----------------------------------------------> if I don't use this Array, any problem? double MA_Sto= iMAOnArray( Signal_Sto, 0,14,0,MODE_SMA,0);// for current buffer
for(int i=0; i<100000; i++) // set the checking limit to 100000 bars //---Check that i<Bars double Signal_Sto[i]= iStochastic(NULL,0,70,5,5,MODE_EMA,0,MODE_SIGNAL,0); //Do you want this to be 0? for(int i=0; i<100000; i++)//----------------------------------------------> if I don't use this Array, any problem? double MA_Sto= iMAOnArray( Signal_Sto, 0,14,0,MODE_SMA,0);// for current buffer
Hello
Thanks for the reply.
I have posted this after searching Internet+This Forum.
Yes there are plenty of examples on iMAOnArray() but I haven't found the one I need yet. [With Stochastic].
From there I got the idea what I have presented here but now I need someone to correct me please.
And yes, it's a mistake.
It should be like this, right?
ohh, I did it wrong. If I put '0' there instead of 'i', then the Signal_Sto[i]will always be giving the value of current bar even though 'i' keeps increasing, right?
So I have to check the 'i' times to get all the previous value?
for(int i=0; i<Bars; i++) // set the checking limit to 100000 bars double Signal_Sto[i]= iStochastic(NULL,0,70,5,5,MODE_EMA,0,MODE_SIGNAL,i);
I need to compare Signal_Sto and MA_Sto on current bar's every tick. For it if I just simply put this, will it work?
double Signal_Sto= iStochastic(NULL,0,70,5,5,MODE_EMA,0,MODE_SIGNAL,0); double MA_Sto= iMAOnArray( Signal_Sto, 0,14,0,MODE_SMA,0);
Thanks
It depends on what you are trying to achieve . . . it might be right, it's more likely wrong. Why not use a buffer/array ?
I probably got your point. Please correct me if I am wrong.
At the attached screenshot's 'Red Vertical Line', the values of Stochastic and MA are:
Stoch=86.5602 [buffer 0]
Signal=76.0463 [buffer 1]
MA(14)=70.0273 [buffer 2]
Now I have to compare buffer 1 and buffer 2.
if(buffer 1>buffer 2) or if(buffer 1< buffer 2)
But how can I define the MA part, buffer 2 ?
Say if Y1 gets the value of buffer 1 and Y2 gets the value of buffer 2,
then
Y1 =iStochastic(NULL,0,70,5,5,MODE_EMA,0,MODE_SIGNAL,0);
But what for Y2= ?
I want to use MA within the Stochastic indicator window. When the 'Signal' line crosses with that MA, Buy/Sell will trigger.
i don't get it it's n indiicator or a EA
It'd be an EA.
I don't have problem with buying/selling part. Just need to fix the 'Indicator' calling part.
Thanks
still don't understand u gonna make n indicator & then use it with iCustom() or the all calculation is gonna be writen in the EA
Calculations gonna be written in the EA.
The theory is having a 'Stochastic' indicator with a MA into it. That is the MA is in the Stochastic indicator's Data window.
But practically this idea is going to be implemented into the EA. That's it.
Here I am encountering the problem of defining the 'MA' function regarding the above scenario.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I want to use MA within the Stochastic indicator window. When the 'Signal' line crosses with that MA, Buy/Sell will trigger.
To do this, how can I define the iMAOnArray()?
Now to define iMAOnArray() function would I have to make 'Signal_Sto' an array i.e. Signal_Sto[i] and call it at iMAOnArray() like this:
OR
if I just call Signal_Sto like this without using Array:
will the function work?
And if I have to use the Array then will be the code like this:
My principle is comparing Signal_Sto and MA_Sto.
Regards